Authenticating to the DevOps Plan REST API
Before making an API call, you must authenticate with the REST API server and use POST to obtain an authorization token.
About this task
The authentication endpoint is POST/authenticate
. Use POST to obtain an
authorization token to the REST API server: POST https://
localhost:8190/devopsplan/rest/authenticate
.
To obtain the token, you must pass payload
AuthInfo json
in the
body.{
apitoken,
"repo": "SampleRepository",
"db": "SampleDatabase"
}
After successful authentication, the API returns a
token:
{
"token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInJlcG8iOiIxMC4wLjAiLCJleHAiOjE1NzM2NjE5NDUsImlhdCI6MTU3MzU3NTU0NSwiZGIiOiJTQU1QTCJ9.Lgdk9gPm6mFFGEnr6mRt7Vrq-nTnlP86ARKc16bP4syeTIvKQ55JX5r6aFXVC20xC2NwsjqbvAhd2f1r2PiIUA"
}
For any subsequent API call, you must pass the token value in the Authorization header in bearer
format:
Authorization: Bearer <token_value>
For example:
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInJlcG8iOiIxMC4wLjAiLCJleHAiOjE1NzM2NjE5NDUsImlhdCI6MTU3MzU3NTU0NSwiZGIiOiJTQU1QTCJ9.Lgdk9gPm6mFFGEnr6mRt7Vrq-nTnlP86ARKc16bP4syeTIvKQ55JX5r6aFXVC20xC2NwsjqbvAhd2f1r2PiIUA
For more information about REST API authentication, see https://
localhost:8190/swagger-ui.html#/Authentication/authenticate
, where
localhost is the server name where the DevOps Plan REST API server is running.