NAV Navbar
php shell

API Reference

Welcome to BlogIn REST API.

BlogIn API is organized around endpoints, such as the Member API, or the Post API. You can use these endpoints to get or post data about the specific item.

All requests should be made over SSL. All request and response bodies, including errors, are encoded in JSON.

We also have some examples for specific language binding to make integration easier. You can switch the programming language of the examples with the tabs in the top right.

Currently, we have examples for the following languages:

To test your API requests, we recommend using a REST client called Postman. Click the button below to import a pre-made collection of request examples.

Authentication

Authentication is done via the API key which can be generated on the API tab of the Settings page of your BlogIn account (please note that you have to be an administrator to be able to access this page).

Requests are authenticated by passing the API key as a bearer token in the Authorization header.

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);
curl 'https://blogin.co/api/rest/members'
  -H 'Authorization: Bearer {key}'

Members

Member Properties

Attribute Type Description
id int Unique identifier for the resource. read-only
email string The email address for the member. mandatory
username string Member login name.
password string Member password. write-only
name string Member last name.
surname string Member last name.
avatar string Avatar URL. read-only
access_level string Member access level name
(Administrator, Writer, Commenter or Reader).
job_title string Member job title.
phone string Member phone number.
time_registered date-time Member register time. (ISO-8601 format) read-only
timezone string Member timezone.
teams array List of Member teams. See Member - Team properties

Create new member

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$member = [
    'email' => 'john.doe@example.com',
    'username' => 'johndoe',
    'name' => 'John',
    'surname' => 'Doe',
    'access_level' => 'Writer',
    'job_title' => 'Developer',
    'phone' => '0123456789',
    'teams' => [
        [
            'id' => 123
        ],
    ]
];

$response = $blogInApi->post('/members', $member);
curl --request POST 'https://blogin.co/api/rest/members' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {key}' \
--data-raw '{
    "email": "john.doe@example.com",
    "username": "johndoe",
    "name": "John",
    "surname": "Doe",
    "access_level": "Writer",
    "job_title": "Developer",
    "phone": "0123456789",
    "teams": [
        {
            "id": 123
        }
    ]
}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 456,
    "email": "john.doe@example.com",
    "username": "johndoe",
    "name": "John",
    "surname": "Doe",
    "avatar": "https://secure.gravatar.com/avatar/5658ffccee7f0ebfda2b226238b1eb6e?s=90&d=identicon",
    "access_level": "Writer",
    "job_title": "Developer",
    "phone": "0123456789",
    "time_registered": "2020-03-02T09:47:50+01:00",
    "timezone": "",
    "status": "active",
    "teams": [
        {
            "id": 123,
            "name": "Example Team",
            "position": 0
        }
    ],
}

This API allows you to create a new member.

HTTP Request

POST https://blogin.co/api/rest/members

Request body - JSON format

Parameter Description
email New member email address. mandatory
username New member email username. mandatory
name New member name.
surname New member surname.
access_level New member role/access level.
job_title New member job_title.
phone New member phone.
teams Array of Team IDs new member will be assigned to.

Get all members

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/members');
$members = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/members'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "data": [
        {
            "id": 797,
            "email": "arianna@example.com",
            "username": "ariana.clay",
            "name": "Ariana",
            "surname": "Clay",
            "avatar": "https://secure.gravatar.com/avatar/a4d5b21c4e7eeb3bd2e8a9d278772ea9?s=90&d=identicon",
            "access_level": "Reader",
            "job_title": "Engineer",
            "phone": "",
            "time_registered": "2019-12-13T12:46:48+01:00",
            "timezone": "Pacific/Midway",
            "status": "active",
            "teams": []
        },
        {
            "id": 793,
            "email": "danni.gates@gmail.com",
            "username": "danni.gates",
            "name": "Danni",
            "surname": "Gates",
            "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon",
            "access_level": "Commenter",
            "job_title": "Web Developer",
            "phone": "",
            "time_registered": "2019-12-06T16:37:08+01:00",
            "timezone": "Pacific/Midway",
            "status": "active",
            "teams": [
                {
                    "id": 2,
                    "name": "IT Department",
                    "position": 0
                }
            ]
        }
    ],
    "meta": {
        "pagination": {
            "total": 2,
            "count": 2,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 1,
            "links": {}
        }
    }
}

This endpoint retrieves all members.

HTTP Request

GET https://blogin.co/api/rest/members

Query Parameters

Parameter Default Description
page 1 The page number that the client is requesting.
limit 10 The number of resources to return per-page. Max. 100
sort @id Sorting column. Available: id, name, surname, time_registered.
Use prefixes '@' (for ascending) or '-' (for descending) to specify sort direction.
Example: GET https://blogin.co/api/rest/members?sort=@surname

Get a specific member

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/members/793');
$member = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/members/793'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 793,
    "email": "danni.gates@gmail.com",
    "username": "danni.gates",
    "name": "Danni",
    "surname": "Gates",
    "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon",
    "access_level": "Commenter",
    "job_title": "Web Developer",
    "phone": "",
    "time_registered": "2019-12-06T16:37:08+01:00",
    "timezone": "Pacific/Midway",
    "status": "active",
    "teams": [
        {
            "id": 2,
            "name": "IT Department",
            "position": 0
        }
    ]
}

This endpoint retrieves a specific member.

HTTP Request

GET https://blogin.co/api/rest/members/:id

URL Parameters

Parameter Description
:id The ID of the member to retrieve

Update a specific member

<?php

  use GuzzleHttp\Client;
  use GuzzleHttp\RequestOptions;
  
  
  $blogInApi = new Client([
      'base_uri' => 'https://blogin.co/api/rest/',
      RequestOptions::HEADERS => [
          'Accept' => 'application/json',
          'Authorization' => 'Bearer {key}',
      ],
  ]);
  
  $response = $blogInApi->post('/members/793', [
    'email' => 'danni.gates@gmail.com',
    'username' => 'danni.gates',
    'name' => 'Danni',
    'surname' => 'Gates',
    'access_level' => 'Commenter',
    'job_title' => 'Web Developer',
    'phone' => '',
    'teams' => [
        [
            'id' => 2
        ],
    ]
  ]);
  
curl --request POST 'https://blogin.co/api/rest/members/793' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer {key}' \
    --data-raw '{
        "email": "danni.gates@gmail.com",
        "username": "danni.gates",
        "name": "Danni",
        "surname": "Gates",
        "access_level": "Commenter",
        "job_title": "Web Developer",
        "phone": "",
        "teams": [
            {
                "id": 2
            }
        ]
    }'
    

Make sure to replace {key} with your API key.

Response:

