Subscribe¶
- Summary: The subscribe API is used to get messages from a queue. This is a destructive action on the message as it will no longer be available in the queue after subscription. This API is not streaming, i.e. as data arrives into the queue it is not pushed to the subscribers. However, it needs to be polled regularly to check for new messages.
Request¶
Endpoint:
https://localhost/entity/subscribeMethod:
GETSecurity Scheme: Device Credentials
Optional Headers:
Header Name Description message-type Either of priority,commandornotification. If this field is empty then the suppliedidis taken as the default queue namenum-messages Number of messages to subscribe to. Defaults to 10
Responses¶
200 OKGives back messages from the queue
[{ "sent-by": "admin/dev", "from": "admin/dev.protected", "subject": "streetlight data", "content-type": "application/json", "body": { "ambientLux": 10000, "power": 73.26, "caseTemp": 34.5 } }]
400 Bad RequestIf any of the required headers are missing from the request:
{ "error": "inputs missing from headers" }
If the provided
idis not a valid entity:{ "error": "id is not a valid entity" }
If
message-typeis provided but is invalid:{ "error": "invalid message-type" }
If
num-messagesis provided but is not valid:{ "error": "num-messages is not valid" }