NAV Navigation
HTTP

CommandersAct API v2

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

This is the CommandersAct API Documentation.
This API uses JSONAPI specification to fetch, create and modify the resources, and to format responses.

Authentification

GET https://api.commander1.com/v2/{siteId}/users HTTP/1.1
Host: api.commander1.com
Authorization: Bearer {mySecretToken}

You should replace "{mySecretToken}" in the example above by your Token.

The API uses Token to authenticate its user. You MUST send the token for each request in the Authorization header. The token MUST be preceeded by Bearer.

Base URLs:

Users

List users

Code samples

GET https://api.commander1.com/v2/{siteId}/users HTTP/1.1
Host: api.commander1.com
Accept: application/vnd.api+json

GET /users

List users for a site

Parameters

Name In Type Required Description
include query array[string] false Include available
page query object false Set number and size to define the range of Users to retrieve.
Default values set to 1 for number and 10 for size.

Enumerated Values

Parameter Value
include permissions
include roles

Example responses

200 Response

{
  "data": [
    {
      "type": "string",
      "id": 0,
      "attributes": {
        "first_name": "string",
        "last_name": "string",
        "email": "user@example.com",
        "company": "string",
        "position": "string",
        "last_visit": "string",
        "role_name": "string"
      },
      "relationships": {
        "permissions": {
          "data": [
            {
              "id": "string",
              "type": "string"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "string",
              "type": "string"
            }
          ]
        }
      }
    }
  ],
  "included": [
    {
      "type": "string",
      "id": 0,
      "attributes": {}
    }
  ],
  "meta": {
    "pagination": {
      "total": 210,
      "count": 50,
      "per_page": 50,
      "current_page": 1,
      "total_pages": 5
    }
  },
  "links": {
    "self": "https://api.commander1.com/v2/ams/users?page=1",
    "first": "https://api.commander1.com/v2/ams/users?page=1",
    "next": "https://api.commander1.com/v2/ams/users?page=2",
    "last": "https://api.commander1.com/v2/ams/users?page=5"
  }
}

401 Authorization header is missing

{
  "errors": [
    {
      "title": "MISSING_AUTHORIZATION_HEADER",
      "detail": "The \"Authorization\" header is required"
    }
  ]
}

401 Token type is missing

{
  "errors": [
    {
      "code": "UNKNOWN_TOKEN_TYPE",
      "detail": "The token type is missing"
    }
  ]
}

401 The token type is invalid

{
  "errors": [
    {
      "code": "INVALID_TOKEN_TYPE",
      "detail": "The token type \"Bear\" is invalid. Expecting \"Bearer\" instead"
    }
  ]
}

401 The provided token is unknown

{
  "errors": [
    {
      "code": "UNKNOWN_TOKEN",
      "detail": "The provided token is unknown. Please contact our support team support@commandersact.com"
    }
  ]
}

403 Response

{
  "errors": [
    {
      "code": "SITE_ACCESS_FORBIDDEN",
      "detail": "You cannot access this site"
    }
  ]
}

500 Response

