Search code examples
fiware-orionunsubscribe

How to unsubscribe particular entity from csubs using subscribe_id in fiware orion


i couldn't find particular subscribe_id to unsubscribe particular entity from csubs.

If i can use customize subscribe_id instead of auto generate id, it is easy to unsubscribe particular id.

But i couldn't set customize id, when call subscribe(self, entity_id, entity_type="openmtc", fiware_service="") in orion_api.py

Regards Janaka


Solution

  • As decribed in NGSIv2 specification, you get the resource URI associated to the subscription at creation time (i.e. in the response of the POST /v2/subscription request) in the Location HTTP header. For instance:

    Location: /v2/subscriptions/abcde98765
    

    That URI is the one to use to retrieve (GET), modify (PATCH) or delete (DELETE) the subscription. In the later case the request would be as follows (without any payload):

    DELETE /v2/subscriptions/abcde98765
    

    In addition, you can get a list of subscriptions using GET /v2/subscriptions. Each subscription includes and id field, that can be used in the same fashion to get, modify and/or delete the subscription.