{
      "id": 793,
      "email": "danni.gates@gmail.com",
      "username": "danni.gates",
      "name": "Danni",
      "surname": "Gates",
      "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon",
      "access_level": "Commenter",
      "job_title": "Web Developer",
      "phone": "",
      "time_registered": "2019-12-06T16:37:08+01:00",
      "timezone": "Pacific/Midway",
      "teams": [
          {
              "id": 2,
              "name": "IT Department",
              "position": 0
          }
      ]
  }
  

This endpoint updates a specific member.

HTTP Request

POST https://blogin.co/api/rest/members/:id

URL Parameters

Parameter Description
:id The ID of the member to update

Request body - JSON format

Parameter Description
email Member email address.
username Member username.
name Member name.
surname Member surname.
access_level Member role/access level.
job_title Member job_title.
phone Member phone.
teams Array of Team IDs member will be assigned to.

Get posts created by a specific member

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/members/33655/posts');
$posts = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/members/793/posts'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "data": [
        {
            "id": 3562,
            "title": "Welcome",
            "thumbnail_image": "",
            "intro_text": "<p>&eth;&#159;&#145;&#139; Welcome, great to have you here.</p>\n",
            "author": {
                "id": 793,
                "name": "Danni Gates",
                "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
            },
            "published": true,
            "important": false,
            "wiki": false,
            "pinned": false,
            "date_published": "2020-03-02T09:47:50+01:00",
            "comments_disabled": false,
            "comments": 0,
            "votes_up": 0,
            "votes_down": 0,
            "categories": []
        }
    ],
    "meta": {
        "pagination": {
            "total": 1,
            "count": 1,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 1,
            "links": {}
        }
    }
}

This endpoint retrieves all posts created by a specific member.

HTTP Request

GET https://blogin.co/api/rest/members/:id/posts

URL Parameters

Parameter Description
:id The ID of the member to retrieve

Query Parameters

Parameter Default Description
page 1 The page number that the client is requesting.
limit 10 The number of resources to return per-page. Max. 100
sort -date_published Sorting column. Available: id, name, date_published
Use prefixes '@' (for ascending) or '-' (for descending) to specify sort direction.
Example: GET https://blogin.co/api/rest/members/:id/posts?sort=@date_published

Deactivate a specific member

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->post('/members/deactivate', [
    'member_id' => 793
]);
curl --location --request POST 'https://blogin.co/api/rest/members/deactivate'\
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}' \
  --data-raw
  '{
    "member_id": 793
   }'

Make sure to replace {key} with your API key.

Response: Check HTTP response status code (200 OK, 4xx or 5xx for errors)

This endpoint helps you to deactivate a specific member.

HTTP Request

POST https://blogin.co/api/rest/members/deactivate

URL Parameters

Parameter Description
:id The ID of the member to deactivate

Activate a specific member

<?php

  use GuzzleHttp\Client;
  use GuzzleHttp\RequestOptions;
  
  
  $blogInApi = new Client([
      'base_uri' => 'https://blogin.co/api/rest/',
      RequestOptions::HEADERS => [
          'Accept' => 'application/json',
          'Authorization' => 'Bearer {key}',
      ],
  ]);
  
  $response = $blogInApi->post('/members/activate', [
      'member_id' => 793
  ]);
  
curl --location --request POST 'https://blogin.co/api/rest/members/activate'\
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer {key}' \
    --data-raw
    '{
      "member_id": 793
     }'
  

Make sure to replace {key} with your API key.

Response: Check HTTP response status code (200 OK, 4xx or 5xx for errors)

This endpoint helps you to activate a specific member.

HTTP Request

POST https://blogin.co/api/rest/members/activate

URL Parameters

Parameter Description
:id The ID of the member to activate

Delete a specific member

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->delete('/members/793');
curl --location --request DELETE 'https://blogin.co/api/rest/members/793'\
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response: Check HTTP response status code (200 OK, 4xx or 5xx for errors)

This endpoint helps you to delete a specific member.

HTTP Request

DELETE https://blogin.co/api/rest/members/:id

URL Parameters

Parameter Description
:id The ID of the member to delete

Member teams

Member team properties

Attribute Type Description
id int Unique identifier for the resource. read-only
name int Team name.
position float Sort position, used to custom sort the resource.

Assign a team to the member

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->post('/members/454/teams', ['id' => 32]);
$response = json_decode($response->getBody());
curl --request POST 'http://blogin.co/api/rest/members/454/teams' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {key}' \
--data-raw '{
    "id": 32
}'

Make sure to replace {key} with your API key.

Response:

{
    "data": [
        {
            "id": 4,
            "name": "Marketing",
            "position": 4
        }
    ]
}

This endpoint helps you to assign the member to a team.

HTTP Request

POST https://blogin.co/api/rest/members/:id/teams

URL Parameters

Parameter Description
:id The ID of the member.

Request body - JSON format

Parameter Description
id The ID of the Team. mandatory

Get all member teams

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/members/454/teams');
$teams = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/members/454/teams'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "data": [
        {
            "id": 4,
            "name": "Marketing",
            "position": 4
        }
    ]
}

GET https://blogin.co/api/rest/members/:id/teams

This endpoint retrieves all teams for member.

URL Parameters

Parameter Description
:id The ID of the member

Remove a member from a team

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$blogInApi->delete('/members/454/teams/32');
curl --location --request DELETE 'https://blogin.co/api/rest/members/454/teams/32' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response: Check HTTP response status code (200 OK, 4xx or 5xx for errors)

{
    "data": []
}

This endpoint lets you make reassign a member from a team.

HTTP Request

DELETE https://blogin.co/api/rest/members/:memberId/teams/:teamId

URL Parameters

Parameter Description
memberId The ID of the member
teamId The ID of the team to delete

Posts

Post Properties

Attribute Type Description
id int Unique identifier of the resource.
title string Post title mandatory
thumbnail_image string Post thumbnail image. read-only
intro_text string Post intro text. read-only
text string Post text (HTML). mandatory
author object Author of the post. See Post - Author properties
published bool Whether or not the post is published.
important bool Whether or not the post should be marked as important.
wiki bool Whether or not the post should be marked as wiki.
pinned bool Whether or not the post should be pinned.
comments_disabled bool Whether or not comments are disabled on the post.
date_published date-time Post published date (ISO-8601 format).
comments int Number of comments. read-only
votes_up int Number of votes up. read-only
votes_down int Number of votes down. read-only
categories array Array containing category names OR category IDs. See Post - Categories properties
tags array List of tags.
teams array List of notified teams. See Post - Teams properties
visibility_teams array List of teams that can see this post. Works only with the Post visibility option turned on.
approved int Set if post is approved (1), or not (0). Works only when approval of posts is required.

Post - Author properties

Attribute Type Description
id int Unique identifier for the resource.
name string Author name. read-only
avatar string Author avatar. read-only

Post - Categories properties

