Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Introduction

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

curl https://ws.di.no/ws/json/auth/v-2/login \
  -H "Content-Type:application/json" \
  -d "{\"username\": \"myname\", \"password\": \"secret\"}"

Environments / endpoints

TESTPOSThttps://staging-ws.di.no/ws/json/auth/v-2/login
PRODUCTIONPOSThttps://ws.di.no/ws/json/auth/v-2/login

Request object:

Field

Description

Example

Data type

Count

usernameThe username that was provided by the DI service deskmyNameString1
passwordThe password that was provided by the DI service desksecret!23String1

Response object:

The endpoint replies with a response object in JSON format, containing the following data

Field

Description

Example

Data type

Count

tokenThe JWT token to be used in subsequent requestsaVeryLongStringString1

The security token should be placed in theĀ Authorization header like this:

"Authorization: Bearer <token>"

The token is valid for 30 minutes and is a json web token (Ā https://jwt.io/Ā ) but can be handled as a plain string on the client side.

Changelog:

Version 2 returns a valid JSON object as opposed to version 1 which just returned the token as a string.

  • No labels