Connect to the API¶
Before you can access data with the Nena API you first need to set up authentication. The API uses access tokens to verify a user. A token is generated by submitting a POST request containing your Nena portal login credentials in the request’s body, to the login endpoint. The access token is a required field for requests made to all other endpoints.
Important
The access token will be valid for 15 minutes from when you submit a login request.
Authentication¶
The following post request will return an access token.
- POST /api/user/login
Recieve an API access token by submitting your Nena portal login credentials.
Note: You should replace UserName and Password with your Nena username and password.
- Content-Type
application/json
- form
{ "UserName": "string", "Password": "string" }
Example Request
curl --location --request POST 'https://api.nena.no/api/user/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"UserName": "<your-username>",
"Password": "<your-password>"
}'
import requests
import json
url = "https://api.nena.no/api/user/login"
payload = json.dumps(
{
"UserName": "<your-username>",
"Password": "<your-password>"
}
)
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Example Respons
{
"UserName": "string",
"Token": "string"
}