NAV Navbar
json

Authentication

authentication workflow

Get an access token

Example Request

curl -X POST \
  http://localhost:8080/api/login \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -d 'email=admin@coachingcloud.com&password=admin@123'

Example Response

{
    "email": "admin@coachingcloud.com",
    "access_token": "PprPFhmmdyMmgPDfZ1BgOZvgTIOfGEUjyyCPktomh4ENeYMK8UYEx1v93bPhDLvQ",
    "expires_in": 180
}

HTTP Request

POST http://localhost:8080/api/login

Header parameters

specify Content-Type: application/x-www-form-urlencoded

Request body

Parameter Data type Required? Default Description
email string Required client email
password string Required client password

Response

If successful, return an object contains access token info

Parameter Data type Description
access_token string access token issued to client
expires_in integer The number of seconds after which the token expires. Request another token when this one expires. Notice that: For convenience while developing, access token timeout might set -1 which means infinite lifetime.

Introduction

Filter search result

APC API supports a variety of filters. Filters specify criteria for the returned data set

REST API syntax: specify filters in the HTTP query string

Formular: ?filter_filterType_=_spec_&_filterType_=_spec_.... Sample: http://dev01.cc.cloud:49173/api/libraries?filter[where][id]=2

APC API supports the following kinds of filters:

The following table describes Loopback's filter types:

Filter type Type Description
fields Object, Array, or String Specify fields to include in or exclude from the response. (x)
limit Number Limit the number of instances to return. (x)
order String Specify sort order: ascending or descending.
skip (offset) Number Skip the specified number of instances. (x)
where Object Specify search criteria; similar to a WHERE clause in SQL.
include String, Object, or Array Include results from related models, for relations such asbelongsToandhasMany.

Fields filter

Sample response:

[
    {
        "createdBy": "system",
        "id": 2
    },
    {
        "createdBy": "system",
        "id": 3
    }
]

Specify fields to include in or exclude from the response.

REST API

filter[fields][propertyName]=<true|false>&filter[fields][propertyName]=<true|false>...

http://dev01.cc.cloud:49173/api/libraries?filter[fields][id]=true&filter[fields][createdBy]=true

Limit filter

Sample response:

[
    {
        "name": "placeat officiis sint non id ipsum et",
        "createdBy": "system",
        "owner": "20",
        "id": 2,
        "createdAt": "2018-07-04T03:46:24.000Z",
        "updatedAt": "2018-07-04T03:46:24.000Z"
    },
    {
        "name": "et temporibus aut nulla tempora quod nisi",
        "createdBy": "system",
        "owner": "9",
        "id": 3,
        "createdAt": "2018-07-04T03:46:24.000Z",
        "updatedAt": "2018-07-04T03:46:24.000Z"
    }
]

Limits the number of records returned to the specified number (or less).

REST API

filter[limit]=n

http://dev01.cc.cloud:49173/api/libraries?filter[limit]=2

Skip filter

Sample response: Return the third page has 2 items

[
    {
        "name": "repudiandae praesentium mollitia quaerat expedita sed asperiores",
        "createdBy": "system",
        "owner": "19",
        "id": 4,
        "createdAt": "2018-07-04T03:46:24.000Z",
        "updatedAt": "2018-07-04T03:46:24.000Z"
    },
    {
        "name": "facere quaerat fuga repellat natus cumque nihil",
        "createdBy": "user",
        "owner": "2",
        "id": 5,
        "createdAt": "2018-07-04T03:46:24.000Z",
        "updatedAt": "2018-07-04T03:46:24.000Z"
    }
]

Omits the specified number of returned records. This is useful, for example, to paginate responses.

REST API

?filter[skip]=n

http://dev01.cc.cloud:49173/api/libraries?filter[limit]=2&filter[skip]=4

Where filter

Sample response: Return the items has id field greater than 20

