Back to top

Embever IoT Core API

This API lets you interact with your devices on Embever IoT Core.

Authenticating

The API uses JWT tokens to authorize requests to ressources. Your application can obtain an access token by posting an application token to the /authenticate endpoint (for creatinng application tokens refer to Tokens). The access token is used for the requests to the API, but has a short validity period. When it expires, the application token must be used again to gain a new auth token. The access token is passed in the request’s Authorization header.

authentication sequence

Authenticate

Obtain access token
POST/authenticate/

Example URI

POST https://api.embever.com/v2/authenticate/
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "application_token": "eyJ0eXAiOiJKv2QiLCJhbGciOiJIUzUxMi..."
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "application_token": {
      "type": "string"
    }
  },
  "required": [
    "application_token"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "access": "eyJ0eXAiOiJKv2QiLCJhbGciOiJIUdUxMi...",
  "refresh": "eyJ0eXAiOiJKv2QiLCJhbGciOiJIUzUxMi..."
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "access": {
      "type": "string"
    },
    "refresh": {
      "type": "string"
    }
  }
}

Webhooks

Embever IoT Core offers a webhook mechanism to inform other services about Events and changes in Action statuses.

Event Webhooks

Event Webhooks are triggered when an Event object is created. Event Webhooks are defined per device and live in the device.webhooks attribute. They have the structure:

{
  "type": "event_type",
  "url": "https://mybackend.com/position/",
  "payload_only": false
}

The type indicates what Event type triggers the webhook. If an Event with type="foo" is received from a device, the system will look look up all webhooks type="foo" and process this hooks accordingly. The system will issue a POST request to the specified url. The body of that request contains the created Event instance (JSON encoded). The "payload_only" is a boolean attribute, is optional and defults to false. If "payload_only" is set to true, the body of POST contains only the value of "payload" attribute. Setting "payload_only" attribute may come handy when working with telemetry data.

Action Webhooks

Action Webhooks are triggered when the status of an Action instance changes. Action Webhooks are defined per action and live in the action.webhooks attribute. They have the structure:

[
  {
    "url": "https://mybackend.com/status-update/",
    "status": "action_sent"
  },
  {
    "url": "https://mybackend.com/response/",
    "status": "response_received",
    "payload_only": true
  },
  ......
]

The "status" indicates which status type triggers the webhook. If an Action reaches the action_sent status, the system will look look up all webhooks withstatus="action_sent" and process this hooks accordingly. The system will issue a POST request to the specified url. The body of that request contains the updated Action instance (JSON encoded). The "payload_only" is a boolean attribute, is optional and defults to false. If "payload_only" is set to true, the body of POST contains only the value of "result" attribute of an Action.

Currently only the webhooks for the stati action_sent action_delivered response_received, file_transfer_started, file_transfer_complete and file_transfer_failed are triggered.

Headers of the request

To authenticate the request, the system will add the following headers to the request

  • X-Org-Token

  • X-App-Token if the corresponding device is attached to an application

X-Org-Tokenand X-App-Token are JWTs that are signed with the organisation.secret and application.secret respectively. The payload of the tokens have the following attributes:

  • organisation_id or application_id

  • iat - datetime at which the token was created

  • exp - datetime at which the token expires. This is determined by the max_token_lifespan_in_seconds attribute.

Service Levels

Embever IoT core supports three different Serivice Levels which determine the quality of service of the delivery of action to the device.

Service Level 0

When actions are created with service_level=0, Embever Cloud makes sure the actions are sent to the device but these actions are not guranteed to be delivered or to be processed by the device.

Service Level 0

Service Level 1

When actions are created with service_level=1, Embever Cloud makes sure the actions are sent to the device and guranteed to be received by the device. These actions are not guranteed to be processed by the device. Embever Cloud will lock these actions until the device sends the acknowledgement of receiving the action. If not acknowledged by the device, Embever Cloud will resend the action. The sending of the action can be can be cancelled by setting the property cancelled to True.

Service Level 1

Service Level 2

Actions created with service_level=2 are guranteed to be processed by the device. Embever Cloud makes sure that these actions are sent to the device, received and processed. Embever cloud will lock these actions unitil it receives the acknowledgement that the actions has been processed.

Service Level 2

API Root

Entrypoint

Endpoints of the API

This resource does not have any attributes. Instead it offers the initial API affordances in the form of the links in the JSON body.

It is recommend to follow the “url” link values, Link or Location headers where applicable to retrieve resources. Instead of constructing your own URLs, to keep your client decoupled from implementation details.

Retrieve the Entry Point
GET/

Example URI

GET https://api.embever.com/v2/
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "devices": "https://api.embever.com/v2/devices/",
  "actions": "https://api.embever.com/v2/actions/",
  "events": "https://api.embever.com/v2/events/",
  "applications": "https://api.embever.com/v2/applications/",
  "firmwares": "https://api.embever.com/v2/firmwares/",
  "deployments": "https://api.embever.com/v2/deployments/",
  "updates": "https://api.embever.com/v2/updates/",
  "organisations": "https://api.embever.com/v2/organisations/",
  "tokens": "https://api.embever.com/v2/tokens/",
  "authenticate": "https://api.embever.com/v2/authenticate/"
}

Pagination

Request that return multiple items will be paginated to 100 items by default. The api offers a way to easily navigate through the items using the ?limit and ?offset parameters. The ?limit parameter limits the number of results and the ?offset parameter skips the number of items before beginning to return the items. By default the the value of ?limit and ?offset is 100 and 0 respectively.

curl 'https://api.embever.com/v2/actions/?limit=100&offset=300'

The link header provides the information on pagination.

Link:
 <https://api.embever.com/v2/actions/?limit=100>; rel="first",
 <https://api.embever.com/v2/actions/?limit=100&offset=400>; rel="next",
 <https://api.embever.com/v2/actions/?limit=100&offset=200>; rel="previous",
 <https://api.embever.com/v2/actions/?limit=100&offset=578>; rel="last"

This Link response header contains one or more Hypermedia link relations. The possible rel values are:

Name Descirption
first The link relation for the first page of result items.
next The link relation for the immediate next page of result items.
prev The link relation for the immediate immediate page of result items.
last The link relation for the last page of result items.

Devices

This section describes available API services for managing Devices.

Description of Devices

A Device instance is representation of a single physical IoT device. Each physical device that you want to connect to Embever IoT Core needs its own Device instance.

