Easy Blog Networks API Introduction

Conventions

  1. The API is based on Representational State Transfer (REST) software architecture concept and as such makes heavy use of HTTP methods.

  2. The API always returns results in the JSON format. All POST, PUT and PATCH requests should send their payloads in JSON as well.

  3. All API paths end with a trailing slash.

  4. Authentication is required for all API services, except for the ping service. To authenticate, provide your email and your API Key as HTTP Basic Auth headers. Examples for each service are provided below. You can get your API Key on the Account Settings page.

The Ping service

Before your start connection to other EBN API services, it is helpful to test your connection against our ping service. First do a GET request to test you can reach our API, then do a POST request with your API credentials included to test that you can successfully authenticate to the EBN API.

Ping service at /api/v1/ping/

GET

A service for testing connection to the Easy Blog Networks API.

Usage example:

$ curl https://app.easyblognetworks.com/api/v1/ping/
{"ping": "pong"}

Response: json

POST

Accepted content types:
  • application/json

A service for testing authentication with the Easy Blog Networks API.

Usage example:

$ curl --user EMAIL:API_KEY --data ""
    https://app.easyblognetworks.com/api/v1/ping/
{"authenticated_user": "EMAIL", "ping": "pong"}

Response: json


Services

See also:

Blog service at /api/v1/blogs/{blog_id}/

GET

values in the body
  • fields (String) - (optional) Only requested fields will be returned

A service for getting a single Blog.

WordPress auto-login url:

The “wp_auto_login” property can be used to login user as admin user to the blog. Validity of this value is short, so it must not be cached.

Usage example:

$ curl --user EMAIL:API_KEY
    https://app.easyblognetworks.com/api/v1/blogs/1/
{
    "id": 1,
    "created": "2015-07-08",
    "domain": "blog1.com",
    "network": "Default network",
    "wp_auto_login": "http://blog1.com/?auth=secret",
    "wp_admin_username": "admin",
    "wp_admin_password": "secret",
    "dns_configured": true,
    "nameservers": [
        "ns1.provider.com",
        "ns2.provider.com"
    ],
    "backup_list": [
        {
            "date": "2014-12-15T06:54:52.000Z",
            "id": 1,
            "size": 1
        },
        {
            "date": "2015-12-15T06:54:52.000Z",
            "id": 3,
            "size": 2
        },
        {
            "date": "2012-12-15T06:54:52.000Z",
            "id": 2,
            "size": 3
        }
    ],
    "last_backup": "2015-12-15T06:54:52Z",
    "backup_status": true,
    "backup_used_bytes": 6,
    "indexation": "indexed",
    "indexation_checked": "2015-07-08T18:34:06Z",
    "status": "up",
    "majestic_metrics": null,
    "last_majestic_metrics": null,
    "pages": 14,
    "posts": 5,
    "last_post": "1 year, 1 month ago",
    "comments": 13,
    "users": 7,
    "plugins": 5,
    "traffic_bytes": 62295184,
    "redirects": ["/a", "/b"],
    "not_found_pages": ["/not_found", "/also_not_found"],
    "health_score": 87,
    "server": {
        "ip": "1.2.3.4",
        "provider": {
            "title": "Big Provider"
        }
    },
    "health_score_color": warning,
    "delete_after": None
}

Validate the location against the schema defined on the service.

The content of the location is deserialized, validated and stored in the request.validated attribute.

Note

If no schema is defined, this validator does nothing.

Param request:

Current request

Type request:

Request

Param schema:

The Colander schema

Param deserializer:

Optional deserializer, defaults to cornice.validators.extract_cstruct()

Response: json

DELETE

A service for scheduling a deletion of a blog.

Usage example:

$ curl --user EMAIL:API_KEY -X DELETE
    https://app.easyblognetworks.com/api/v1/blogs/1/
HTTP/1.1 202 Accepted

Response: json

Blog service at /api/v1/blogs/

GET

values in the body
  • fields (String) - (optional) Only requested fields will be returned
  • page (Integer) - (default: 1)
  • page_size (Integer) - (default: 10)

A service for listing all user’s Blogs.

Usage example:

$ curl --user EMAIL:API_KEY
    https://app.easyblognetworks.com/api/v1/blogs/?page=1&page_size=10
{
    "page": 1,
    "pages_count": 1,
    "blogs": [
                {
                    "id": 1,
                    "domain": "blog1.com",
                    "network": {
                        "id": 2,
                        "title": "user_network",
                        "blogs_count": 3,
                        "blogs_limit": 10,
                    },
                    "state": "online",
                },
                {
                    "id": 2,
                    "domain": "blog2.com",
                    "network": {
                        "id": 3,
                        "title": "user_network2",
                        "blogs_count": 1,
                        "blogs_limit": 10,
                    },
                    "state": "problem",
                }
            ]
}

Validate the location against the schema defined on the service.

The content of the location is deserialized, validated and stored in the request.validated attribute.

Note

If no schema is defined, this validator does nothing.

Param request:

Current request

Type request:

Request

Param schema:

The Colander schema

Param deserializer:

Optional deserializer, defaults to cornice.validators.extract_cstruct()

Response: json

POST

Accepted content types:
  • application/json

