Delete token

Note: For R21, deletion of the token is not supported for MQTT/HTTP protocols.

This request allows the client application to delete the token details generated for a group or for a specific token.

A separate API is not available to delete the adaptation layer, as it is tied with a delete token. Whenever Delete Token API calls for a specific token, IMPACT checks if an adaption layer is onboarded for the token and if any devices onboarded with the adaptation layer. Based on the outcome of the checks, IMPACTS proceeds with the deletion as follows:
  • If no adaptation layer is onboarded for the token, IMPACT deletes the token and queues the payload for gateway consumption.
  • If an adaptation layer is onboarded for the token but no devices are attached to it, IMPACT deletes the token along with the onboarded adaptation layer and queues the payload for gateway consumption.
  • If an adaptation layer is onboarded for the token and at least one devices is attached to it, nothing is deleted and a suitable response message is sent to the caller.

Delete token for group describes the API structure for the delete token event.

Table 1. Delete token for group
Title Delete token for group
URL

To delete a particular token: http://{impact_url}:{impactport}/m2m/token?groupName=<>&token=<>

To delete a group with login user: http://{impact_url}:{impactport}/m2m/token?groupName=<>

Method DELETE
Content-Type application/json
URL Params

The following are the URL parameters:

  • groupname:[string]: Specifies the group name for which the tokens must be deleted.

  • token: [string]: Specifies the token ID that must be deleted within the group.

Data Params

The following are the data parameters:

  • msg:[string]: Specifies the success or failure message.

  • tokenResponse:[string]: Specifies the list of tokens deleted for a group.

Success Code
Response Code: 202
Error Code
401 : Unauthorized 
403 : Forbidden 
204 : No Content
Sample Call

Curl:

curl -X DELETE --header 'Accept: application/json'  --header 'Authorization: Basic amFpX21mb3JtYWRtaW46bWZvcm1RMXcyZSM=' 'http://mfussip02.mformation.com:9090/m2m/token?groupName=DM.MFORM.SURYA&token=u7wsz38w5wdx'

Response message:

200 {"msg":"Success","code":1000}
206 {"msg":"Partial success;  Tokens associated with adaptationlayer/devices ; Invalid tokens [1ib8qplmq4im0, 1iv3tnb4fqn1w, vf6eo8hm6z3t] ","code":5008}
400 {"msg":"Token associated with adaptationlayer/devices","code":5007}
404 {"msg":"Invalid token","code":5002}
404 {"msg":"No Token associated with the user","code":5009}
500 {"msg":"Internal Server Error","code":1004}
Response Body:
{
  "msg": "Success", "Code": 1000
}
Notes

The delete token API can not delete the token of an adaptation layer, if a device is onboarded with it.