Attribute Type Description Example
url String URI of the ressource.
id String The unique identifier of the object. "a1b2c3"
name String The name of your device. Unique within your organisation. Required. "device#1"
application String ID of an Application instance "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92"
activated Boolean indicating whether the device is activated at the Mobile Network Operator false
type String Type of the device. Either "cellular", "other" "other"
connectivity Object Object containing additional information about cellular devices, like IMSI etc
webhooks Array Object containing webhooks that are triggered if a event of a specified type is received [{"type": "temp","url": "https://myotherbackend.com/temp/"}]
created_at String Datetime at which the Application was created. (ISO 8601 timestamp format) "2018-02-26T16:02:13.978899Z"

Example Device object:

{
  "url": "https://api.embever.com/v2/devices/a1b2c3",
  "id": "a1b2c3",
  "name": "yourdevicename",
  "activated": false,
  "application": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
  "type": "other",
  "connectivity": {},
  "webhooks": [
    {
      "type": "position",
      "url": "https://mybackend.com/position/"
    },
    {
      "type": "temp",
      "url": "https://mybackend.com/temp/"
    },
    {
      "type": "temp",
      "url": "https://myotherbackend.com/temp/"
    }
  ],
  "created_at": "2018-02-26T16:02:13.978899Z"
}

(Un-)Linking an Application

A Device can be linked to an Application in order to allow the Application to create Actions for this device. This is done by setting the "application" attribute to the ID of the Application instance. To release a Device from an Application, set the attribute to null.

SIM-based Devices

If you want to connect SIM-based device, please contact us. SIM-based devices usually connect through a VPN to Embever IoT Core. SIM based devices have to be created by Embever.

Connecting Arbitrary Devices

You can also create devices by yourself. Upon creating a device instance, you receive a password that is needed to authenticate the device against our public Gateway.

Store that password in a safe place, since you will not be able to retrieve it a second time!

Webhooks

The webhooks that are attached to a device are triggered when an Event with a matching type is received from the device. You can determine multiple hooks for the same type of event. After a webhook gets triggered, the created event object is send to the specified url using a POST request.

Device Collection

List all devices
GET/devices/{?type,activated,application,name}

Returns a list of the devices in your organisation

Example URI

GET https://api.embever.com/v2/devices/?type=cellular&activated=true&application=98hasdib&name=somedevicename
URI Parameters
HideShow
type
string (optional) Example: cellular

The device type (currently either cellular or other )

activated
boolean (optional) Example: true

Filter for activated or supsended devices (only for cellular)

application
string (optional) Example: 98hasdib

ID of the Application to which the device is registered

name
string (optional) Example: somedevicename

Filter by the name attribute of the device

Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "url": "https://api.embever.com/v2/devices/a1b2c3",
    "id": "a1b2c3",
    "name": "yourdevicename",
    "activated": false,
    "application": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
    "type": "other",
    "connectivity": {},
    "webhooks": [
      {
        "type": "position",
        "url": "https://mybackend.com/position/"
      },
      {
        "type": "temp",
        "url": "https://mybackend.com/temp/"
      }
    ],
    "created_at": "2018-02-26T16:02:13.978899Z"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Create Device
POST/devices/

Create a new Device instance

Example URI

POST https://api.embever.com/v2/devices/
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "application": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
  "name": "somedevicename",
  "activated": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "application": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "activated": {
      "type": "boolean"
    }
  },
  "required": [
    "name"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/devices/a1b2c3",
  "id": "a1b2c3",
  "name": "yourdevicename",
  "activated": false,
  "application": "98hasdib",
  "type": "other",
  "connectivity": {},
  "webhooks": [
    {
      "type": "position",
      "url": "https://mybackend.com/position/"
    },
    {
      "type": "temp",
      "url": "https://mybackend.com/temp/"
    }
  ],
  "created_at": "2018-02-26T16:02:13.978899Z",
  "password": "somerandompassword"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "activated": {
      "type": "boolean"
    },
    "application": {
      "type": "string"
    },
    "type": {
      "type": "string"
    },
    "connectivity": {
      "type": "object"
    },
    "webhooks": {
      "type": "array"
    },
    "created_at": {
      "type": "string"
    },
    "password": {
      "type": "string"
    }
  },
  "required": [
    "password"
  ]
}

Device

Device Detail
GET/devices/{id}/

Example URI

GET https://api.embever.com/v2/devices/a1b2c3/
URI Parameters
HideShow
id
string (required) Example: a1b2c3

ID of the device

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/devices/a1b2c3",
  "id": "a1b2c3",
  "name": "yourdevicename",
  "activated": false,
  "application": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
  "type": "other",
  "connectivity": {},
  "webhooks": [
    {
      "type": "position",
      "url": "https://mybackend.com/position/"
    },
    {
      "type": "temp",
      "url": "https://mybackend.com/temp/"
    }
  ],
  "created_at": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "activated": {
      "type": "boolean"
    },
    "application": {
      "type": "string"
    },
    "type": {
      "type": "string"
    },
    "connectivity": {
      "type": "object"
    },
    "webhooks": {
      "type": "array"
    },
    "created_at": {
      "type": "string"
    }
  }
}

Update Device
PATCH/devices/{id}/

Example URI

PATCH https://api.embever.com/v2/devices/a1b2c3/
URI Parameters
HideShow
id
string (required) Example: a1b2c3

ID of the device

Request
HideShow
Headers
Content-Type: application/json
Body
{
  "application": "98hasdib",
  "name": "newname",
  "activated": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "application": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "activated": {
      "type": "boolean"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/devices/a1b2c3",
  "id": "a1b2c3",
  "name": "newname",
  "activated": false,
  "application": "98hasdib",
  "type": "other",
  "connectivity": {},
  "webhooks": [
    {
      "type": "position",
      "url": "https://mybackend.com/position/"
    },
    {
      "type": "temp",
      "url": "https://mybackend.com/temp/"
    }
  ],
  "created_at": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "activated": {
      "type": "boolean"
    },
    "application": {
      "type": "string"
    },
    "type": {
      "type": "string"
    },
    "connectivity": {
      "type": "object"
    },
    "webhooks": {
      "type": "array"
    },
    "created_at": {
      "type": "string"
    }
  }
}

Delete Device
DELETE/devices/{id}/

Example URI

DELETE https://api.embever.com/v2/devices/a1b2c3/
URI Parameters
HideShow
id
string (required) Example: a1b2c3

ID of the device

Response  204
HideShow
Headers
Content-Type: application/json

Applications

This section available API operations to manage Applications.

Description of Applications

An Application represents a group of devices. Each device can be (but doesn’t have to be) assigned to an Application. Each Application can manage Actions for Device instances that are assigned to this particular Action. You can create Application Token to authorize an Application against the API (Read the Tokens section and Authenticating section for more info). This way you can restrict access for an Application or customer group to a specific set of devices.