Attribute Type Description
id int Unique identifier for the resource.
name string Category name. read-only
position float Sort position, used to custom sort the resource. read-only

Post - Teams properties

Attribute Type Description
id int Unique identifier for the resource.
name string Team name. read-only
position float Sort position, used to custom sort the resource. read-only

Create new post

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$post = [
    'title' => 'Welcome',
    'text' => '<p>Welcome, great to have you here.</p>',
    'published' => true,
    'date_published' => '2020-03-02T09:47:50+01:00',
    'wiki' => false,
    'important' => false,
    'pinned' => false,
    'approved' => 1,
    'author' => [
        'id' => 793,
    ],
    'categories' => [
        [
            'id' => 125
        ],
        [
          'name' => 'News'
        ],
        [
          'name' => 'Updates'
        ]
    ],
    'teams' => [
        [
            'id' => -1   /* notify all teams */
        ]
    ],
    'visibility_teams' => [
        [
            'id' => 6
        ],
        [
            'id' => 9
        ]
    ],
    'tags' => [
        'Getting Started',
        'Report'
    ]
];

$response = $blogInApi->post('/posts', $post);
curl --request POST 'https://blogin.co/api/rest/posts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {key}' \
--data-raw '{
    "title": "Welcome",
    "text": "<p>👋 Welcome, great to have you here.</p>",
    "published": true,
    "date_published": "2020-03-02T09:47:51+01:00",
    "wiki": false,
    "important": false,
    "pinned": false,
    "author": {
        "id": 793
    },
    "categories": [
        {
            "id": 125
        },
        {
            "name": "News"
        },
        {
            "name": "Reports/Meetings"
        }
    ],
    "teams": [
        {
            "id": -1
        }
    ],
    "tags": ["Getting Started"],
    "approved": 1
}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 3562,
    "title": "Welcome",
    "text": "<p>&eth;&#159;&#145;&#139; Welcome, great to have you here.</p>\n",
    "author": {
        "id": 793,
        "name": "Danni Gates",
        "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
    },
    "published": true,
    "important": false,
    "wiki": false,
    "pinned": false,
    "approved": true,
    "date_published": "2020-03-02T09:47:50+01:00",
    "comments_disabled": false,
    "comments": 0,
    "votes_up": 0,
    "votes_down": 0,
    "visibility_teams": [
    {
          "id": 6,
          "name": "Testers",
          "position": 2,
          "locked": false
      },
      {
      "id": 9,
      "name": "Journalists",
      "position": 2,
      "locked": false
  }
    ],
    "categories": [
        {
            "id": 125,
            "name": "Updates",
            "position": 2
        }
    ],
    "tags": [
        {
            "id": 24,
            "name": "Getting Started",
            "slug": "getting-started"
        }
    ],
    "teams": []
}

This API allows you to create a new post.

HTTP Request

POST https://blogin.co/api/rest/posts

Request body - JSON format

Parameter Description
title The title of the post. mandatory
text The text of the post, HTML format. mandatory
published Published flag (true/false). Default: false
date_published Post published date and time (ISO-8601 format). Default: now. UTC Example: 2021-11-01T11:12:44+00:00
wiki Wiki flag (true/false). Default: false
important Important flag (true/false). Default: false
pinned Pinned flag (true/false). Default: false
comments_disabled Comments disabled flag (true/false). Default: false
author Author of the post. (Object) mandatory
categories Array of objects containing Category name OR ID. See example.
notify Should users be notified when this post is published (true/false)? Default: false
teams Array of objects containing IDs of Team(s) to notify when this post is published (use id = -1 to notify all users).
visibility_teams WORKS ONLY WITH POST VISIBILITY Array of objects containing IDs of Team(s) that can see this post (use id = -1 to make the post visible to all users).
tags Array of tags of the post.
approved Used only when approval of posts is required. Otherwise, defaults to 1 (true).

Get all posts

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/posts');
$posts = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/posts'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "data": [
        {
            "id": 3562,
            "title": "Welcome",
            "thumbnail_image": "",
            "intro_text": "<p>&eth;&#159;&#145;&#139; Welcome, great to have you here.</p>\n",
            "author": {
                "id": 793,
                "name": "Danni Gates",
                "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
            },
            "published": true,
            "important": false,
            "wiki": false,
            "pinned": false,
            "approved": true,
            "date_published": "2020-03-02T09:47:50+01:00",
            "comments_disabled": false,
            "comments": 0,
            "votes_up": 0,
            "votes_down": 0,
            "visibility_teams": [],
            "categories": []
        }
    ],
    "meta": {
        "pagination": {
            "total": 1,
            "count": 1,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 1,
            "links": {}
        }
    }
}

This endpoint retrieves all posts.

HTTP Request

GET https://blogin.co/api/rest/posts

Query Parameters

Parameter Default Description
page 1 The page number that the client is requesting (pagination).
limit 10 The number of resources to return per-page. Max. 100
sort -date_published Sorting column. Available: id, name, date_published
Use prefixes '@' (for ascending) or '-' (for descending) to specify sort direction.
Example: GET https://blogin.co/api/rest/posts?sort=@date_published
Note: Pinned posts will always be returned first when sort option 'date_published' is used.
author Author ID. Limit result set to posts from specific author.

Get a specific post

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/posts/3562');
$post = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/posts/1'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 3562,
    "title": "Welcome",
    "text": "<p>&eth;&#159;&#145;&#139; Welcome, great to have you here.</p>\n",
    "author": {
        "id": 793,
        "name": "Danni Gates",
        "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
    },
    "published": true,
    "important": false,
    "wiki": false,
    "pinned": false,
    "approved": true,
    "date_published": "2020-03-02T09:47:50+01:00",
    "comments_disabled": false,
    "comments": 0,
    "votes_up": 0,
    "votes_down": 0,
    "visibility_teams": [],
    "categories": [],
    "tags": [
        {
            "id": 24,
            "name": "Getting Started",
            "slug": "getting-started"
        }
    ],
    "teams": []
}

This endpoint retrieves a specific post.

HTTP Request

GET https://blogin.co/api/rest/posts/:id

URL Parameters

Parameter Description
:id The ID of the post to retrieve

Update a post

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$post = [
    'title' => 'Welcome again',
    'text' => '<p>👋 Welcome, great to have you here again.</p>',
    'published' => true,
    'wiki' => false,
    'important' => false,
    'pinned' => true,
    'approved' => 1,
    'author' => [
        'id' => 793,
    ],
    'categories' => [
        [
            'id' => 125
        ],
        [
          'name' => 'News'
        ],
        [
          'name' => 'Updates'
        ]
    ],
    'teams' => [
        [
            'id' => -1,      /* notify all teams */
        ]
    ],
    'visibility_teams' => [
        [
            'id' => 6
        ],
        [
            'id' => 9
        ]
    ],
    'tags' => [
        'Getting Started',
        'Report'
    ],
]);

