Filter results by

CoAP API

For CoAP implementation details, please refer to this page.

Endpoint

1
coaps://coaps-api.artik.cloud

CoAP channels

POST data-only messages

1
/v1.1/messages/<deviceToken>

A device can POST a CoAP message of type message using this path.

Request parameters

Parameter Description
deviceToken Device token.

Example CoAP message

1
2
3
4
5
{
  "ts": 1388179812427,
  "type": "message",
  "data": {"onFire":false,"temperature":50}
}           

Example response

1
{"data":{"mid":"91a8deb1d9814fc4a8da02462705a639"}}

GET (Observe) actions

1
/v1.1/actions/<deviceToken>

The client establishes an "Observe" connection with the ARTIK cloud services CoAP sever. With this connection, the client can receive Actions targeted to it. To start the connection, the client sends a GET (Observe) request at this path.

Request parameters

Parameter Description
deviceToken Device token.

Example received Action

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

CoAP errors

Code Error output Condition
4.04 N/A POST/GET failure due to invalid token or request path
4.00 {"error":{"code":4001,"message":"Missing data","id":"e3e0cd2166c9447aba2c673ad0d0dfba"}} POST required 'data' field is missing.
4.00 {"error":{"code":4001,"message":"Invalid ts","id":"fa247f0d727848c18547fb3a5afc831d"}} Timestamp less than 0
4.00 {"error":{"code":4001,"message":"Invalid ts (in future)","id":"ce6592db68cc4806aa07450e822b0207"}} Timestamp greater than allowed drift margin.