Attribute Type Description Example
url String URI of the ressource.
id String The unique identifier of the object. "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92"
alias String An alias for this application. Required. "someapp"
description String An additional description of the Application "Customer XYZ - For testing only"
created_at String Datetime at which the Application was created. (ISO 8601 timestamp format) "2018-02-26T16:02:13.978899Z"

Example Application instance:

{
  "url": "https://api.embever.com/v2/devices/dbeb7f9-2d34-4411-9e34-9c7ae361cb92/",
  "id": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
  "alias": "testapp",
  "description": "Some description",
  "created_at": "2018-02-26T16:02:13.978899Z"
}

Assigning Devices to Applications

Please refer to the Devices section.

Application Collection

List all Applications
GET/applications/

Example URI

GET https://api.embever.com/v2/applications/
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "url": "https://api.embever.com/v2/devices/dbeb7f9-2d34-4411-9e34-9c7ae361cb92/",
    "id": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
    "alias": "testapp",
    "description": "Some description",
    "created_at": "2018-02-26T16:02:13.978899Z"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Create Application
POST/applications/

Example URI

POST https://api.embever.com/v2/applications/
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "alias": "App1",
  "description": "some description",
  "secret": "top-secret"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "alias": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "secret": {
      "type": "string"
    }
  },
  "required": [
    "alias",
    "secret"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/devices/dbeb7f9-2d34-4411-9e34-9c7ae361cb92/",
  "id": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
  "alias": "testapp",
  "description": "Some description",
  "created_at": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "alias": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "created_at": {
      "type": "string"
    }
  }
}

Application

Application Detail
GET/applications/{id}/

Example URI

GET https://api.embever.com/v2/applications/6dbeb7f9-2d34-4411-9e34-9c7ae361cb92/
URI Parameters
HideShow
id
string (required) Example: 6dbeb7f9-2d34-4411-9e34-9c7ae361cb92

The unique identifier of the object. Read only

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/devices/dbeb7f9-2d34-4411-9e34-9c7ae361cb92/",
  "id": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
  "alias": "testapp",
  "description": "Some description",
  "created_at": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "alias": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "created_at": {
      "type": "string"
    }
  }
}

Update Application
PATCH/applications/{id}/

Example URI

PATCH https://api.embever.com/v2/applications/6dbeb7f9-2d34-4411-9e34-9c7ae361cb92/
URI Parameters
HideShow
id
string (required) Example: 6dbeb7f9-2d34-4411-9e34-9c7ae361cb92

The unique identifier of the object. Read only

Request
HideShow
Headers
Content-Type: application/json
Body
{
  "alias": "App1",
  "description": "some description",
  "secret": "top-secret"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "alias": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "secret": {
      "type": "string"
    }
  },
  "required": [
    "alias",
    "secret"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/devices/dbeb7f9-2d34-4411-9e34-9c7ae361cb92/",
  "id": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
  "alias": "testapp",
  "description": "Some description",
  "created_at": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "alias": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "created_at": {
      "type": "string"
    }
  }
}

Delete Application
DELETE/applications/{id}/

Example URI

DELETE https://api.embever.com/v2/applications/6dbeb7f9-2d34-4411-9e34-9c7ae361cb92/
URI Parameters
HideShow
id
string (required) Example: 6dbeb7f9-2d34-4411-9e34-9c7ae361cb92

The unique identifier of the object. Read only

Response  204
HideShow
Headers
Content-Type: application/json

Actions

This section describes available API services for managing Action resources.

Description of Actions

Actions are atomic operations or instructions that are sent to the device upon wake up. Each Action object is of a specific type and might have additional information (payload) that shall be sent to the device, e.g. some settings or other information that is needed to process the action.

Attribute Type Description Example
url String URI of the ressource.
id Integer The unique identifier of the object. 62542
device object Reference to the device by id or name. {"id":"8112635472"} or {"name": "device_xyz"}
type String The type of the action that the device shall perform. Required "setSettings"
payload Object A payload that should be sent to the device along with the Action. See restrictions below {"someData":54}
webhooks Array An array containing webhook objects. See below [{"status":"action_sent", "url":"http://123.de"}]
status Object An object containing information about the current and historic status of the action. See below
service_level Integer An identifier for service levels. Only values 0, 1 and 2 are allowed. Default: 0 1
cancelled Boolean Indicating wheather the sending of the action should be cancelled or not. Default: false true
finished Boolean A boolean indicating whether the action is finished. See below true
result Object An object that is set by the response of the device. {"lon":52.116, "lat":11.6245}
created_at String Datetime at which the Action was created. (ISO 8601 timestamp format) "2018-02-26T16:02:13.978899Z"
result_code String Indicates wheather the response of the device as given by "result" attribute is a result message (indicated by "Success" value) or error message (indicated by "Failure" value). Can take one of three values "Success", "Failure" or null. null value indicates there is no response has been received from the device for the given action. "Success"
expiry_date String Datetime at which the Action expires then after the Action is not sent to the device. (ISO 8601 timestamp format) "2020-01-14T12:46:13.978899Z"
expired Boolean Indicates wheather the Action has expired or not. "false"

Example Action object:

{
  "url": "https://api.embever.com/v2/actions/62542",
  "id": 62542,
  "device": {
    "id":"8112635472",
    "name": "XY2009"
  },
  "type": "setSettings",
  "payload": {
    "someSetting": 54
  },
  "webhooks": [
    {
      "status": "action_sent",
      "url": "https://mybackend.com/action_sent/"
    },
    {
      "status": "action_overridden",
      "url": "https://mybackend.com/action_overridden/"
    },
    {
      "status": "response_received",
      "url": "https://mybackend.com/response/"
    }
  ],
  "status": {
    "action_sent": "2018-02-27T18:02:13.978899Z"
  },
  "service_level": 0,
  "cancelled": false,
  "finished": true,
  "result": {
    "success":{
      "someSetting":54
    }
  },
  "created_at": "2018-02-26T16:02:13.978899Z",
  "result_code": "Success",
  "expiry_date": "2018-03-26T17:02:13Z",
  "expired": false
}

Buffering Actions

Actions can be created at any time. However, they cannot be sent to sleeping devices. Therefore, Embever IoT Core keeps a set of Action objects in a buffer. Actions in the Buffer will be sent to the device upon its next wakeup. All of this magic happens automatically. You don’t have to do anything special here. However, it is important to note, that at maximum one Action of a particular type is kept in the buffer.