[
    {
        "name": "nostrum quam iure ea temporibus in ut",
        "createdBy": "user",
        "owner": "11",
        "id": 21,
        "createdAt": "2018-07-04T03:46:24.000Z",
        "updatedAt": "2018-07-04T03:46:24.000Z"
    },
    {
        "name": "qui non illum quia est nesciunt rerum",
        "createdBy": "system",
        "owner": "2",
        "id": 22,
        "createdAt": "2018-07-04T03:46:24.000Z",
        "updatedAt": "2018-07-04T03:46:24.000Z"
    }
]

Specifies a set of logical conditions to match, similar to a WHERE clause in a SQL query.

REST API

filter[where][property]=value or filter[where][property][op]=value with op is comparison operator. See operators availabes in the table Operators below.

http://dev01.cc.cloud:49173/api/libraries?filter[where][createdBy]=system returns items has createdBy equals 'system'

http://dev01.cc.cloud:49173/api/libraries?filter[where][id][gt]=20 returns items has id greater than 20

OPERATORS

This table describes the operators available in “where” filters.

Operator Description
= Equivalence.
and Logical AND operator.
or Logical OR operator.
gt, gte Numerical greater than (>); greater than or equal (>=). Valid only for numerical and date values.
lt, lte Numerical less than (<); less than or equal (<=). Valid only for numerical and date values.
between True if the value is between the two specified values: greater than or equal to first value and
inq, nin In / not in an array of values.
neq Not equal (!=)
like, nlike LIKE / NOT LIKE operators for use with regular expressions. The regular expression format depends
regexp Regular expression. See examples below.

API Reference

User

List user libraries

Get list of libraries of current user

Example Request

curl -X GET \
  'http://localhost:8080/api/users/me/libraries?access_token=1Q0P2HEc6fULYT3a7DmviI5jJt1Rtv2k9ApEqZ0Imzvj4hjHKu6E6cBN1ojRcZMM'

Example Response

HTTP Request

GET http://localhost:8080/api/users/me/libraries?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.

Response

If successful, return list of libraries of current user

List user workbooks

Get list of workbooks owned by the current user

Example Request

curl -X GET \
  'http://localhost:8080/api/users/me/workbooks?access_token=1Q0P2HEc6fULYT3a7DmviI5jJt1Rtv2k9ApEqZ0Imzvj4hjHKu6E6cBN1ojRcZMM'

Example Response

HTTP Request

GET http://localhost:8080/api/users/me/workbooks?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.

Response

If successful, return list of workbooks owned by the current user

List user notes

Return a list notes belong to a specific user.

Example Request

curl -X GET \
  'http://localhost:8080/api/users/1/notes?access_token=Dz3EuG3lAHG4yina2jPhdknjFfxfebeow6g88ekzrLpCrMGaNG9e3HjMBrgWGBKf'

Example Response

{
    "links": {
        "self": "http:/localhost:8080/api/users/1/notes?access_token=Dz3EuG3lAHG4yina2jPhdknjFfxfebeow6g88ekzrLpCrMGaNG9e3HjMBrgWGBKf"
    },
    "meta": {
        "count": 3,
        "total-pages": 1,
        "limit": null,
        "skip": 0
    },
    "data": [
        {
            "id": 1,
            "type": "user_note",
            "attributes": {
                "content": "user note 1",
                "userId": 1,
                "noteableId": 1,
                "noteableType": "page"
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "http:/localhost:8080/api/user_notes/1?filter[include][user]",
                        "related": "http:/localhost:8080/api/user_notes/1/user"
                    }
                },
                "noteable": {
                    "links": {
                        "self": "http:/localhost:8080/api/user_notes/1?filter[include][noteable]",
                        "related": "http:/localhost:8080/api/user_notes/1/noteable"
                    }
                }
            }
        },        
        {
            "id": 3,
            "type": "user_note",
            "attributes": {
                "content": "note 3 - workbook",
                "userId": 1,
                "noteableId": 1,
                "noteableType": "workbook"
            },
            "relationships": {
                "user": {
                    "links": {
                        "self": "http:/localhost:8080/api/user_notes/3?filter[include][user]",
                        "related": "http:/localhost:8080/api/user_notes/3/user"
                    }
                },
                "noteable": {
                    "links": {
                        "self": "http:/localhost:8080/api/user_notes/3?filter[include][noteable]",
                        "related": "http:/localhost:8080/api/user_notes/3/noteable"
                    }
                }
            }
        }
    ],
    "schema": {
        "content": {
            "type": "string",
            "required": true
        },
        "id": {
            "id": 1,
            "generated": true,
            "updateOnly": true
        },
        "userId": {},
        "noteableId": {},
        "noteableType": {
            "type": "string",
            "index": true
        }
    }
}

