Creating Tokens

Before onboarding an Adaptation Layer, it is essential to create a token which authenticates an incoming Adaptation Layer. Using this API, you can create the token required to authenticate the Adaptation Layer.

Table 1. Create Token API
Parameter Description
URL http://<impact_hostname>:<port>/m2m/token
Method PUT
Content-Type application/json
Parameters
  • groupName: Specifies the group name for which the tokens must be created.
  • username: Specifies the user who created the tokens.
Response Parameters
  • msg:[string]: success or failure message

  • tokenResponse [string]: list of tokens created for a group

  • username [string]: Specifies the user who created the token.
  • secret [string]: Specifies the secret derived from creating tokens.
  • token [string]: Specifies the token generated. The generated token is provided as input for adaptationLayerid, during HTTP Adaptation Layer onboarding.
  • Description [string]: Specifies the description for the token.
Success Code
Response Code: 200
Error Code
400 : Bad Request 
401 : Unauthorized 
404 : Not Found
Sample Call

Curl:

curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json'  --header 'Authorization: Basic amFpX21mb3JtYWRtaW46bWZvcm1RMXcyZSM=' -d '{
   "description": "testtoken",
  "groupName": "DM.MFORM.SURYA",
  "username": "test1234"

Response Body:

{
  "msg": "Success",
  "tokenResponse": {
    "token": "1jylmg8lwa1cy",
    "secret": "iJ6ZIaJNUsILm3WGNr55LDDCV3iQ+RjmOcQbY2IGquY=",
    "username": "TEST1234",
      }
}
Notes

If length of 'username' field in the request, is more than 50 characters, then the following message is displayed:

‘username' can not be more than 50 chars