If you create an Action with a type that already exist in the buffer, that existing Action instance will be overridden. That is, the previously buffered Action will be replaced by the new Action. The result attribute of the replaced Action will be set to {"overridden_by" : <action_id>} and the finished attribute will be set to true.

Action types

The type attribute of an Action can principally be choosen by the user. It is the responsibility of the developer to implement the corresponding action handlers in the device’s firmware. The value of the type attribute must not start with "_", since these action types are private (can only be set by Embever IoT Core).

The value of the type attribute must not begin with _, e.g. "type":"_fota"

Embever IoT Core has some predefined action types, of which some some are private, i.e. can not be created by the user.

Public occupied types

type Description
"getFile" Used to send a file to the device. Must contain a "file" attribute. The value of the file attribute must be a bas64 encoded file. Optionally a "kwargs" object can be sepcified that is sent to the device.

This list might not be complete yet. Additional types might be occupied by Embever IoT Core in the future.

Example getFile Action request object:

{
    "device": {
      "id": "SB8rywL"
    },
    "type": "getFile",
    "payload": {
      "file": "data:image/epd;base64,aGVsbG93b3JsZA=="
    }
}

Example corresponding getFile Action response object:

{
    "url": "https://api.embever.com/v2/actions/28/",
    "id": 28,
    "device": {
        "id": "SB8rywL",
        "name": "dev_emb"
    },
    "type": "getFile",
    "payload": {
        "file": "rULZsHiM"
    },
    "webhooks": null,
    "status": null,
    "service_level": 0,
    "cancelled": false,
    "finished": false,
    "result": null,
    "created_at": "2020-01-15T12:38:39.277934Z",
    "result_code": null,
    "expiry_date": null,
    "expired": false
}

The value of "file" attribute on getFile Action request should be a string and follow the format "data:<filetype>/<format>;base64,<base64encoded_string>". In the reposnse object the "file" attribute contains the saved file’s id.

Private types

type Description
"_fota" Used for firmware updates over the air. Is automatically created when the user creates a deployment Object

Action status

The status of an Action changes over its lifecycle. The status attribute of an Action is an object that can contain the following attributes

Status Description
action_overridden Time at which the Action was overriden by a new Action.
action_sent Time at which the Action was sent to the device.
action_delivered Time at which the Action was delivered to the device.
response_received Time at which a response was received.

Actions of type:getFile and type:_fota can have additional statuses

Status Description
file_transfer_started Time at which a file transfer started
file_transfer_complete Time at which a file transfer completed
file_transfer_failed Time at which the file transfer was terminated unsuccessfully

The value of each attribute of a status object is a string indicating the time that status was reached. Example

{
  "action_sent": "2018-02-26T18:02:03.978399Z",
  "action_delivered": "2018-02-26T18:05:03.978399Z",
  "response_received": "2018-02-26T18:07:03.128399Z",
}

Responses

If a response message is received from the device, its corresponding action will be updated. That is, a

  1. Its attribute finished will be set to true
  2. The payload of the response message will be added to the result attribute of the Action
  3. The corresponding response_received webhook will be executed

The finished attribute

Whether an Action instance is considered finished depends on status of the delivery of the action. If the achieved service level is equal to or higher than the service level indicated in service_level attribute, the action is considered to be finished. Service Level 0 is the lowest and Service Level 2 is the highest. For example, if the action with service_level=0 reaches the service level 0 or 1 or 2, the action is considered to be finished.

  1. If the action is overridden

The finished attribute is set to true as soon as the action status action_overridden is reached.

  1. If cancelled=true

    The finished attribute is set to true as soon as the cancelled attribute is set to true.

  2. If the achieved service_level is equal to or higher than the action’s service_level attribute.

    For service_level=0, finished attribute is set to true as soon as the action status action_sent or action_delivered or response_received is reached.

    For service_level=1, finished attribute is set to true as soon as the action status action_delivered or response_received is reached.

    For service_level=2, finished attribute is set to true as soon as the action status response_received is reached.

Webhooks

The webhooks that are attached to an action are triggered when the status of an Action is updated. The status attribute of the webhook specifies which statuses trigger the webhook. You can determine multiple hooks for the same status of the action. After a webhook gets triggered, the created updated status object is send to the specified url using a POST request.

Webhooks for all the action status are not implemented yet. Please refer to Action Webhooks for more info.

The cancelled Attribute

This field is primarily used to stop the action from sending to the device. Infact, this is the only field you can update in an Action. Suppose you create an Action (with id 001)of type “getTemp” with service level 2. The action is sent but the response is not received. For some reasons, if the action is not finished (response is not received) then it is sent again and again until the response is received. This action (with id 001) is a blocking action. No action of same type “getTemp” can be sent unless this action is finished. So if you want to send a new action (id 002) of the same type “getTemp”, you won’t be able to send it. To avoid this problem, one can update the "cancelled" attribute of Action (001) to true. This will allow the next action (002) to be sent to the device.

Expiry of Actions

An action can be set to expire by setting the "expiry_date" attribute. After the set timestamp is reached, the action cannot be send to the device and the "expired" attribute is set to true. If the action is sent before the "expiry_date" the "expired" attribute is set to false.

Result Code of Actions

Applies to devices using Embever IoT Protocol version 2.1 or higher.

When a response message is received from the device, the result code of the corresponding action is set to either Success or Failure, indicating whether the Action could be executed without errors in the IoT device.

Action Collection

List all actions
GET/actions/{?type,device}

Return a list of Action instances

Example URI

GET https://api.embever.com/v2/actions/?type=getSettings&device=
URI Parameters
HideShow
type
string (optional) Example: getSettings

The type of the action

device
string (optional) 

The ID of the device for which the action was created

Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "url": "https://api.embever.com/v2/actions/62542",
    "id": 62542,
    "device": {
      "id": "a1b2c3",
      "name": "yourdevicename"
    },
    "type": "setSettings",
    "payload": {
      "someData": 54
    },
    "webhooks": [
      {
        "status": "action_sent",
        "url": "https://mybackend.com/action_sent/"
      },
      {
        "status": "action_overridden",
        "url": "https://mybackend.com/action_overridden/"
      },
      {
        "status": "response_received",
        "url": "https://mybackend.com/response/"
      },
      {
        "status": "action_delivered",
        "url": "https://mybackend.com/action_delivered/"
      }
    ],
    "status": {
      "action_sent": "2018-02-27T16:02:13.978899Z",
      "action_overridden": "2018-02-27T16:02:15.978899Z",
      "response_received": "2018-02-27T16:02:15.978899Z"
    },
    "service_level": 0,
    "cancelled": false,
    "finished": true,
    "result": {},
    "created_at": "2018-02-26T16:02:13.978899Z",
    "result_code": "Success",
    "expiry_date": "2019-03-27T16:02:13Z",
    "expired": "false"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Create an Action