HTTP Request

GET http://localhost:8080/api/clients/{client_id}/notes

Header parameters

Request params

Parameter Data type Required? Default Description
access_token string required the access_token. To get an access token, you can make an access token API call, read here
filter[include]=noteable string optional To get response data that contains source place info where the note was noted on - it may be a page/a workbook or somewhere like that. You can use this info for navigating to source place on purpose.

Response

If successful, return an object contains data property is an array of notes belong to a specific user.

Parameter Data type Description
type string In case you input filter[include]=noteable in request query string, in data response, the type property of each element in included array indicate type of source place, it can be a page/workbook...

Share workbook

The attendee share workbooks with their hosts.

share workbook workflow

Library

List workbooks of a library

Return list of workbooks of a library.

Example Request

curl -X GET 'http://localhost:8080/api/libraries/1/workbooks'

Example Response

HTTP Request

GET http://localhost:8080/api/libraries/{library_id}/workbooks

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
library_id number Required The ID of the library will retrieve list of workbooks belongs to.

Response

If successful, return an object contains list of workbooks belongs to this specified library.

Workbook

List workbooks

Return a list of workbooks

Example Request

curl -X GET \
  'http://localhost:8080/api/workbooks?access_token=HAEnFp0XcppOw1tJmN2cateKqn2blRwlkjoN0xm3qDuOjeAuKHB95k8JiutJ6fDy'

Example Response

HTTP Request

GET http://localhost:8080/api/workbooks?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
[filter][include]=user string Optional including user owner in each of workbook returns

Response

If successful, return an object contains data property is an array of workbooks.

Get tree list workbook => chapters => pages

Return tree list workbook => chapters => pages

Example Request

curl -X GET \
  'http://localhost:8080/api/workbooks/{workbook_id}?access_token={access_token}&filter={"include": {"chapters": "pages"}}'

Example Response

{
    "id": 3,
    "type": "workbook",
    "attributes":
    {
        "title": "Entrepreneurship Fundamentals: Business Startup Strategies",
        "description": "Amet ipsam voluptas repudiandae est et eius. Minima quod neque. Quasi ut delectus voluptas culpa perspiciatis. Excepturi quo error voluptatum deserunt mollitia cum.",
        "price": 75,
        "image_url": "http://localhost:8080/upload/jenny-hill-205881-unsplash.jpg",
        "is_active": true
    },
    "included": [
    {
        "id": 2,
        "type": "chapters",
        "attributes":
        {
            "title": "Team Formation and Organization",
            "createdAt": "2019-02-19T03:03:05.000Z",
            "updatedAt": "2019-02-19T03:03:05.000Z",
            "is_active": true,
            "pages": [
            {
                "title": "Lean Culture Principles & Practices",
                "id": 15,
                "createdAt": "2019-02-19T03:03:07.000Z",
                "updatedAt": "2019-02-19T03:03:07.000Z",
                "is_active": true
            },
            {
                "title": "Why Lean Culture and Leadership",
                "id": 24,
                "createdAt": "2019-02-19T03:03:07.000Z",
                "updatedAt": "2019-02-19T03:03:07.000Z",
                "is_active": true
            }]
        }
    }]
}

HTTP Request

GET http://localhost:8080/api/workbooks/{workbook_id}?access_token={access_token}&filter={"include": {"chapters": "pages"}}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
workbook_id number Required The ID of the workbook will retrieve list of chapters belongs to.
filter string Optional {"include": {"chapters": "pages"}} Include chapters/pages of the workbook as tree list in response value.

Response

