Authentication
Some of the Byggtjeneste APIs uses Oauth0 as its authentication mechanism. For this purpuse, a separate Authentication API, decoupled from the actual content API, is available.
Prerequisites
To access a Byggtjeneste API you will need the following items:
A subscription to the API.
A Client Id, Client Secret, and Audience.
The URL to the API and Auth API.
Once you have all the above, you will first need to make a request to Auth API, to generate an Authorization Bearer Token. Then you will be able to access the API (details and example under Byggtjeneste API Access).
Auth Api Access
To generate a Authorization Bearer Token, you will need to call the Auth API, POSTing your Client Id, Client Secret, and Audience. An example request is below:
curl -L -X POST 'https://AUTHAPIURL/api/clientaccess' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'clientId=ID' \
--data-urlencode 'clientSecret=SECRET' \
--data-urlencode 'audience=AUDIENCE'
After a successful request you will receive an Authorization Bearer Token that you can pass to the Byggtjeneste API, to make authenticated requests.
Byggtjeneste API Access
To access the Byggtjeneste API, you will need to pass the Authorization Bearer Token, you received from the Auth API. An example CURL request is below:
curl -X POST \ 'https://BYGGTJENESTEAPIURL/api/method' \ -H 'Authorization: Bearer YOUR_GENERATE_BEARER_TOKEN'
Now you should be able to access the Byggtjeneste API.
Server URLs
Server | URL |
---|---|
Test server | |
Production server |