$response = $blogInApi->post('/posts/3562', $post);
$post = json_decode($response->getBody());


curl --location --request POST 'https://blogin.co/api/rest/posts/3562' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}' \
  --data-raw '{
    "title": "Welcome again",
    "text": "<p>👋 Welcome, great to have you here again.</p>",
    "published": true,
    "wiki": false,
    "important": false,
    "pinned": true,
    "author": {
        "id": 793
    },
    "categories": [
        {
            "name": "News"
        },
        {
            "name": "Reports/Meetings"
        },
        {
            "id": 125
        }
    ],
    "teams": [
        {
            "id": -1
        }
    ],
    "tags": ["Getting Started"]
  }'

Make sure to replace {key} with your API key.

Response:

{
    "id": 3562,
    "title": "Welcome again",
    "text": "Welcome, great to have you here again.</p>\n",
    "author": {
        "id": 793,
        "name": "Danni Gates",
        "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
    },
    "published": true,
    "important": false,
    "wiki": false,
    "pinned": true,
    "approved": true,
    "date_published": "2020-03-02T09:47:50+01:00",
    "comments_disabled": false,
    "comments": 0,
    "votes_up": 0,
    "votes_down": 0,
    "visibility_teams": [
    {
          "id": 6,
          "name": "Testers",
          "position": 2,
          "locked": false
      },
      {
      "id": 9,
      "name": "Journalists",
      "position": 2,
      "locked": false
  }
    ],
    "categories": [
    {
        "id": 125,
            "name": "Updates",
            "position": 2
        }
    ],
    "tags": [
        {
            "id": 24,
            "name": "Getting Started",
            "slug": "getting-started"
        }
    ],
    "teams": []
}

This endpoint lets you make changes to a post.

HTTP Request

POST https://blogin.co/api/rest/posts/:id

URL Parameters

Parameter Description
:id The ID of the post to update

Request body - JSON format

Parameter Description
title The title of the post. mandatory
text The text of the post, HTML format. mandatory
published Published flag (true/false). Default: false
wiki Wiki flag (true/false). Default: false
important Important flag (true/false). Default: false
pinned Pinned flag (true/false). Default: false
date_published Post published date (ISO-8601 format).
author Author of the post. (Object) mandatory
categories Array of objects containing Category name OR ID. See example.
notify Should users be re-notified when this post is updated (true/false)? Default: false
teams Array of objects containing IDs of Team to notify when this post is published (use id = -1 to notify all users).
visibility_teams WORKS ONLY WITH POST VISIBILITY FEATURE Array of objects containing IDs of Team(s) that can see this post (use id = -1 to make the post visible to all users).
tags Array of tags of the post.
approved Used only when approval of posts is required. Otherwise, defaults to 1 (true).

Delete a post

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->delete('/posts/3562');
curl --location --request DELETE 'https://blogin.co/api/rest/posts/3562' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response: Check HTTP response status code (200 OK, 4xx or 5xx for errors)

This API allows you delete a post.

HTTP Request

DELETE https://blogin.co/api/rest/posts/:id

URL Parameters

Parameter Description
:id The ID of the posts to delete

Post comments

Post comment properties

Attribute Type Description
id int Unique identifier for the resource. read-only
parent int The ID for the parent of the resource.
text string Comment text
thumbnail_image string Post thumbnail image. read-only
intro_text string Post intro text. read-only
author object Author of the post. See Post Comments - Author properties
date_published date-time Comment published date (ISO-8601 format). read-only
votes_up int Number of votes up. read-only
votes_down int Number of votes down. read-only
approved int Used only when approval of comments is required. Otherwise, defaults to 1 (true).

Post comment - Author properties

Attribute Type Description
id int Unique identifier for the resource.
name string Author name. read-only
avatar string Author avatar. read-only

Add new post comment

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$comment = [
    'parent' => null,
    'text' => '<p>👋 Welcome, great to have you here.</p>',
    'author' => [
        'id' => 793,
    ],
    'approved' => 1,
];

$response = $blogInApi->post('/posts/3562/comments', $comment);
$response = json_decode($response->getBody());
curl --request POST 'http://blogin.co/api/rest/posts/3562/comments' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {key}' \
--data-raw '{
    "parent": null,
    "text": "<p>👋 Welcome, great to have you here.</p>",
    "author": {
        "id": 793
    }
}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 1487,
    "parent": 0,
    "text": "<p>👋 Welcome, great to have you here.</p>",
    "author": {
        "id": 793,
        "name": "Danni Gates",
        "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
    },
    "approved": true,
    "created_at": "2020-01-17T14:30:51+01:00",
    "votes_up": 0,
    "votes_down": 0
}

This endpoint helps you to create a new comment.

HTTP Request

POST https://blogin.co/api/rest/posts/:id/comments

URL Parameters

Parameter Description
:id The ID of the post.

Request body - JSON format

Parameter Description
parent The ID of the parent comment (if this comment is a reply).
text The text of the comment, HTML format. mandatory
author The object containing the ID of the author of the comment. mandatory
approved Used only when approval of comments is required. Otherwise, defaults to 1 (true).

Get all post comments

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/posts/3562/comments');
$comments = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/posts/3562/comments'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "data": [
        {
            "id": 1485,
            "parent": 0,
            "text": "You there?",
            "author": {
                "id": 797,
                "name": "Ariana Clay",
                "avatar": "https://secure.gravatar.com/avatar/a4d5b21c4e7eeb3bd2e8a9d278772ea9?s=90&d=identicon"
            },
            "approved": true,
            "created_at":  "2020-01-15T11:18:50+01:00",
            "votes_up": 1,
            "votes_down": 0
        },
        {
            "id": 1487,
            "parent": 0,
            "text": "<p>👋 Welcome, great to have you here.</p>",
            "author": {
                "id": 793,
                "name": "Danni Gates",
                "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
            },
            "approved": true,
            "created_at": "2020-01-17T14:30:51+01:00",
            "votes_up": 2,
            "votes_down": 0
        }
    ]
}

This endpoint retrieves all comments for post.

HTTP Request

GET https://blogin.co/api/rest/posts/:id/comments

URL Parameters

Parameter Description
:id The ID of the post to retrieve

Query Parameters

Parameter Default Description
page 1 The page number that the client is requesting (pagination).
limit 10 The number of resources to return per-page. Max. 100
sort @id Sorting column. Available: id, created_at
Use prefixes '@' (for ascending) or '-' (for descending) to specify sort direction.
Example: GET https://blogin.co/api/rest/posts/:id/comments?sort=-id