{
  "errors": [
    {
      "code": "SERVER_ERROR",
      "detail": "An internal error occurred. Please contact our support team support@commandersact.com"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK list of users Users
401 Unauthorized Cannot identify the API caller None
403 Forbidden API caller does not have access to this resource None
500 Internal Server Error Internal server error None

Response Schema

Get user

Code samples

GET https://api.commander1.com/v2/{siteId}/users/{id} HTTP/1.1
Host: api.commander1.com
Accept: application/vnd.api+json

GET /users/{id}

Fetches the details of a user.

Parameters

Name In Type Required Description
id path integer true The user ID
include query array[string] false Include available

Enumerated Values

Parameter Value
include permissions
include roles

Example responses

200 Response

"{\n    \"data\": {\n        \"type\": \"user\",\n        \"id\": \"1\",\n        \"attributes\": {\n            \"first_name\": \"John\",\n            \"last_name\": \"Snow\",\n            \"email\": \"john.snow@tagcommander.com\",\n            \"company\": \"Night's Watch\",\n            \"position\": \"Lord Commander\",\n            \"last_visit\": \"2018-04-25T12:31:36+02:00\",\n            \"role_name\": \"administrator\"\n        },\n        \"relationships\": {\n            \"permissions\": {\n                \"data\": [\n                    {\n                        \"type\": \"permission\",\n                        \"id\": \"2003901\"\n                    }\n                ]\n            }\n        }\n    },\n    \"included\": [\n        {\n            \"type\": \"permission\",\n            \"id\": \"2003901\",\n            \"attributes\": {\n                \"name\": \"Manage Channel Identification\",\n                \"parent\": 20039\n            }\n        }\n    ]\n}"

401 Authorization header is missing

{
  "errors": [
    {
      "title": "MISSING_AUTHORIZATION_HEADER",
      "detail": "The \"Authorization\" header is required"
    }
  ]
}

401 Token type is missing

{
  "errors": [
    {
      "code": "UNKNOWN_TOKEN_TYPE",
      "detail": "The token type is missing"
    }
  ]
}

401 The token type is invalid

{
  "errors": [
    {
      "code": "INVALID_TOKEN_TYPE",
      "detail": "The token type \"Bear\" is invalid. Expecting \"Bearer\" instead"
    }
  ]
}

401 The provided token is unknown

{
  "errors": [
    {
      "code": "UNKNOWN_TOKEN",
      "detail": "The provided token is unknown. Please contact our support team support@commandersact.com"
    }
  ]
}

403 Response

{
  "errors": [
    {
      "code": "SITE_ACCESS_FORBIDDEN",
      "detail": "You cannot access this site"
    }
  ]
}

500 Response

{
  "errors": [
    {
      "code": "SERVER_ERROR",
      "detail": "An internal error occurred. Please contact our support team support@commandersact.com"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK search results matching criteria User
401 Unauthorized Cannot identify the API caller None
403 Forbidden API caller does not have access to this resource None
500 Internal Server Error Internal server error None

Response Schema

Schemas

JsonApiRelationshipBase

{
  "data": [
    {
      "id": "string",
      "type": "string"
    }
  ]
}

Properties

Name Type Required Restrictions Description
data [object] false none none
» id string false none none
» type string false none none

JsonApiBase

{
  "data": {
    "type": "string",
    "id": 0,
    "attributes": {},
    "relationships": {}
  },
  "included": [
    {
      "type": "string",
      "id": 0,
      "attributes": {}
    }
  ]
}

Properties

Name Type Required Restrictions Description
data object false none none
» type string false none none
» id integer false none none
» attributes object false none none
» relationships object false none none
included [object] false none none
» type string false none none
» id integer false none none
» attributes object false none none

JsonApiListBase

{
  "data": [
    {
      "type": "string",
      "id": 0,
      "attributes": {},
      "relationships": {}
    }
  ],
  "included": [
    {
      "type": "string",
      "id": 0,
      "attributes": {}
    }
  ],
  "meta": {
    "pagination": {
      "total": 210,
      "count": 50,
      "per_page": 50,
      "current_page": 1,
      "total_pages": 5
    }
  },
  "links": {
    "self": "https://api.commander1.com/v2/ams/users?page=1",
    "first": "https://api.commander1.com/v2/ams/users?page=1",
    "next": "https://api.commander1.com/v2/ams/users?page=2",
    "last": "https://api.commander1.com/v2/ams/users?page=5"
  }
}

Properties

Name Type Required Restrictions Description
data [any] false none none
» type string false none none
» id integer false none none
» attributes object false none none
» relationships object false none none
included [object] false none none
» type string false none none
» id integer false none none
» attributes object false none none
meta object false none none
» pagination object false none none
»» total integer false none none
»» count integer false none none
»» per_page integer false none none
»» current_page integer false none none
»» total_pages integer false none none
» links object false none none
»» self string false none none
»» first string false none none
»» next string false none none
»» last string false none none

User

"{\n    \"data\": {\n        \"type\": \"user\",\n        \"id\": \"1\",\n        \"attributes\": {\n            \"first_name\": \"John\",\n            \"last_name\": \"Snow\",\n            \"email\": \"john.snow@tagcommander.com\",\n            \"company\": \"Night's Watch\",\n            \"position\": \"Lord Commander\",\n            \"last_visit\": \"2018-04-25T12:31:36+02:00\",\n            \"role_name\": \"administrator\"\n        },\n        \"relationships\": {\n            \"permissions\": {\n                \"data\": [\n                    {\n                        \"type\": \"permission\",\n                        \"id\": \"2003901\"\n                    }\n                ]\n            }\n        }\n    },\n    \"included\": [\n        {\n            \"type\": \"permission\",\n            \"id\": \"2003901\",\n            \"attributes\": {\n                \"name\": \"Manage Channel Identification\",\n                \"parent\": 20039\n            }\n        }\n    ]\n}"

Properties

Name Type Required Restrictions Description
data object false none none
» type string false none none
» id integer false none none
» attributes object false none none
»» first_name string false none none
»» last_name string false none none
»» email string(email) false none none
»» company string false none none
»» position string false none none
»» last_visit string false none none
»» role_name string false none none
» relationships object false none none
»» permissions object false none none
»»» data [object] false none none
»»»» id string false none none
»»»» type string false none none
»»» roles object false none none
»»»» data [object] false none none
»»»»» id string false none none
»»»»» type string false none none
»»»» included [object] false none none
»»»»» type string false none none
»»»»» id integer false none none
»»»»» attributes object false none none

Users

{
  "data": [
    {
      "type": "string",
      "id": 0,
      "attributes": {
        "first_name": "string",
        "last_name": "string",
        "email": "user@example.com",
        "company": "string",
        "position": "string",
        "last_visit": "string",
        "role_name": "string"
      },
      "relationships": {
        "permissions": {
          "data": [
            {
              "id": "string",
              "type": "string"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "string",
              "type": "string"
            }
          ]
        }
      }
    }
  ],
  "included": [
    {
      "type": "string",
      "id": 0,
      "attributes": {}
    }
  ],
  "meta": {
    "pagination": {
      "total": 210,
      "count": 50,
      "per_page": 50,
      "current_page": 1,
      "total_pages": 5
    }
  },
  "links": {
    "self": "https://api.commander1.com/v2/ams/users?page=1",
    "first": "https://api.commander1.com/v2/ams/users?page=1",
    "next": "https://api.commander1.com/v2/ams/users?page=2",
    "last": "https://api.commander1.com/v2/ams/users?page=5"
  }
}

Properties

Name Type Required Restrictions Description
data [any] false none none
» type string false none none
» id integer false none none
» attributes object false none none
»» first_name string false none none
»» last_name string false none none
»» email string(email) false none none
»» company string false none none
»» position string false none none
»» last_visit string false none none
»» role_name string false none none
» relationships object false none none
»» permissions object false none none
»»» data [object] false none none
»»»» id string false none none
»»»» type string false none none
»»» roles object false none none
»»»» data [object] false none none
»»»»» id string false none none
»»»»» type string false none none
»»»» included [object] false none none
»»»»» type string false none none
»»»»» id integer false none none
»»»»» attributes object false none none
»»»» meta object false none none
»»»»» pagination object false none none
»»»»»» total integer false none none
»»»»»» count integer false none none
»»»»»» per_page integer false none none
»»»»»» current_page integer false none none
»»»»»» total_pages integer false none none
»»»»» links object false none none
»»»»»» self string false none none
»»»»»» first string false none none
»»»»»» next string false none none
»»»»»» last string false none none