If successful, return an object contains tree list workbook => chapters => pages.

Add a chapter into a workbook

Add a chapter into a workbook

Example Request

curl -X POST \
  'http://localhost:8080/api/workbooks/1/chapters?access_token=a628MYIXe9A697xFAcGEg9C9wfWE8Cg0XYzrF8JSrtUwVGhcHQ1peO82MrAPUziH' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'title=workbook_title&insert_after_item_id=39'

Example Response

HTTP Request

POST http://localhost:8080/api/workbooks/{workbook_id}/chapters?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
workbook_id number Required The ID of the workbook which the new chapter add into

Request body

Parameter Data type Required? Default Description
title string optional chapter title
insert_after_item_id number optional If value is 0, the new chapter will move to the top position in the workbook. If value is null or unspecified, the new chapter will move to the last position in the workbook. Otherwise, if value is specified, the new chapter will move to right below the insert_after_item_id chapter.

Response

If successful, return a new chapter object

Move position of a chapter within a workbook

Move position of a chapter within a workbook

Example Request

curl -X PATCH \
  'http://localhost:8080/api/workbooks/9/chapters/15/move/29?access_token=sqlrd4F3Q9Xi5vXmS0dtRvFobcVaRTNGug2AGHauhlSo3hTbvHTbCtHFPDs7ZMqV'

Example Response

HTTP Response Status code: 200

HTTP Request

PATCH http://localhost:8080/api/workbooks/{workbook_id}/chapters/{from_chapter_id}/move/{to_chapter_id}?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
workbook_id number Required workbook identifier contains chapter will move position
from_chapter_id number Required chapter identifier that moves from (called as from_chapter)
to_chapter_id number Optional chapter identifier that moves to (called as to_chapter). If value is 0, the from_chapter will move to the top position in workbook. If value is null or unspecified, the from_chapter will move to the last position in workbook. Otherwise, if value is specified to_chapter identifier, the from_chapter will move to right below to_chapter and also move series of chapters down the list starting from the chapters was currently below to_chapter.

Response

If successful, return http response status code 200.

Upload image for an workbook

Upload image for an workbook

Example Request

curl -X POST \
  'http://localhost:8080/api/util/upload?access_token=sqlrd4F3Q9Xi5vXmS0dtRvFobcVaRTNGug2AGHauhlSo3hTbvHTbCtHFPDs7ZMqV&file_type=workbook_image&workbook_id=3' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F image=@/Users/Documents/CoachingCloud/server/api/upload/rawpixel-574844-unsplash.jpg

Example Response

HTTP Response Status code: 200

HTTP Request

POST http://localhost:8080/api/util/upload?access_token={access_token}&file_type={file_type}&workbook_id={workbook_id}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
file_type string Required fixed value is workbook_image for uploading image file of an workbook
workbook_id number Required workbook identifier will store uploaded image file

Response

If successful, return http response status code 200.

upload api capture postman

List of workbook themes

Return a list of workbook themes, including style attributes within each theme.

Example Request

curl -X GET \
  'http://localhost:8080/api/workbooks/1/themes?access_token=a628MYIXe9A697xFAcGEg9C9wfWE8Cg0XYzrF8JSrtUwVGhcHQ1peO82MrAPUziH&filter[include]=attributes'

Example Response

HTTP Request

GET http://dev01.cc.cloud:49173/api/workbooks/{workbook_id}/themes?access_token={access_token}&filter[include]=attributes

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
workbook_id number Required The ID of the workbook that will receive a list of themes associated with
filter[include]=attributes string Optional enable including style attributes within each theme

Response

If successful, return an object contains data property is an array of themes of a specified workbook.

Chapter

List pages of a chapter

Return list pages of a chapter.

Example Request

curl -X GET \
  'http://localhost:8080/api/chapters/1/pages?access_token=1YgNIc7EFtjnjuf087mHMVwUmxOTQkaHSAaoIWsnjtlDP2tId4cHCZDmYZY54OtM'

Example Response

HTTP Request