Update a post comment

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->post('/posts/3562/comments/1487', [
    'text' => '<p>👋 Welcome, great to have you here again.</p>',
    'author' => [
        'id' => 793,
    ],
    'approved' => 1,
]);
curl --location --request POST 'https://blogin.co/api/rest/posts/3562/comments/1487' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}' \
  --data-raw '{
    "text": "<p>👋 Welcome, great to have you here again.</p>",
    "author": {
        "id": 793
    }
}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 1487,
    "parent": 0,
    "text": "<p>👋 Welcome, great to have you here again.</p>",
    "author": {
        "id": 793,
        "name": "Danni Gates",
        "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
    },
    "approved": true,
    "created_at": "2020-01-17T14:30:51+01:00",
    "votes_up": 2,
    "votes_down": 0
}

This endpoint lets you make changes to a post comment.

HTTP Request

POST https://blogin.co/api/rest/posts/:postId/comments/:commentId

URL Parameters

Parameter Description
:postId The ID of the parent post
:commentId The ID of the comment to update

Request body - JSON format

Parameter Description
text The text of the comment. mandatory
author The object containing the ID of the comment author.
approved Used only when approval of comments is required. Otherwise, defaults to 1 (true).

Delete a post comment

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->delete('/posts/3562/comments/1487');
curl --location --request DELETE 'https://blogin.co/api/rest/posts/3562/comments/1487' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response: Check HTTP response status code (200 OK, 4xx or 5xx for errors)

This endpoint helps you delete a post comment.

HTTP Request

DELETE https://blogin.co/api/rest/posts/:postId/comments/:commentId

URL Parameters

Parameter Description
:postId The ID of the parent post
:commentId The ID of the comment to delete

Pages

Page properties

Attribute Type Description
id int Unique identifier for the resource. read-only
title string Page title. mandatory
text string Page text. mandatory
author object Author of the post. See Page - Author properties
position float Sort position, used to custom sort the resource.

Page comment - Author properties

Attribute Type Description
id int Unique identifier for the resource.
name string Author name. read-only
avatar string Author avatar. read-only

Create new page

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->post('/pages', [
    'title' => 'Welcome',
    'text' => '<p>👋 Welcome, great to have you here.</p>',
    'author' => [
        'id' => 793,
    ],
    'published' => true,
    'position' => 4
]);
curl --request POST 'https://blogin.co/api/rest/pages' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}' \
  --data-raw '{
    "title": "Welcome",
    "text": "<p>👋 Welcome, great to have you here.</p>",
    "author": {
        "id": 793
    },
    "published": true,
    "position": 4
  }'

Make sure to replace {key} with your API key.

Response:

{
    "id": 227,
    "title": "Welcome",
    "text": "<p><img class=\"emojione\" alt=\"👋\" src=\"emojione/assets/png/1F44B.png\" title=\":wave:\"/> Welcome, great to have you here.</p>",
    "author": {
        "id": 793,
        "name": "Danni Gates",
        "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
    },
    "position": 4
}

This endpoint helps you to create a new page.

HTTP Request

POST https://blogin.co/api/rest/pages

Request body - JSON format

Parameter Description
title The title of the page. mandatory
text The text of the page, HTML format.
author The object containing the ID of the author of the page. mandatory
published Published flag (true/false). Default: true
position Sort position, used to custom sort the resource (float).

Get all pages

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/pages');
$pages = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/pages'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "data": [
        {
            "id": 227,
            "title": "Welcome",
            "author": {
                "id": 793,
                "name": "Danni Gates",
                "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
            },
            "position": 4
        }
    ],
    "meta": {
        "pagination": {
            "total": 1,
            "count": 1,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 0,
            "links": {}
        }
    }
}

This endpoint retrieves all pages.

HTTP Request

GET https://blogin.co/api/rest/pages

Query Parameters

Parameter Default Description
page 1 The page number that the client is requesting (pagination).
limit 10 The number of resources to return per-page. Max. 100
sort @position Sorting column. Available: id, position
Use prefixes '@' (for ascending) or '-' (for descending) to specify sort direction.
Example: GET https://blogin.co/api/rest/pages?sort=-position

Get a specific page

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/pages/227');
$post = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/pages/227'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 228,
    "title": "Welcome",
    "text": "<p>👋 Welcome, great to have you here.</p>",
    "author": {
        "id": 793,
        "name": "Danni Gates",
        "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
    },
    "position": 36
}

This endpoint retrieves a specific page.

HTTP Request

GET https://blogin.co/api/rest/pages/:id

URL Parameters

Parameter Description
:id The ID of the page to retrieve

Update a page

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->post('/pages/227', [
    'title' => 'Welcome again',
    'text' => '<p>👋 Welcome, great to have you here again.</p>',
    'author' => [
        'id' => 793,
    ],
    'published' => true,
    'position' => 72
]);
curl --location --request POST 'https://blogin.co/api/rest/pages/1' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}' \
  --data-raw '{
    "title": "Welcome again",
    "text": "<p>👋 Welcome, great to have you here again.</p>",
    "author": {
        "id": 793
    },
    "published": true,
    "position": 72
  }'

Make sure to replace {key} with your API key.

Response:

{
    "id": 228,
    "title": "Welcome again",
    "text": "<p>👋 Welcome, great to have you here again.</p>",
    "author": {
        "id": 793,
        "name": "Danni Gates",
        "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
    },
    "position": 72
}

This endpoint lets you make changes to a page.

HTTP Request

POST https://blogin.co/api/rest/pages/:id

URL Parameters

Parameter Description
:id The ID of the page to update

Request body - JSON format

Parameter Description
title The title of the page. mandatory
text The text of the page, HTML format.
author The object containing the ID of the author of the page.
published Published flag (true/false).
position Sort position, used to custom sort the resource (float).

Delete a page

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->delete('/pages/227');
curl --location --request DELETE 'https://blogin.co/api/rest/pages/227' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response: Check HTTP response status code (200 OK, 4xx or 5xx for errors)

This endpoint helps you delete a page.

HTTP Request

DELETE https://blogin.co/api/rest/pages/:id

URL Parameters

Parameter Description
:id The ID of the page to delete

Categories

Category properties

Attribute Type Description
id int Unique identifier for the resource. read-only
parent int The ID for the parent of the resource.
name string Category name. mandatory
position float Sort position, used to custom sort the resource.
locked bool Flag, if the category is locked or not. Default is false

Create new category

<?php
use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->post('/categories', [
    'parent' => null,
    'name' => 'New name',
    'position' => 3,
    'locked' => false
]);
curl --location --request POST 'https://blogin.co/api/rest/categories' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}' \
  --data-raw '{
    "parent": null,
    "name": "New name",
    "position": 3,
    "locked": false
  }'

Make sure to replace {key} with your API key.

Response:

{
    "id": 128,
    "parent": 0,
    "title": "New name",
    "position": 3,
    "locked": false
}

This API endpoint allows you to create a new category.