POST/actions/

Create a new Action instance

Example URI

POST https://api.embever.com/v2/actions/
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "device": {
    "id": "a1b2c3",
    "name": "yourdevicename"
  },
  "type": "setSettings",
  "payload": {
    "someData": 54
  },
  "webhooks": [
    {
      "status": "action_sent",
      "url": "https://mybackend.com/action_sent/"
    },
    {
      "status": "action_overridden",
      "url": "https://mybackend.com/action_overridden/"
    },
    {
      "status": "response_received",
      "url": "https://mybackend.com/response/"
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "device": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "type": {
      "type": "string"
    },
    "payload": {
      "type": "object",
      "properties": {
        "someData": {
          "type": "number"
        }
      }
    },
    "webhooks": {
      "type": "array"
    },
    "service_level": {
      "type": "number"
    },
    "cancelled": {
      "type": "boolean"
    }
  },
  "required": [
    "device",
    "type"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/actions/62542",
  "id": 62542,
  "device": {
    "id": "a1b2c3",
    "name": "yourdevicename"
  },
  "type": "setSettings",
  "payload": {
    "someData": 54
  },
  "webhooks": [
    {
      "status": "action_sent",
      "url": "https://mybackend.com/action_sent/"
    },
    {
      "status": "action_overridden",
      "url": "https://mybackend.com/action_overridden/"
    },
    {
      "status": "response_received",
      "url": "https://mybackend.com/response/"
    },
    {
      "status": "action_delivered",
      "url": "https://mybackend.com/action_delivered/"
    }
  ],
  "status": {
    "action_sent": "2018-02-27T16:02:13.978899Z",
    "action_overridden": "2018-02-27T16:02:15.978899Z",
    "response_received": "2018-02-27T16:02:15.978899Z"
  },
  "service_level": 0,
  "cancelled": false,
  "finished": true,
  "result": {},
  "created_at": "2018-02-26T16:02:13.978899Z",
  "result_code": "Success",
  "expiry_date": "2019-03-27T16:02:13Z",
  "expired": "false"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "number"
    },
    "device": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "type": {
      "type": "string"
    },
    "payload": {
      "type": "object",
      "properties": {
        "someData": {
          "type": "number"
        }
      }
    },
    "webhooks": {
      "type": "array"
    },
    "status": {
      "type": "object",
      "properties": {
        "action_sent": {
          "type": "string"
        },
        "action_overridden": {
          "type": "string"
        },
        "response_received": {
          "type": "string"
        }
      }
    },
    "service_level": {
      "type": "number"
    },
    "cancelled": {
      "type": "boolean"
    },
    "finished": {
      "type": "boolean"
    },
    "result": {
      "type": "object"
    },
    "created_at": {
      "type": "string"
    },
    "result_code": {
      "type": "string"
    },
    "expiry_date": {
      "type": "string"
    },
    "expired": {
      "type": "string"
    }
  }
}

Action

Action Detail
GET/actions/{id}

Example URI

GET https://api.embever.com/v2/actions/62542
URI Parameters
HideShow
id
number (required) Example: 62542

ID of the action

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/actions/62542",
  "id": 62542,
  "device": {
    "id": "a1b2c3",
    "name": "yourdevicename"
  },
  "type": "setSettings",
  "payload": {
    "someData": 54
  },
  "webhooks": [
    {
      "status": "action_sent",
      "url": "https://mybackend.com/action_sent/"
    },
    {
      "status": "action_overridden",
      "url": "https://mybackend.com/action_overridden/"
    },
    {
      "status": "response_received",
      "url": "https://mybackend.com/response/"
    },
    {
      "status": "action_delivered",
      "url": "https://mybackend.com/action_delivered/"
    }
  ],
  "status": {
    "action_sent": "2018-02-27T16:02:13.978899Z",
    "action_overridden": "2018-02-27T16:02:15.978899Z",
    "response_received": "2018-02-27T16:02:15.978899Z"
  },
  "service_level": 0,
  "cancelled": false,
  "finished": true,
  "result": {},
  "created_at": "2018-02-26T16:02:13.978899Z",
  "result_code": "Success",
  "expiry_date": "2019-03-27T16:02:13Z",
  "expired": "false"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "number"
    },
    "device": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "type": {
      "type": "string"
    },
    "payload": {
      "type": "object",
      "properties": {
        "someData": {
          "type": "number"
        }
      }
    },
    "webhooks": {
      "type": "array"
    },
    "status": {
      "type": "object",
      "properties": {
        "action_sent": {
          "type": "string"
        },
        "action_overridden": {
          "type": "string"
        },
        "response_received": {
          "type": "string"
        }
      }
    },
    "service_level": {
      "type": "number"
    },
    "cancelled": {
      "type": "boolean"
    },
    "finished": {
      "type": "boolean"
    },
    "result": {
      "type": "object"
    },
    "created_at": {
      "type": "string"
    },
    "result_code": {
      "type": "string"
    },
    "expiry_date": {
      "type": "string"
    },
    "expired": {
      "type": "string"
    }
  }
}

Events

This section describes available API services for managing Event ressources.

Description of Events

Events are representations of data that was sent from a device to Embever IoT Core. An Event is not a response to an Action. Rather, some condition in the device triggered the transmission of that data. Each Event object is of a specific type and might have additional information (payload) that was sent by the device, e.g. some sensor value or other information.

Attribute Type Description Example
url String URI of the ressource.
id Integer The unique identifier of the object. 12
device String The ID of the Device instance. "8112635472"
type String The type of the event that was received. "battery_report"
payload Object A payload that was sent along with the Event. {"capacity":73}
created_at String Datetime at which the Event was created. (ISO 8601 timestamp format) "2018-02-26T16:02:13.978899Z"

Example Event object:

{
  "url": "https://api.embever.com/v2/events/12",
  "id": 12,
  "device": "8112635472",
  "type": "battery_report",
  "payload": {
    "capacity": 73
  },
  "created_at": "2018-02-26T16:02:13.978899Z"
}

Webhooks

Please refer to Device’s Webhooks section

Event Collection

List all events
GET/events/{?type,device}

Return a list of Event instances

Example URI

GET https://api.embever.com/v2/events/?type=battery&device=
URI Parameters
HideShow
type
string (optional) Example: battery

The type of the Event

device
string (optional) 

