Follow¶
- Summary: The follow API is a data exchange enabling API that is used to express interest in another entity’s data. It could either be for reading, writing, or both. It is time-bound and the requestor has to explicitly mention the duration for which they would like to the data. Once the follow request is made, the
follow-statusAPI can be queried to check if the follow request is approved by the requested device.
Request¶
Endpoint: Either of
https://localhost/entity/followhttps://localhost/owner/follow
Method:
POSTSecurity Scheme: Either of
Required Headers:
Field Description to Name of the entity which the requestor is interested in permission - Can be any of:
readwriteread-write
validity Validity period specified in number of hours. topic Topic of the message the requestor is interested in. E.g. errors,logs,alerts,dataand so on.Optional headers:
Field Description message-type Either of protectedordiagnosticsfrom Name of the device on behalf of which the follow request is being made (When the owner calls this API)
Responses¶
202 Accepted:- The follow request has been accepted for processing and is under review by the requested device or its owner (whichever may be the case)
400 Bad RequestIf any of the required headers are missing from the request:
{ "error": "inputs missing from headers" }
If
message-typeis provided but is not valid:{ "error": "invalid message-type" }
If the requested
validityis out of range:{ "error": "validity must be in number of hours" }
If the requested
permissionis not valid:{ "error": "invalid permission" }
403 Forbidden:If the owner calls the API but the
fromheader is missing:{ "error": "from value missing in header" }
When the
fromheader is present but not valid:{ "error": "from is not a valid entity" }
When the owner calling the API is not the owner of the
fromdevice:{ "error": "you are not the owner of the 'from' entity" }
If
tois not a valid entity:{ "error": "'to' is not a valid entity" }
If device is not autonomous:
{ "error": "unauthorized" }
If the requested
validityis not valid:{ "error": "invalid validity" }
If the requested topic is invalid:
{ "error": "invalid topic" }