Filter results by

MQTT API

For MQTT implementation details, please refer to this page.

Endpoint

1
mqtts://api.artik.cloud

MQTT channels

Establish MQTT session

MQTT Components Required Value Notes
Security SSL ARTIK cloud services device must be SSL-capable so that it can validate server certificate.
Broker URL api.artik.cloud Needed for opening the connection to the broker.
Broker port 8883 Needed for opening the connection to the broker.
username Device ID A valid ARTIK cloud services device ID used to login to establish a session.
password Device Token A valid ARTIK cloud services device token used to login to establish a session.

A device uses the above MQTT parameters to connect to the ARTIK cloud services MQTT broker, and then logs in to establish an MQTT session. The device can publish data-only messages and/or subscribe to receive Actions targeted to it within this session.

Publish a message

/v1.1/messages/<deviceID>

A device uses this path to publish a data-only message (a message with type message). An MQTT message contains only the value of the data field in a message sent via POST.

Request parameters

Parameter Description
deviceID ID of the device publishing an MQTT message.

Example MQTT message

1
{"onFire":false,"temperature":50}

Subscribe to receive Actions

/v1.1/actions/<deviceID>

A device subscribes at this path to receive Actions (a message with type action) that are targeted to it. When a source device or an application sends an Action to the subscribed device via REST or WebSocket, the device receives the Action.

Request parameters

Parameter Description
deviceID ID of the subscribing device.

Example recieved Action

1
[{"name":"setOn","parameters":{}}]

The received Action only contains the value of the actions field in the data JSON object of a typical ARTIK cloud services message.

Subscribe to receive errors

/v1.1/errors/<deviceID>

A device subscribes at this path to receive publish errors associated with MQTT message publishing. Errors generated prior to subscribing to this endpoint will not be received.

Request parameters

Parameter Description
deviceID ID of the subscribing device.

Example response

1
2
3
4
5
6
7
8
9
10
{
  "error":{
    "code":429,
    "message":"DEVICE MINUTE rate limit exceeded",
    "X-Rate-Limit-Limit":"1/50000",
    "X-Rate-Limit-Remaining":"0/49995",
    "X-Rate-Limit-Reset":"1458072876/1458086400",
    "id":"04642e813c9e416b96e3f05d131a84df"
  }
}

MQTT errors

Code Error message Condition
403 You do not have publish permission to topic Attempt to publish to invalid path
403 You do not have subscribe permission to topic Attempt to subscribe to invalid path
403 Source device is disconnected Device has been disconnected and thus cannot send or receive messages
429 DAILY rate limit exceeded

MINUTE rate limit exceeded
Rate of publishing has exceeded daily/minute rate limit
429 Plan quota exceeded for organization <organizationID>. Reason: Monthly message limit. Monthly quota exceeded
413 Plan quota exceeded for organization <organizationID>. Reason: Max payload size limit. Payload size exceeded
400 Quota validation error for organization <organizationID>. Reason: Plan limits have not been set. Organization quota plan has not been configured