The ID of the device that sent the Event

Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "url": "https://api.embever.com/v2/actions/12",
    "id": 12,
    "device": "8112635472",
    "type": "someEventType",
    "payload": {
      "someData": 54
    },
    "created_at": "2018-02-26T16:02:13.978899Z"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Event

Event Detail
GET/events/{id}

Example URI

GET https://api.embever.com/v2/events/12
URI Parameters
HideShow
id
number (required) Example: 12

ID of the Event

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/actions/12",
  "id": 12,
  "device": "8112635472",
  "type": "someEventType",
  "payload": {
    "someData": 54
  },
  "created_at": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "number"
    },
    "device": {
      "type": "string"
    },
    "type": {
      "type": "string"
    },
    "payload": {
      "type": "object",
      "properties": {
        "someData": {
          "type": "number"
        }
      }
    },
    "created_at": {
      "type": "string"
    }
  }
}

Organisation

This section describes available API services for managing Organisation ressources.

Description of Organisation

An Organisation represents the parent entity which owns applications, devices and firmwares.

Attribute Type Description Example
url String URI of the ressource.
id String The unique identifier of the object. "59662055-8395-4242-92fc-6809d2de7159"
name String Name of the Oganisation. "Embever Gmbh"
street String Street address where the organisation is located. "Carl-Miller str."
street_number String Street number (address) where the organisation is located. "6"
postal_code String Postal code of the address of the Organsiation. "39112"
city String City address of the Organsiation. "Magdeburg"
country String Country where the Organsiation is located. "Germany"
max_token_lifespan_in_seconds number Time after which the Symmetric organistaion token expires. 300
created_at String Datetime at which the Organisation was created. (ISO 8601 timestamp format) "2018-02-26T16:02:13.978899Z"
secret String Secret key for the Symmetric organisation token. "secret-key"

Example Organisation object:

{
    "url": "https://api.embever.com/v2/organisations/59662055-8395-4242-92fc-6809d2de7159",
    "id": "59662055-8395-4242-92fc-6809d2de7159",
    "name": "Embever",
    "street": "Carl-Miller Str.",
    "street_number": "6",
    "postal_code": "39112",
    "city": "Magdeburg",
    "country": "DE",
    "max_token_lifespan_in_seconds": 300,
    "created_at": "2019-09-16T12:49:44.152794Z"
}

Currently the use of symmetric organisation token is deprecated and users are strongly adviced to use JWT Auth tokens instead.

Organisation Collection

List all Organisations
GET/organisations/

Example URI

GET https://api.embever.com/v2/organisations/
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "url": "https://api.embever.com/v2/organisations/7a2e64a2-9e85-4a75-9d63-f7060e63e0ce",
    "id": "7a2e64a2-9e85-4a75-9d63-f7060e63e0ce",
    "name": "Company Inc.",
    "street": "Sample-Str.",
    "street_number": "16",
    "postal_code": 39112,
    "city": "Remscheid",
    "country": "Germany",
    "max_token_lifespan_in_seconds": 300,
    "created_at": "2018-02-26T16:02:13.978899Z"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Organisation

Organisation Detail
GET/organisation/{id}/

Example URI

GET https://api.embever.com/v2/organisation/7a2e64a2-9e85-4a75-9d63-f7060e63e0ce/
URI Parameters
HideShow
id
string (required) Example: 7a2e64a2-9e85-4a75-9d63-f7060e63e0ce

The unique identifier of the organisation

Response  200
HideShow
Headers
Content-Type: application/detail

Update Organisation
PATCH/organisation/{id}/

Example URI

PATCH https://api.embever.com/v2/organisation/7a2e64a2-9e85-4a75-9d63-f7060e63e0ce/
URI Parameters
HideShow
id
string (required) Example: 7a2e64a2-9e85-4a75-9d63-f7060e63e0ce

The unique identifier of the organisation

Request
HideShow
Headers
Content-Type: application/json
Body
{
  "secret": "updated_secret",
  "max_token_lifespan_in_seconds": 360
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "secret": {
      "type": "string"
    },
    "max_token_lifespan_in_seconds": {
      "type": "number"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/organisations/7a2e64a2-9e85-4a75-9d63-f7060e63e0ce",
  "id": "7a2e64a2-9e85-4a75-9d63-f7060e63e0ce",
  "name": "Company Inc.",
  "street": "Sample-Str.",
  "street_number": "16",
  "postal_code": 39112,
  "city": "Remscheid",
  "country": "Germany",
  "max_token_lifespan_in_seconds": 360,
  "created_at": "2018-02-26T16:02:13.978899Z",
  "secret": "updated_secret"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "street": {
      "type": "string"
    },
    "street_number": {
      "type": "string"
    },
    "postal_code": {
      "type": "number"
    },
    "city": {
      "type": "string"
    },
    "country": {
      "type": "string"
    },
    "max_token_lifespan_in_seconds": {
      "type": "number"
    },
    "created_at": {
      "type": "string"
    },
    "secret": {
      "type": "string"
    }
  }
}

Tokens

This section describes available API services for managing Token ressources.

Description of Token

A Token is a unique string which contains credentials to identify the user. This vlaue of token attribute of a token object is used to generate access token from /authenticate endpoint point. The attribute token is retrieved only during token creation and has to be kept secret.

Attribute Type Description Example
url String URI of the ressource.
id Integer The unique identifier of the object. 59
alias String Name of the token. "Embever Org Token"
expiry_date String Datetime at which the token expires. "2020-02-26T16:02:13.00Z"
token String Token used to generate access token. "eyJ0eXAiOiJKV1QiLCJhb...."
scope Object Scope of the organisation. See below. See below.
created_at String Datetime at which the Token was created. (ISO 8601 timestamp format) "2018-02-26T16:02:13.978899Z"

Example Token object:

{
    "id": 37,
    "url": "https://api.embever.com/v2/tokens/37/",
    "alias": "org_userf",
    "activated": true,
    "expiry_date": null,
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJhbGlhcyI6Im9yZ191c2VyZiIsInVzZXJfaWQiOjN9.dytQivqGZwNhtHvNFjziR0fzeBsWvHtQJgoQwhvZxHh2y4H_gww-KBTr8PHOd6jrJjiBV27GZcxGmJ-0QKzs5A",
    "scope": {
        "organisation": "59662055-8395-4242-92fc-6809d2de7159",
        "application": null,
        "user": 3
    },
    "created_at": "2020-02-05T12:58:18.202698Z"
}

Scope of Token

The scope object shows the extend to which the token is confined to access the resources in the api. The scope attribute contains the following attributes

Status Description
organisation Organisation id of the organisation to whtich the token belongs.
application Application id of the application to which the token belongs.
user Id of the user to whom the token belongs.