HTTP Request

POST https://blogin.co/api/rest/categories

Request body - JSON format

Parameter Description
parent The ID of the parent category (int).
name The name of the category. mandatory
position The position of the category (float).
locked The flag if the category is locked or not (bool).

Get all categories

<?php
use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/categories');
$categories = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/categories'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "data": [
        {
            "id": 1769,
            "parent": 0,
            "title": "Economics & Management",
            "position": 1,
            "locked": false
        },
        {
            "id": 1777,
            "parent": 0,
            "title": "Announcement",
            "position": 2,
            "locked": false
        },
        {
            "id": 1778,
            "parent": 1769,
            "title": "Economics",
            "position": 1,
            "locked": false
        },
        {
            "id": 1779,
            "parent": 1769,
            "title": "Management",
            "position": 2,
            "locked": true
        }
    ],
    "meta": {
        "pagination": {
            "total": 4,
            "count": 4,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 1,
            "links": {}
        }
    }
}

This endpoint retrieves all categories.

HTTP Request

GET https://blogin.co/api/rest/categories

Query Parameters

Parameter Default Description
page 1 The page number that the client is requesting.
limit 10 The number of resources to return per-page. Max. 100
sort @position Sorting column. Available: id, position
Use prefixes '@' (for ascending) or '-' (for descending) to specify sort direction.
Example: GET https://blogin.co/api/rest/categories?sort=-position

Get a specific category

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/categories/1');
$category = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/categories/1774'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 1769,
    "parent": 0,
    "title": "Economics & Management",
    "position": 1,
    "locked": false
}

This endpoint retrieves a specific category.

HTTP Request

GET https://blogin.co/api/rest/categories/:id

URL Parameters

Parameter Description
:id The ID of the category to retrieve

Get posts from a category

<?php

  use GuzzleHttp\Client;
  use GuzzleHttp\RequestOptions;
  
  
  $blogInApi = new Client([
      'base_uri' => 'https://blogin.co/api/rest/',
      RequestOptions::HEADERS => [
          'Accept' => 'application/json',
          'Authorization' => 'Bearer {key}',
      ],
  ]);
  
  $response = $blogInApi->get('/categories/1774/posts');
  $posts = json_decode($response->getBody());
  
curl 'https://blogin.co/api/rest/categories/1774/posts'
    -H 'Authorization: Bearer {key}'
  

Make sure to replace {key} with your API key.

Response:

{
      "data": [
          {
              "id": 3562,
              "title": "Welcome",
              "thumbnail_image": "",
              "intro_text": "<p>&eth;&#159;&#145;&#139; Welcome, great to have you here.</p>\n",
              "author": {
                  "id": 793,
                  "name": "Danni Gates",
                  "avatar": "https://secure.gravatar.com/avatar/d0f3ff35d9639d780e47ccd7dbad144d?s=90&d=identicon"
              },
              "published": true,
              "important": false,
              "wiki": false,
              "pinned": false,
              "approved": true,
              "date_published": "2020-03-02T09:47:50+01:00",
              "comments_disabled": false,
              "comments": 0,
              "votes_up": 0,
              "votes_down": 0,
              "categories": []
          }
      ],
      "meta": {
          "pagination": {
              "total": 1,
              "count": 1,
              "per_page": 10,
              "current_page": 1,
              "total_pages": 1,
              "links": {}
          }
      }
  }
  

This endpoint retrieves all posts from a specific category.

HTTP Request

GET https://blogin.co/api/rest/categories/:id/posts

Query Parameters

Parameter Default Description
page 1 The page number that the client is requesting.
limit 10 The number of resources to return per-page. Max. 100

Get followers for a category

<?php

    use GuzzleHttp\Client;
    use GuzzleHttp\RequestOptions;
    
    
    $blogInApi = new Client([
        'base_uri' => 'https://blogin.co/api/rest/',
        RequestOptions::HEADERS => [
            'Accept' => 'application/json',
            'Authorization' => 'Bearer {key}',
        ],
    ]);
    
    $response = $blogInApi->get('/categories/1774/followers');
    $posts = json_decode($response->getBody());
    
curl 'https://blogin.co/api/rest/categories/1774/followers'
      -H 'Authorization: Bearer {key}'
    

Make sure to replace {key} with your API key.

Response:

{
        "data": [
            {
            "id": 797,
            "email": "arianna@example.com",
            "username": "ariana.clay",
            "name": "Ariana",
            "surname": "Clay",
            "avatar": "https://secure.gravatar.com/avatar/a4d5b21c4e7eeb3bd2e8a9d278772ea9?s=90&d=identicon",
            "access_level": "Reader",
            "job_title": "Engineer",
            "phone": "",
            "time_registered": "2019-12-13T12:46:48+01:00",
            "timezone": "Pacific/Midway",
            "teams": []
        },
        ],
        "meta": {
            "pagination": {
                "total": 1,
                "count": 1,
                "per_page": 10,
                "current_page": 1,
                "total_pages": 1,
                "links": {}
            }
        }
    }
    

This endpoint retrieves all followers from a specific category.

HTTP Request

GET https://blogin.co/api/rest/categories/:id/followers

Query Parameters

Parameter Default Description
page 1 The page number that the client is requesting.
limit 10 The number of resources to return per-page. Max. 100

Update a category

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->post('/categories/1', [
    'parent' => null,
    'name' => 'New name',
    'position' => 0,
    'locked' => 0,
]);
curl --location --request POST 'https://blogin.co/api/rest/categories/1' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}' \
  --data-raw '{
    "parent": null,
    "name": "New name",
    "position": 0,
    "locked": false
  }'

Make sure to replace {key} with your API key.

Response:

{
    "id": 1,
    "parent": 0,
    "title": "New name",
    "position": 7,
    "locked": false
}

This endpoint lets you make changes to a category.

HTTP Request

POST https://blogin.co/api/rest/categories/:id

URL Parameters

Parameter Description
:id The ID of the category to update

Request body - JSON format

Parameter Description
parent The ID of the parent category.
name The name of the category. mandatory
position The position of the category.
locked The flag which represents if the category is locked or not.

Delete a category

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->delete('/categories/1');
curl --location --request DELETE 'https://blogin.co/api/rest/categories/1' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response: Check HTTP response status code (200 OK, 4xx or 5xx for errors)

This endpoint helps you delete a category.

HTTP Request

DELETE https://blogin.co/api/rest/categories/:id

URL Parameters

Parameter Description
:id The ID of the category to delete

Tags

Tag properties

Attribute Type Description
id int Unique identifier for the resource. read-only
name string Tag name. mandatory
slug string An alphanumeric identifier for the resource unique to its type. read-only
count int The number of times this tag has been used. read-only

