Advanced Configuration : Using Integration Manager APIs : Tutorial : Authorization
 
Share this page                  
Authorization
This section provides steps to log in to the Integration Manager API to get the access token to use in the header of the subsequent sections. The parameters it accepts and the response codes are documented at https://api.im.actiandatacloud.com/v2/apidocs/#/Authorization/login.
This is a POST Request and the URL is http://localhost:8080/api/login.
It accepts application/json content type and this information should be provided in the header:
Request Header
Content-Type: application/json
It accepts the following request body. The “string” must be replaced with a valid username and password respectively.
Request Body
{
"username": "string",
"password": "string"
}
Here is the sample request that is sent to the API:
Sample Request – HTTP code snippet
POST /api/login HTTP/1.1
Host: localhost:8080
Content-Type: application/json
{
"username": "string",
"password": "string"
}
If the login is successful, status code 200 OK is returned, and an access token will be returned to the response body first key called “access_token”. Copy the long access token and use it in the subsequent calls with Bearer schema.
Sample Response Body for status code: 200
{
   "access_token": "<access token value used for accessing other Integration Manager APIs>",
   "token_type": "bearer",
   "refresh_token": "<refresh access token value>",
   "expires_in": 35998,
   "scope": "configure execute",
   "id_token": "<id token value used by external applications>"
}
If the login fails because of wrong credentials, status code 401 Unauthorized is returned.
If a wrong header or incorrect request body is sent, status code 400 Bad Request is returned.
Sample request with wrong content-type and body without password key
POST /api/login HTTP/1.1
Host: localhost:8080
Content-Type: text/plain
{
"username": "string",
}
Sample response body for status code 400 Bad Request
{
    "message": "invalid inputs",
    "errors": [
        {
            "field": "password",
            "errorMessages": [
                "must not be null"
            ]
        }
    ]
}