Token Collection

List Tokens
GET/tokens/

Example URI

GET https://api.embever.com/v2/tokens/
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "url": "https://api.embever.com/tokens/15/",
    "id": 15,
    "alias": "sometoken",
    "activated": true,
    "expiry_date": "2018-02-26T16:02:13.978899Z",
    "scope": {
      "organisation": "7dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
      "application": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
      "user": 5
    },
    "created_at": "2018-02-26T16:02:13.978899Z"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Create Token
POST/tokens/

Example URI

POST https://api.embever.com/v2/tokens/
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "alias": "sometoken",
  "organisation": "7dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
  "application": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
  "expiry_date": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "alias": {
      "type": "string"
    },
    "organisation": {
      "type": "string"
    },
    "application": {
      "type": "string"
    },
    "expiry_date": {
      "type": "string"
    }
  }
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/tokens/15/",
  "id": 16,
  "alias": "sometoken",
  "activated": true,
  "expiry_date": "2018-02-26T16:02:13.978899Z",
  "scope": {
    "organisation": "7dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
    "application": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
    "user": 5
  },
  "created_at": "2018-01-26T16:02:13.978899Z",
  "token": "eyJ0eXAiOiJKv2QiLCJhbGciOiJIUzUxMiJ9.eyJhbGlhcyI6Ijhhc2RvdW5hc2QiLCJvcmdhbmlzYXRpb25faWQiOiI3YTJlNjRhMi05ZTg1LTRhNzUtOWQ2My1mNzA2MGU2M2UwY2UifQ.fFfZoEz60FdCDIi_oCKbxnke25jV5lVsB65cQ9eqh3v-xwMKqtTkvRdfa2yuQbLt9QsmIuMp14Gkxp61yThZhg"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "number"
    },
    "alias": {
      "type": "string"
    },
    "activated": {
      "type": "boolean"
    },
    "expiry_date": {
      "type": "string"
    },
    "scope": {
      "type": "object",
      "properties": {
        "organisation": {
          "type": "string"
        },
        "application": {
          "type": "string"
        },
        "user": {
          "type": "number"
        }
      }
    },
    "created_at": {
      "type": "string"
    },
    "token": {
      "type": "string"
    }
  }
}

Token

Token Detail
GET/tokens/{id}/

Example URI

GET https://api.embever.com/v2/tokens/16/
URI Parameters
HideShow
id
number (required) Example: 16

ID of the token

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/tokens/15/",
  "id": 15,
  "alias": "sometoken",
  "activated": true,
  "expiry_date": "2018-02-26T16:02:13.978899Z",
  "scope": {
    "organisation": "7dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
    "application": "6dbeb7f9-2d34-4411-9e34-9c7ae361cb92",
    "user": 5
  },
  "created_at": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "number"
    },
    "alias": {
      "type": "string"
    },
    "activated": {
      "type": "boolean"
    },
    "expiry_date": {
      "type": "string"
    },
    "scope": {
      "type": "object",
      "properties": {
        "organisation": {
          "type": "string"
        },
        "application": {
          "type": "string"
        },
        "user": {
          "type": "number"
        }
      }
    },
    "created_at": {
      "type": "string"
    }
  }
}

Delete Token
DELETE/tokens/{id}/

Example URI

DELETE https://api.embever.com/v2/tokens/16/
URI Parameters
HideShow
id
number (required) Example: 16

ID of the token

Response  204
HideShow
Headers
Content-Type: application/json

Firmware

Description of Firmware

A Firmware object represents the firmware used in the device.

Attribute Type Description Example
url String URI of the resource.
id String The unique identifier of the object. "UBNY6l"
version String Firmware version. "v1.0.0"
alias String Alias of the firmware "APP_FW_V1"
dest String Destination of the Firmware. “EBV” for Firmware of Embever Micocontroller, “APP” for Firmware of Application Microcontroller. "APP"
description String Additional info on firmware. “App fw with GNSS support”
predecessor String ID of a firmware instance. Indicating the predecessor. “au8auS”
created_at String Datetime at which the Firmware was created. (ISO 8601 timestamp format) "2019-02-26T16:02:13.978899Z"

Example Firmware object:

{
    "url": "https://api.embever.com/v2/firmwares/UBNY6l/",
    "id": "UBNY6l",
    "version": "v1.0.0",
    "alias": "hg",
    "dest": "APP",
    "description": "",
    "predecessor": null,
    "created_at": "2019-11-01T08:51:04.756688Z"
}

Firmware Collection

List all Firmwares
GET/firmwares/

Example URI

GET https://api.embever.com/v2/firmwares/
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "url": "https://api.embever.com/v2/firmwares/UBNY6l/",
    "id": "UBNY6l",
    "version": "1.0",
    "alias": "somefw",
    "dest": "EBV",
    "description": "some description",
    "predecessor": "au8auS",
    "created_at": "2018-02-26T16:02:13.978899Z"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Create Firmware
POST/firmwares/

Not implemented yet

Example URI

POST https://api.embever.com/v2/firmwares/
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "version": "1.0",
  "alias": "somefw",
  "dest": "\"EBV\"",
  "description": "some description",
  "predecessor": "au8auS"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "version": {
      "type": "string"
    },
    "alias": {
      "type": "string"
    },
    "dest": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "predecessor": {
      "type": "string"
    }
  },
  "required": [
    "version",
    "alias",
    "dest"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/firmwares/UBNY6l/",
  "id": "UBNY6l",
  "version": "1.0",
  "alias": "somefw",
  "dest": "EBV",
  "description": "some description",
  "predecessor": "au8auS",
  "created_at": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "version": {
      "type": "string"
    },
    "alias": {
      "type": "string"
    },
    "dest": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "predecessor": {
      "type": "string"
    },
    "created_at": {
      "type": "string"
    }
  }
}

Firmware

Firmware Detail
GET/firmwares/{id}/

Example URI

GET https://api.embever.com/v2/firmwares/UBNY6l/
URI Parameters
HideShow
id
string (required) Example: UBNY6l

ID of the Firmware instance

Response  200

Delete Firmware
DELETE/firmwares/{id}/

Example URI

DELETE https://api.embever.com/v2/firmwares/UBNY6l/
URI Parameters
HideShow
id
string (required) Example: UBNY6l

ID of the Firmware instance

Response  204

Firmware Updates

This section describes tha API operations to conduct firmware updates.

How Firmware Updates Work

Embever IoT Core offers the ability to easily update your device’s firmware over the air. To initialize a firmware update you need to create a Deployment instance, referencing:

  1. the Firmware instance that should be deployed (refer to the Firmware section)
  2. the devices which should update to the new firmware.