Get all tags

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/tags');
$tags = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/tags'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "data": [
        {
            "id": 8,
            "name": "growth report",
            "slug": "growth-report"
            "count": 8
        },
        {
            "id": 9,
            "name": "internal communication",
            "slug": "internal-communication"
            "count": 5
        }
    ],
    "meta": {
        "pagination": {
            "total": 2,
            "count": 2,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 1,
            "links": {}
        }
    }
}

This endpoint retrieves all tags.

HTTP Request

GET https://blogin.co/api/rest/tags

Query Parameters

Parameter Default Description
page 1 The page number that the client is requesting.
limit 10 The number of resources to return per-page. Max. 100
sort -count Sorting column. Available: id, name, count
Use prefixes '@' (for ascending) or '-' (for descending) to specify sort direction.
Example: GET https://blogin.co/api/rest/tags?sort=@count

Get post tags

<?php

  use GuzzleHttp\Client;
  use GuzzleHttp\RequestOptions;
  
  
  $blogInApi = new Client([
      'base_uri' => 'https://blogin.co/api/rest/',
      RequestOptions::HEADERS => [
          'Accept' => 'application/json',
          'Authorization' => 'Bearer {key}',
      ],
  ]);
  
  $response = $blogInApi->get('/posts/:id/tags');
  $tags = json_decode($response->getBody());
  
curl 'https://blogin.co/api/rest/posts/:id/tags'
    -H 'Authorization: Bearer {key}'
  

Make sure to replace {key} with your API key.

Response:

{
      "data": [
          {
              "id": 8,
              "name": "growth report",
              "slug": "growth-report"
              "count": 8
          },
          {
              "id": 9,
              "name": "internal communication",
              "slug": "internal-communication"
              "count": 5
          }
      ],
  }
  

This endpoint retrieves all tags of a specific post.

HTTP Request

GET https://blogin.co/api/rest/posts/:id/tags

Get a specific tag

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/tags/8');
$tag = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/tags/8'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 8,
    "name": "growth report",
    "slug": "growth-report"
}

This endpoint retrieves a specific tag.

HTTP Request

GET https://blogin.co/api/rest/tags/:id

URL Parameters

Parameter Description
:id The ID of the tag to retrieve

Teams

Teams properties

Attribute Type Description
id int Unique identifier for the resource. read-only
name string Team name. mandatory
position float Sort position, used to custom sort the resource.
locked bool Flag for locked, if the team is locked or not.

Create new team

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->post('/teams', [
    'name' => 'New team',
    'position' => 3,
    'locked' => false
]);
curl --location --request POST 'https://blogin.co/api/rest/teams' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}' \
  --data-raw '{
    "name": "New team",
    "position": 3,
    "locked": false
}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 1,
    "name": "New team",
    "position": 3,
    "locked": false
}

This API allows you to create a new team.

HTTP Request

POST https://blogin.co/api/rest/teams/:id

Request body - JSON format

Parameter Description
name The name of the team. mandatory
position The position of the team (float).
locked The locked team flag (bool).

Get all teams

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;

$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/teams');
$teams = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/teams'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "data": [
        {
            "id": 2,
            "name": "IT Department",
            "position": 0,
            "locked": false
        },
        {
            "id": 39,
            "name": "[A][Z] Web developer",
            "position": 0,
            "locked": false
        },
        {
            "id": 40,
            "name": "[A] Technical sales [NEW]",
            "position": 0,
            "locked": false
        },
        {
            "id": 27,
            "name": "Business analyst",
            "position": 0,
            "locked": false
        },
        {
            "id": 28,
            "name": "Software engineer",
            "position": 0,
            "locked": false
        },
        {
            "id": 31,
            "name": "Technical support",
            "position": 0,
            "locked": false
        },
        {
            "id": 33,
            "name": "Network engineer",
            "position": 0,
            "locked": false
        },
        {
            "id": 36,
            "name": "Network engineer",
            "position": 0,
            "locked": true
        },
        {
            "id": 3,
            "name": "Network engineer",
            "position": 0,
            "locked": false
        },
        {
            "id": 38,
            "name": "[A] Software tester",
            "position": 0,
            "locked": true
        }
    ],
    "meta": {
        "pagination": {
            "total": 13,
            "count": 10,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 2,
            "links": {
                "next": "http://company.blogin.co/api/v1/teams?page=2"
            }
        }
    }
}

This endpoint retrieves all pages.

HTTP Request

GET https://blogin.co/api/rest/teams

Query Parameters

Parameter Default Description
page 1 The page number that the client is requesting.
limit 10 The number of resources to return per-page. Max. 100
sort @position Sorting column. Available: id, position
Use prefixes '@' (for ascending) or '-' (for descending) to specify sort direction.
Example: GET https://blogin.co/api/rest/teams?sort=-position

Get a specific team

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/team/38');
$team = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/team/38'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 38,
    "name": "[A] Software tester",
    "position": 0,
    "approved": false
}

This endpoint retrieves a specific team.

HTTP Request

GET https://blogin.co/api/rest/teams/:id

URL Parameters

Parameter Description
:id The ID of the team to retrieve

Update a team

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->post('/teams/1', [
    'name' => 'new team name',
    'position' => 0
]);
curl --location --request POST 'https://blogin.co/api/rest/teams/1' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}' \
  --data-raw '{
    "name": "new team name",
    "position": 0
}'

Make sure to replace {key} with your API key.

Response:

{
    "id": 1,
    "name": "new team name 1",
    "position": 14,
    "locked": false
}

This endpoint lets you make changes to a team.

HTTP Request

POST https://blogin.co/api/rest/teams/:id

URL Parameters

Parameter Description
:id The ID of the team to update

Request body - JSON format

Parameter Description
name The name of the team. mandatory
position The position of the team (sort order).
locked The locked team flag.

Delete a team

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->delete('/teams/1');
curl --location --request DELETE 'https://blogin.co/api/rest/teams/1' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response: Check HTTP response status code (200 OK, 4xx or 5xx for errors)

This endpoint helps you delete a team.

HTTP Request

DELETE https://blogin.co/api/rest/teams/:id

URL Parameters

Parameter Description
:id The ID of the team to delete

Search

Search properties

Attribute Type Description
resourceType string Types of resource.
id int Unique identifier for the resource.
title string Resource title.
author object Author of the post. See Search - Author properties
date_published date-time Post published date. (ISO-8601 format)

Search - Author properties

Attribute Type Description
id int Unique identifier for the resource.
name string Author name.
avatar string Author avatar.

Search

<?php

use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;


$blogInApi = new Client([
    'base_uri' => 'https://blogin.co/api/rest/',
    RequestOptions::HEADERS => [
        'Accept' => 'application/json',
        'Authorization' => 'Bearer {key}',
    ],
]);

