Share¶
- Summary: The “share” API is a data exchange enabling API which is used to approve
followrequests. When the share API is called by an entity, it grants the necessary permissions to the requestor’s device, i.e, either read access, or write access, or both. The requested entity can poll thefollow-requestsAPI to check if any new follow requests were made to it. The requesting device, can similarly poll thefollow-statusAPI to check if the follow request was approved. Once the process completes, the requesting entity can bind to the exchange of the requested entity’s exchange using thebindAPI (in case of read permission) or start writing to the device’s command queue (in case of write permission). When the permission is for write access, the scenario is handled a little differently which is explained using the following example. Assumeperson/appwould like to controlcompany/streetlight. After the necessary permissions are obtained, althoughperson/apppublishes tocompany/streetlight, under the hood the message is actually published toperson/app.publishwith a routing keycompany/streetlight.command.#(if the message’s routing key was #). Theperson/app.publishexchange is bound tocompany/streetlight’s command queue with the above routing key. This information becomes useful when the publisher uses the AMQP protocol to publish messages.
Request¶
Endpoint: Either of:
https://localhost/owner/sharehttps://localhost/entity/share
Method:
POSTSecurity Scheme: Either of
Required Headers:
Header Name Description follow-id ID of the follow request made by another entity. Can be obtained by calling the follow-requestsAPI
Responses¶
200 OK:- The follow request has been approved
400 Bad Request:If any of the required headers are missing from the request:
{ "error": "inputs missing from headers" }
If the device is not autonomous:
{ "error": "unauthorized" }
If the
follow-idis invalid:{ "error": "invalid follow-id" }