Instructions
After registering an API user, you need to authenticate and obtain a bearer token from the webservice. This is done by sending a POST request to
https://api.trusted.dk:443/Token
with the following header included
Content-Type: application/x-www-form-urlencoded
The request body must contain the following:
grant_type=password&username=[username]&password=[password]
without the brackets. Example:
grant_type=password&username=MyName&password=1234
Assuming that the request succeeds, the response body will look similar to this
{
"access_token":"boQtj0SCGz2GFGz[...]",
"token_type":"bearer",
"expires_in":1209599,
"userName":"[username]",
".issued":"Mon, 14 Oct 2013 06:53:32 GMT",
".expires":"Mon, 28 Oct 2013 06:53:32 GMT"
}
(For readability, the access token has been truncated and indentation added. [username] should be included without brackets)
The token is only valid until it's expiration time. After expiration, or any time before, you can obtain a new token.
In order to send an authorized request to the web API, insert the obtained token in the request header like this:
Authorization: Bearer boQtj0SCGz2GFGz[...]