A service for creating a new Blog.

This service will also schedule an immediate deployment of the newly created Blog.

Usage example:

$ curl --user EMAIL:API_KEY --data '{"blog":{
    "domain":"myblog.com","title":"My Blog","network":"1"},
     "wp": {"tagline": "My blog", "plugins": ["akismet"],
     "theme":"editor"}}' -H "Content-Type: application/json"
    https://app.easyblognetworks.com/api/v1/blogs/
{
    "id": 1,
    "domain": "myblog.com",
    "network": "Default network",
    "status": "deploying",
    "server": {
        "ip": "1.2.3.4",
        "provider": {
            "title": "Big Provider"
        }
    }
}

Available options:

  • blog (required):
    • domain (string): Domain name where the blog will be deployed (add www. when needed).
      • Example values:
        • ”example.com”

        • ”www.example.com”

    • network (string): ID of blog network. Use networks API endpoint to list all networks and get the ID.
      • Example value: “12321”

    • title (string): The WordPress “Site Title”.
      • Example value: “My blog title”

  • wp (optional):
    • slots (integer): Blog’s resources. Regular blog by default.
      • Accepted values:
        • 1: regular blog,

        • 2: double resources,

        • 3: triple resources,

    • tagline (string): WordPress Tagline used below the title.

    • theme (string): Select an active theme for your blog. Selects a random theme by default.
      • Accepted values:
        • random

        • twentynineteen

        • twentyfifteen

      See blog add form for all available themes.

    • comments (boolean): Allow comments.
      • Accepted values:
        • true

        • false

    • link_notifications (boolean): Allow pingbacks and trackbacks from other blogs.
      • Accepted values:
        • true

        • false

    • cleanup_content (boolean): Remove hello world post, comment and sample page. True by default
      • Accepted values:
        • true

        • false

    • default_content (boolean): Add blank pages with titles About and Contact.
      • Accepted values:
        • true

        • false

    • remove_footer_links (boolean): Removes links to theme author in blog footer.
      • Accepted values:
        • true

        • false

    • julian_goldie (boolean): Julian Goldie’s plugin pack.
      • Accepted values:
        • true

        • false

    • plugins (list of strings): Install popular plugins on blog deploy.
      • Example value: [“akismet”, “contact-form-7”, “classic-editor”]

      See blog add form for all available plugins.

Blog API validator.

Args:

request (pyramid.request): Pyramid request.

Returns:

cornice.validators.colander_body_validator: Colander validator.

Response: json

Blognetwork service at /api/v1/networks/{network_id}/

GET

A service for getting a single Blog Network.

Usage example:

$ curl --user EMAIL:API_KEY
    https://app.easyblognetworks.com/api/v1/networks/1/
{
    "id": 1,
    "title": "Default network",
    "blogs_count": 2,
    "blogs_limit": 10
}

Response: json

DELETE

A service for deleting a Blog Network.

Usage example:

$ curl --user EMAIL:API_KEY -X DELETE -i
    https://app.easyblognetworks.com/api/v1/networks/1/
HTTP/1.1 204 No Content

Response: json

Blognetwork service at /api/v1/networks/

GET

A service for listing all user’s Blog Networks.

Usage example:

$ curl --user EMAIL:API_KEY
    https://app.easyblognetworks.com/api/v1/networks/
[
    {
        "id": 1,
        "title": "Default Network",
        "blogs_count": 2,
        "blogs_limit": 10,
    },
    {
        "id": 2,
        "title": "Second Network",
        "blogs_count": 3,
        "blogs_limit": 10,
    }
]

Response: json

POST

Accepted content types:
  • application/json

A service for creating a new Blog Network.

Usage example:

$ curl --user EMAIL:API_KEY --data '{"title":"My Network"}'
    -H "Content-Type: application/json"
    https://app.easyblognetworks.com/api/v1/networks/
{
    "id": 1,
    "title": "My Network",
    "blogs_count": 0,
    "blogs_limit": 10
}

Blog network API validator.

Args:

request (pyramid.request): Pyramid request.

Returns:

cornice.validators.colander_body_validator: Colander validator.

Response: json

Import_Wxr service at /api/v1/import_wxr/{blog_id}/

GET

A service for getting a WXR Import Status.

Usage example:

$ curl --user EMAIL:API_KEY
    https://app.easyblognetworks.com/api/v1/import_wxr/1/
{
    "status": "Import Queued",
    "Message": "..."
}

Response: json

POST

Accepted content types:
  • application/json

A service for starting a Blog Import with WXR file.

Usage example:

$ curl --user EMAIL:API_KEY --data '{"wxr_file_url": "http://my-uploaded-wxr-file.com/path"}'
    -H "Content-Type: application/json"
    https://app.easyblognetworks.com/api/v1/import_wxr/1/
{
    "status": "Import Queued",
    "Message": "..."
}

Import WXR API validator.

Args:

wxr_file_url (url): URL pointing to the WXR file we want to import.

Response: json

DELETE

A service for deleting a WXR Blog Import

Usage example:

$ curl --user EMAIL:API_KEY -X DELETE -i
    https://app.easyblognetworks.com/api/v1/import_wxr/1/
HTTP/1.1 204 No Content

Response: json