GET http://localhost:8080/api/chapters/{chapter_id}/pages?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
chapter_id number Required The ID of the chapter will retrieve list of pages belongs to.

Response

If successful, return an object contains list of pages belongs to this specified chapter.

Add a page into a chapter

Add a page into a chapter

Example Request

curl -X POST \
  'http://localhost:8080/api/chapters/1/pages?access_token=a628MYIXe9A697xFAcGEg9C9wfWE8Cg0XYzrF8JSrtUwVGhcHQ1peO82MrAPUziH' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'title=page_title&insert_after_item_id=39'

Example Response

HTTP Request

POST http://localhost:8080/api/chapters/{chapter_id}/pages?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
chapter_id number Required The ID of the chapter which the new page add into

Request body

Parameter Data type Required? Default Description
title string optional page title
insert_after_item_id number optional If value is 0, the new page will move to the top position in the chapter. If value is null or unspecified, the new page will move to the last position in the chapter. Otherwise, if value is specified, the new page will move to right below the insert_after_item_id page.

Response

If successful, return a new page object

Move position of a page within a chapter

Move position of a page within a chapter

Example Request

curl -X PATCH \
  'http://localhost:8080/api/chapters/9/pages/15/move/29?access_token=sqlrd4F3Q9Xi5vXmS0dtRvFobcVaRTNGug2AGHauhlSo3hTbvHTbCtHFPDs7ZMqV'

Example Response

HTTP Response Status code: 200

HTTP Request

PATCH http://localhost:8080/api/chapters/{chapter_id}/pages/{from_page_id}/move/{to_page_id}?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
chapter_id number Required chapter identifier contains page will move position
from_page_id number Required page identifier that moves from (called as from_page)
to_page_id number Optional page identifier that moves to (called as to_page). If value is 0, the from_page will move to the top position in chapter. If value is null or unspecified, the from_page will move to the last position in chapter. Otherwise, if value is specified to_page identifier, the from_page will move to right below to_page and also move series of pages down the list starting from the pages was currently below to_page.

Response

If successful, return http response status code 200.

Page

List items of a page

Return list of items of a page.

Example Request

curl -X GET \
  'http://localhost:8080/api/pages/1/items?access_token=1YgNIc7EFtjnjuf087mHMVwUmxOTQkaHSAaoIWsnjtlDP2tId4cHCZDmYZY54OtM'

Example Response

HTTP Request

GET http://localhost:8080/api/pages/{page_id}/items?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
page_id number Required The ID of the page will retrieve list of items belongs to.

Response

If successful, return an object contains list of items belongs to this specified page.

Move position of an item in a page

Move position of an item in a page

Example Request

curl -X PATCH \
  'http://localhost:8080/api/pages/9/items/15/move/29?access_token=sqlrd4F3Q9Xi5vXmS0dtRvFobcVaRTNGug2AGHauhlSo3hTbvHTbCtHFPDs7ZMqV'

Example Response

HTTP Response Status code: 200

HTTP Request

PATCH http://localhost:8080/api/pages/{page_id}/items/{from_item_id}/move/{to_item_id}?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
page_id number Required page identifier contains item will move position
from_item_id number Required item identifier that moves from (called as from_item)
to_item_id number Optional item identifier that moves to (called as to_item). If value is 0, the from_item will move to the top position in page. If value is null or unspecified, the from_item will move to the last position in page. Otherwise, if value is specified to_item identifier, the from_item will move to right below to_item and also move series of items down the list starting from the items was currently below to_item.

Response

If successful, return http response status code 200.

Create item at specific position in page

Create and add item at specific position in page relying on insert_after_item_id parameter in request body.

Sample Request

curl -X POST \
  'http://localhost:8080/api/pages/1/items?access_token=sqlrd4F3Q9Xi5vXmS0dtRvFobcVaRTNGug2AGHauhlSo3hTbvHTbCtHFPDs7ZMqV' \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "item_text",
  "item_attributes": [
    {
      "id": 1,
       "value": "item_title"
    },
    {
     "id": 2,
      "value": "item_description"
    }
  ],
  "item_typeId": 1,
  "insert_after_item_id": 9
}'