This way, You can initialize firmware updates for several devices at once. We highly recommend to start with a test Deployment. That is, referencing some devices that you have physical control of to check whether the new firmware does work properly.

Test your firmware update by creating a deplyoment for a set of test devices!

After you created the deployment, Embever IoT Core will automatically generate an _fota-type Action instance for each of your devices (please refer to the Actions section for more info about Actions). This Action will then be scheduled for delivery. Upon the device’s next wakeup it will receive this Action and proceed to download the correct firmware binary using our File Transfer Service. After the Update is complete, the device will send a response message and the corresponding Action, Update andDeployment instances will be updated accordingly.

When creating a new Deployment, Embever IoT Core checks whether unfinished Updates exist for referenced Devices. If this is the case, the creation of the Deployment instance will fail.

Description of Deployments

A Deployment is an aggregation of firmware update operations.

Attribute Type Description Example
url String URI of the ressource.
id Integer The unique identifier of the object. 15
devices Array (Device IDs) Array of device IDs, referencing devices that shall perform the update. Required. ["8112635472", "8112635473", "8112635474", "8112635475"]
successful Array (Device IDs) Array of device IDs, referencing devices that have successfully completed the update. ["8112635472", "8112635473"]
pending Array (Device IDs) Array of device IDs, referencing devices that have the update still in progress. ["8112635474"]
failed Array (Device IDs) Array of device IDs, referencing devices that the update failed. ["8112635475"]
firmware String ID of the firmware instance. Required "UBNY6l"
finished Boolean A boolean indicating whether the action is finished. true
created_at String Datetime at which the Deployment was created. (ISO 8601 timestamp format) "2018-02-26T16:02:13.978899Z"

Example Deployment:

{
  "url": "https://api.embever.com/v2/deployments/15/",
  "id": 15,
  "devices": [
    "m8uGz",
    "a1b2c3"
  ],
  "successful":["m8uGz"],
  "pending": ["a1b2c3"],
  "failed": [],
  "firmware": "UBNY6l",
  "finished": false,
  "created_at": "2018-02-26T16:02:13.978899Z"
}

Deployment Collection

List all Deployments
GET/deployments/

Example URI

GET https://api.embever.com/v2/deployments/
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "url": "https://api.embever.com/v2/deployments/15/",
    "id": 15,
    "devices": [
      "m8uGz",
      "a1b2c3",
      "s4U9j0",
      "aN901x"
    ],
    "successful": [
      "m8uGz",
      "a1b2c3"
    ],
    "pending": [
      "s4U9j0"
    ],
    "failed": [
      "aN901x"
    ],
    "firmware": "UBNY6l",
    "finished": false,
    "created_at": "2018-02-26T16:02:13.978899Z"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Create new Deployment
POST/deployments/

Example URI

POST https://api.embever.com/v2/deployments/
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "devices": [
    "m8uGz",
    "a1b2c3"
  ],
  "firmware": "UBNY6l"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "devices": {
      "type": "array"
    },
    "firmware": {
      "type": "string"
    }
  },
  "required": [
    "devices",
    "firmware"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/deployments/15/",
  "id": 15,
  "devices": [
    "m8uGz",
    "a1b2c3"
  ],
  "successful": [],
  "pending": [],
  "failed": [],
  "firmware": "UBNY6l",
  "finished": false,
  "created_at": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "number"
    },
    "devices": {
      "type": "array"
    },
    "successful": {
      "type": "array"
    },
    "pending": {
      "type": "array"
    },
    "failed": {
      "type": "array"
    },
    "firmware": {
      "type": "string"
    },
    "finished": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string"
    }
  }
}

Deployment

Deployment Detail
GET/deployments/{id}/

Example URI

GET https://api.embever.com/v2/deployments/15/
URI Parameters
HideShow
id
number (required) Example: 15

ID of the Deployment instance

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https://api.embever.com/v2/deployments/15/",
  "id": 15,
  "devices": [
    "m8uGz",
    "a1b2c3",
    "s4U9j0",
    "aN901x"
  ],
  "successful": [
    "m8uGz",
    "a1b2c3"
  ],
  "pending": [
    "s4U9j0"
  ],
  "failed": [
    "aN901x"
  ],
  "firmware": "UBNY6l",
  "finished": false,
  "created_at": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "number"
    },
    "devices": {
      "type": "array"
    },
    "successful": {
      "type": "array"
    },
    "pending": {
      "type": "array"
    },
    "failed": {
      "type": "array"
    },
    "firmware": {
      "type": "string"
    },
    "finished": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string"
    }
  }
}

Update Collection

List all Updates
GET/updates/

Example URI

GET https://api.embever.com/v2/updates/
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "url": "https//api.embever.com/v2/updates/23/",
    "id": 23,
    "deployment": 15,
    "device": "m8uGz",
    "status": {
      "action_sent": "2018-02-27T16:02:13.978899Z",
      "response_received": "2018-02-27T16:05:15.978Z"
    },
    "result": {
      "status": 200
    },
    "result_code": "Success",
    "finished": true,
    "changed_at": "2018-02-26T16:02:13.978899Z",
    "created_at": "2018-02-26T16:02:13.978899Z"
  }
]
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array"
}

Update

Update Detail
GET/updates/{id}/

Example URI

GET https://api.embever.com/v2/updates/23/
URI Parameters
HideShow
id
number (required) Example: 23

ID of the Update instance

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "url": "https//api.embever.com/v2/updates/23/",
  "id": 23,
  "deployment": 15,
  "device": "m8uGz",
  "status": {
    "action_sent": "2018-02-27T16:02:13.978899Z",
    "response_received": "2018-02-27T16:05:15.978Z"
  },
  "result": {
    "status": 200
  },
  "result_code": "Success",
  "finished": true,
  "changed_at": "2018-02-26T16:02:13.978899Z",
  "created_at": "2018-02-26T16:02:13.978899Z"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "id": {
      "type": "number"
    },
    "deployment": {
      "type": "number"
    },
    "device": {
      "type": "string"
    },
    "status": {
      "type": "object",
      "properties": {
        "action_sent": {
          "type": "string"
        },
        "response_received": {
          "type": "string"
        }
      }
    },
    "result": {
      "type": "object",
      "properties": {
        "status": {
          "type": "number"
        }
      }
    },
    "result_code": {
      "type": "string"
    },
    "finished": {
      "type": "boolean"
    },
    "changed_at": {
      "type": "string"
    },
    "created_at": {
      "type": "string"
    }
  }
}

User Management

File Transfer

Generated by aglio on 06 Feb 2020