$response = $blogInApi->get('/search', ['terms' => 'blogin']);
$items = json_decode($response->getBody());
curl 'https://blogin.co/api/rest/search?terms=blogin'
  -H 'Authorization: Bearer {key}'

Make sure to replace {key} with your API key.

Response:

{
    "data": [
        {
            "resourceType": "post",
            "id": "787",
            "title": "test post #1",
            "author": {
                "id": 1,
                "name": "Jerry Ramos",
                "avatar": "https://secure.gravatar.com/avatar/f0e25c8dac1b38a771abba6f94bd613e?s=90&d=identicon"
            }
        },
        {
            "resourceType": "post",
            "id": "816",
            "title": "test post #2",
            "author": {
                "id": 1,
                "name": "Jerry Ramos",
                "avatar": "https://secure.gravatar.com/avatar/f0e25c8dac1b38a771abba6f94bd613e?s=90&d=identicon"
            }
        }
    ],
    "meta": {
        "pagination": {
            "total": 2,
            "count": 2,
            "per_page": 10,
            "current_page": 1,
            "total_pages": 1,
            "links": {}
        }
    }
}

This endpoint will return items for given terms.

HTTP Request

GET https://blogin.co/api/rest/search

Query Parameters

Parameter Default Description
page 1 The page number that the client is requesting.
limit 10 The number of resources to return per-page. Max. 100
comments false Search for posts in the comments text.
pages false Include pages in search.

Usage stats

This endpoint retrieves usage stats data for a specific period.

Posts stats

<?php

  use GuzzleHttp\Client;
  use GuzzleHttp\RequestOptions;

  $blogInApi = new Client([
      'base_uri' => 'https://blogin.co/api/rest/',
      RequestOptions::HEADERS => [
          'Accept' => 'application/json',
          'Authorization' => 'Bearer {key}',
      ],
  ]);
  
  $response = $blogInApi->get('/stats/posts');
  $posts = json_decode($response->getBody());
  
curl 'https://blogin.co/api/rest/stats/posts'
    -H 'Authorization: Bearer {key}'
  

Make sure to replace {key} with your API key.

Response:

{
      "posts_count": 81,
      "posts_per_week": 0.75,
      "comments_count": 25,
      "comments_per_week": 0.25,
      "engaged_users_count": 21,
      "engaged_users_percent": 86,
      "new_members_count": 33,
      "post_views_count": 3194,
      "post_votes_up_count": 15,
      "post_votes_down_count": 7,
      "posts": {
          "data": [
              {
                  "id": "787",
                  "title": "Example post",
                  "slug": "example-post",
                  "author_id": "123",
                  "author_name": "John Doe",
                  "date_published": "2020-03-02T09:47:50+01:00",
                  "post_views": "692",
                  "upVoteNum": "15",
                  "downVoteNum": "7",
                  "comments": "28",
                  "views": [
                      "John Doe",
                      "Jane Doe",
                  ]
              },
              {
                  "id": "967",
                  "title": "Welcome",
                  "slug": "welcome",
                  "author_id": "123",
                  "author_name": "John Doe",
                  "date_published": "2020-03-02T09:47:50+01:00",
                  "post_views": "986",
                  "upVoteNum": "21",
                  "downVoteNum": "3",
                  "comments": "52",
                  "views": [
                      "John Doe",
                  ]
              }
          ],
          "meta": {
              "pagination": {
                  "total": 1,
                  "count": 1,
                  "per_page": 10,
                  "current_page": 1,
                  "total_pages": 1,
                  "links": {}
              }
          }
      }
  }
  

This endpoint retrieves posts stats.

HTTP Request

GET https://blogin.co/api/rest/stats/posts

Query Parameters

Parameter Default Description
start_date 30 days ago Start date (ISO-8601 format) Example: 2020-01-30.
end_date today End date (ISO-8601 format). Example: 2020-12-31T23:59:59
page 1 The page number that the client is requesting (pagination).
limit 10 The number of resources to return per-page. Max. 100
sort -date_published Sorting column. Available: title, date_published, post_views, comments, upVoteNum, downVoteNum
Use prefixes '@' (for ascending) or '-' (for descending) to specify sort direction.
Example: GET https://blogin.co/api/rest/stats/posts?sort=@date_published
Note: Pinned posts will always be returned first when sort option 'date_published' is used.

Members stats

<?php

  use GuzzleHttp\Client;
  use GuzzleHttp\RequestOptions;

  $blogInApi = new Client([
      'base_uri' => 'https://blogin.co/api/rest/',
      RequestOptions::HEADERS => [
          'Accept' => 'application/json',
          'Authorization' => 'Bearer {key}',
      ],
  ]);
  
  $response = $blogInApi->get('/stats/members');
  $members = json_decode($response->getBody());
  
curl 'https://blogin.co/api/rest/stats/members'
    -H 'Authorization: Bearer {key}'
  

Make sure to replace {key} with your API key.

Response:

{
      "posts_count": 81,
      "posts_per_week": 0.75,
      "comments_count": 25,
      "comments_per_week": 0.25,
      "engaged_users_count": 21,
      "engaged_users_percent": 86,
      "new_members_count": 33,
      "post_views_count": 3194,
      "post_votes_up_count": 15,
      "post_votes_down_count": 7,
      "members": {
          "data": [
              {
                  "id": "123",
                  "name": "John Doe",
                  "posts": "31",
                  "comments": "971",
                  "post_views": "1256",
                  "read_posts": "100% (1250 of 1250)",
                  "logins": "1480",
              },
              {
                  "id": "456",
                  "name": "Jane Doe",
                  "posts": "1",
                  "comments": "3",
                  "post_views": "5",
                  "read_posts": "20% (250 of 1250)",
                  "logins": "368",
              }
          ],
          "meta": {
              "pagination": {
                  "total": 1,
                  "count": 1,
                  "per_page": 10,
                  "current_page": 1,
                  "total_pages": 1,
                  "links": {}
              }
          }
      }
  }
  

This endpoint retrieves members stats.

HTTP Request

GET https://blogin.co/api/rest/stats/members

Query Parameters

Parameter Default Description
start_date 30 days ago Start date (ISO-8601 format).
end_date today End date (ISO-8601 format).
page 1 The page number that the client is requesting (pagination).
limit 10 The number of resources to return per-page. Max. 100
sort -posts Sorting column. Available: name, posts, comments, post_views, read_posts, logins
Use prefixes '@' (for ascending) or '-' (for descending) to specify sort direction.
Example: GET https://blogin.co/api/rest/stats/members?sort=@name

Errors

The BlogIn API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The requested resource is hidden for administrators only.
404 Not Found -- The specified resource could not be found.
405 Method Not Allowed -- You tried to access with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The requested resource has been removed from our servers.
429 Too Many Requests -- Rate limit exceeded. Current rate limit is 10 requests per second.
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.