Sample Response

{
    "id": 20,
    "type": "item",
    "attributes": {
        "title": "item_text",
        "item_attributes": [
            {
                "id": 1,
                "value": "item_title"
            },
            {
                "id": 2,
                "value": "item_description"
            }
        ],
        "is_active": true,
        "is_public": true,
        "item_typeId": 1,
        "insert_after_item_id": 9
    }
}

HTTP Request

POST http://localhost:8080/api/pages/{page_id}/items?access_token={access_token}

Header parameters

specify Content-Type: application/json

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
page_id number Required The page identifier will contain created item.

Request body

Parameter Data type Required? Default Description
title string optional item title
item_typeId number required item type ID
item_attributes array required array of attribute objects. Each item_attributes object has id property as attribute id and value property is either an array type or primitive type contain value(s) of this attribute. Note that: the value property will be validated depend on the data type of item_attribute.
insert_after_item_id number optional if value is 0, it will insert at the top position of the page; if value is specified item id, it will insert below that specified item; otherwise, if value is unspecified, it will insert at the last position of the page
is_public boolean optional true if true, it would be publicly published after creating

Response

If successful, return an object contains created item ID along with attributes, relationship, e.g

Duplicate an item in a page

Duplicate an item in a page and place it at specific position relying on insert_after_item_id parameter in request body.

Example Request

curl -X PATCH \
  'http://localhost:8080/api/pages/1/items/15/move/29?access_token=sqlrd4F3Q9Xi5vXmS0dtRvFobcVaRTNGug2AGHauhlSo3hTbvHTbCtHFPDs7ZMqV'

Example Response

HTTP Response Status code: 200

HTTP Request

POST http://localhost:8080/api/pages/{page_id}/items?access_token={access_token}

Header parameters

specify Content-Type: application/json

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
page_id number Required The page identifier will contain created item.

Request body

Parameter Data type Required? Default Description
duplicate_from_item_id number Required source item identifier will be copied from
insert_after_item_id number optional if value is 0, it will insert at the top position of the page; if value is specified item id, it will insert below that specified item; otherwise, if value is unspecified, it will insert at the last position of the page
is_public boolean optional true if true, it would be publicly published after creating

Response

If successful, return an object contains created item ID along with attributes, relationship, e.g

Item type

List item types

Return a list of item types.

Example Request

curl -X GET --header 'Accept: application/json' 'http://localhost:8080/api/item_types'

Example Response

{
  "links": {
    "self": "http:/localhost:8080/api/item_types?filter[skip]=0&filter[limit]=1",
    "next": "http://localhost:8080/api/item_types?filter[skip]=1&filter[limit]=1"
  },
  "meta": {
    "count": 8,
    "total-pages": 8,
    "limit": 1,
    "skip": 0
  },
  "data": [
    {
      "id": 1,
      "type": "item_type",
      "attributes": {
        "code": "audio",
        "label": "question",
        "is_active": true
      },
      "relationships": {
        "attributes": {
          "links": {
            "self": "http:/localhost:8080/api/item_types/1?filter[include][attributes]",
            "related": "http:/localhost:8080/api/item_types/1/attributes"
          }
        }
      }
    }
  ],
  "schema": {
    "code": {
      "type": "string",
      "required": true
    },
    "label": {
      "type": "string"
    },
    "is_active": {
      "type": "boolean",
      "default": 1
    },
    "id": {
      "id": 1,
      "generated": true,
      "updateOnly": true
    }
  }
}

HTTP Request

GET http://localhost:8080/api/item_types

Request body

Response

If successful, return an object contains data property is an array of item types.

Comment

Data flow diagram of comment feature

List comments

Response

If successful, returns a object containts all information of a comment..

Parameter Data type Description
id string The comment ID
comment_owner integer The user ID that made this comment
message string The comment text
message_tags array An array of user ID tagged in message
parent integer For comment replies, this is the comment ID that a reply to
reply_count integer Number of replies to this comment
vote_up_count integer Number of times this comment was voted up
vote_down_count integer Number of times this comment was voted down
status string state of the comment

