...
Content
Table of Contents |
---|
Setup
This is the documentation of how to obtain an authentication token for theĀ ws.di.noĀ domain.
About POST
In order to POST data into the API use a JSON object without name.
You should also set the Content-Type header to "application/json".
A request will look like this:
Curl request
|
Environments / endpoints
...
Test
...
Info |
---|
|
Environments / endpoints
TEST |
|
|
|
PRODUCTION |
|
|
...
|
Making a request
Request headers
Key | Value |
---|---|
Content-Type | application/json |
Request body
Field | Description | Example | Data type |
---|
Count
username | The username that was provided by the DI service desk | myName | String |
1
password | The password that was provided by the DI service desk | secret!23 | String |
1
MinutesValid | Values are between 1 and 1440 minutes which indicates the tome the Token is valid | 1440 |
Sting
1
...
String |
Curl request example
Code Block |
---|
curl -X POST \
https://ws.di.no/ws/json/auth/v-3/login/1440 \
-H 'Content-Type: application/json' \
-dĀ "{\"username\": \"myname\", \"password\": \"secret\"}" |
Response
The endpoint replies with a response object in JSON format, containing the following data
Field | Description | Example | Data type |
---|
token | The JWT token to be used in subsequent requests | aVeryLongString | String |
1
The security token should be placed in theĀ Authorization header like this:
"Authorization: Bearer <token>"The token is validity can be specified in the url in minutes, valid values are between 1 and 1440 minutes, a new token can be obtained after expiry by calling this endpoint again. The token is returned in a json structure with token as key and can be handled as a plain string on the client side.