Web API: Token: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
The Token operation is used to login a user to start a session required by the Web API. The '''access token''' is get as a response which is used to authenticate other Web API operations.
The Token operation is used to login a user. All operations in the Web API require a session. The '''access token''' is returned as a response which is used to identify the session in other Web API operations.
 
==Request==
* Request url has the following form: <nowiki>https://SERVER/qprpa/token</nowiki>, where SERVER is the DNS name of the server. Note that the path doesn't contain '''api''' unlike all other operations in the Web API.
* Request method is '''POST'''.
* '''Content-Type''' in the HTTP request header must be '''application/x-www-form-urlencoded'''.
* Request  body contains the following parameters as url encoded:
** '''username''': Username.
** '''password''': User password.
** '''grant_type''': '''password''' (always use that value)


Example:
Example:
<pre>
<pre>
Url: POST /token
Content-Type: application/x-www-form-urlencoded
Body:
username=myUserName&password=myPassword&grant_type=password
username=myUserName&password=myPassword&grant_type=password
</pre>
</pre>


==Response==
Note that the path doesn't contain '''api''' unlike all other operations in the Web API.
 
Request body contains the following parameters as url encoded:
** '''username''': Login name of the user.
** '''password''': User password.
** '''grant_type''': '''password''' (always use that value)
 
The response is a JSON object with several properties. One of them is '''access_token''' containing the access token (session id).
The response is a JSON object with several properties. One of them is '''access_token''' containing the access token (session id).


[[Category: QPR ProcessAnalyzer]]
[[Category: QPR ProcessAnalyzer]]

Revision as of 13:48, 16 May 2020

The Token operation is used to login a user. All operations in the Web API require a session. The access token is returned as a response which is used to identify the session in other Web API operations.

Example:

Url: POST /token
Content-Type: application/x-www-form-urlencoded
Body:
username=myUserName&password=myPassword&grant_type=password

Note that the path doesn't contain api unlike all other operations in the Web API.

Request body contains the following parameters as url encoded:

    • username: Login name of the user.
    • password: User password.
    • grant_type: password (always use that value)

The response is a JSON object with several properties. One of them is access_token containing the access token (session id).