Util

Upload file(s)

Upload file(s).

Notice that: In order to upload an image that associates with specific object like an item/a workbook/etc., please read API guidelines in corresponding object section.

Example Request

curl -X POST \
  'http://localhost:8080/api/util/upload?access_token=sqlrd4F3Q9Xi5vXmS0dtRvFobcVaRTNGug2AGHauhlSo3hTbvHTbCtHFPDs7ZMqV' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F image=@/Users/Documents/CoachingCloud/server/api/upload/rawpixel-574844-unsplash.jpg

Example Response

{
    "data": [
        {
            "file_url": "http://dev01.cc.cloud:49173/upload/api/2019/05/06/rawpixel-670711-unsplash_s01_api_20190506_0a716d.jpg",
            "file_size_medium_url": "http://dev01.cc.cloud:49173/upload/api/2019/05/06/rawpixel-670711-unsplash_s01_api_20190506_0a716d_900_600.jpg",
            "file_size_low_url": "http://dev01.cc.cloud:49173/upload/api/2019/05/06/rawpixel-670711-unsplash_s01_api_20190506_0a716d_562_375.jpg"
        }
    ]
}

HTTP Request

POST http://localhost:8080/api/util/upload?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.

Response

If successful, return http response status code 200.

Parameter Data type Description
data array An array of objects, each object contains file_url property is the url of an uploaded file. In addition, if uploaded file is image type, it will contains resized images with different resolutions for desktop device and mobile device in file_size_medium_url field and file_size_low_url field correspondingly.

upload api capture postman

Update tree position levels

Update tree position levels that allow starting at any level in the tree - means support to update a part of tree level of workbook - chapter(s) - page(s) - item(s).

Example Request

curl -X PATCH \
  'http://localhost:8080/api/util/move_position?access_token={access_token}' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d tree_view={tree_position_levels}
This is a sample of entire tree_view object json, however you can update a part of tree if needed:

{
    "id": 10,
    "type": "workbook", 
    "elements": [ 
        {
            "id": 5,
            "type": "chapter",            
            "display": 1,
            "elements": [
                {
                    "id": 19,
                    "type": "page",
                    "display": 1,
                    "elements": [
                        {
                            "id": 10,
                            "type": "item",            
                            "display": 1
                        }
                    ]
                },
                {
                    "id": 13,
                    "type": "page",
                    "display": 2
                }                  
            ]
        },
        {
            "id": 4,
            "type": "chapter",            
            "display": 2,
            "elements": [
                {
                    "id": 33,
                    "type": "page",
                    "display": 1
                }

            ]
        }
    ]    
}

Example Response

{
    "message": "OK"
}

HTTP Request

PATCH http://localhost:8080/api/util/move_position?access_token={access_token}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.

Request body

Parameter Data type Required? Default Description
tree_view json Required tree position levels that allow starting at any level in the tree - means support to update a part of tree level of workbook - chapter(s) - page(s) - item(s). See example tree_view json object in Example Request section above. #

Response

If successful, return a response status code is 200.

Search text

Search text

Example Request

curl -X GET \
  'http://localhost:8080/api/util/search?access_token=a628MYIXe9A697xFAcGEg9C9wfWE8Cg0XYzrF8JSrtUwVGhcHQ1peO82MrAPUziH&query=proj&scope=workbook&collection=description' \

HTTP Request

GET http://localhost:8080/api/util/search?access_token={access_token}&query={query}&scope={scope}&collection={collection}

Request params

Parameter Data type Required? Default Description
access_token string Required access token. In order to get access token, make an API call /api/login.
query string Required Search query. Should be URL-encoded
scope string Required Scope query. Must be in one the following values: workbook, competency
collection string Optional For workbook scope, by default, it will search in a mix of title and description Name of collection to search. For workbook scope, it should be in one the following values: title, description, title,description

Response

If successful, return http response status code 200.

Parameter Data type Description
data array An array of found results.

Errors

The APC 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 kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
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.