API (test)

Endret Thu, 14 Mar 2024 ved 04:50 PM

This article is for testing our external API. This applies to both company level and third-party integration partners.


Currently, we are testing our API directly with several businesses and integration partners. We need to generate their client_secret manually, but we will soon have automated processes to simplify API connection. Systima has an open and flexible API strategy.


Currently we test to our dev server. We do new updates on this server multiply times a day, and we also do a lot of API changes. We currently want to test this server so it is efficient for us to possibly update the API if there is a desire for changes. We will later test against a more stable server.


Documentation

Swagger link: https://api-dev-systima.azurewebsites.net/swagger-external/

Username: external

password: 123456789


Step 1

Send us a message so we can give you access to our dev server, and create your client_secret


You can send a message here and please send this:

- Info about you

- Organization number

- Phone number

- Email


Step 2

Use this endpoint to get an access token 

https://api-dev-systima.azurewebsites.net/swagger-external/#/Auth/AuthController.login

This API is protected by client_secret that we sent you

Please use email and password of your user, that you registered in https://app.dev.systima.no


Request:

curl -X 'POST' \
  'https://api-dev-systima.azurewebsites.net/api-external/auth' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer CLIENT_SECRET' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "USER_EMAIL",
  "password": "USER PASSWORD"
}'

Response:

{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjYmNkNjkzMi1lODkxLTQzNTktOWZlOS04YjU1NDg3MDJiNTAiLCJpYXQiOjE3MDMwODg4MzgsImV4cCI6MTcwMzE3NTIzOH0.kyAQ12duXMIuSV-chmZETeOghSJzeOYxRvFtRxdkAq1",
  "expiresIn": 86400,
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjYmNkNjkzMi1lODkxLTQzNTktOWZlOS04YjU1NDg3MDJiNTAiLCJpYXQiOjE3MDMwODg4MzgsImV4cCI6MTcwMzY5MzYzOH0.kXhZqBe8OSDC0hwaK3LO51qTz5spfMFi9zgXmwLnout"
}


In case when access token has expired use the API to renew the access token

https://api-dev-systima.azurewebsites.net/swagger-external/#/Auth/AuthController.refreshToken

Request

curl -X 'POST' \
  'https://api-dev-systima.azurewebsites.net/api-external/refreshtoken' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer CLIENT_SECRET' \
  -H 'Content-Type: application/json' \
  -d '{
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ6.eyJ1c2VySWQiOiJjYmNkNjkzMi1lODkxLTQzNTktOWZlOS04YjU1NDg3MDJiNTAiLCJpYXQiOjE3MDQ2OTk1MTksImV4cCI6MTcwNzI5MTUxOX0.-w1rQWNSGCNzE_U3DQkw6uabVBYFZv2OAjn5JKhgBRs"
}'

Response:

{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjYmNkNjkzMi1lODkxLTQzNTktOWZlOS04YjU1NDg3MDJiNTAiLCJpYXQiOjE3MDQ2OTk1NDcsImV4cCI6MTcwNDc4NTk0N30.FKem2BVAPs-ukRy5SCwBz3UWbF_rAoVHfrZrf7EWgX4",
  "expiresIn": 86400,
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjYmNkNjkzMi1lODkxLTQzNTktOWZlOS04YjU1NDg3MDJiNTAiLCJpYXQiOjE3MDQ2OTk1NDcsImV4cCI6MTcwNzI5MTU0N30.0jWey5AoRkwhFqXnX-2zsoO2yWG887OAjXG3wZT6mb8"
}


Step 3

2. Use this API to get a list of user’s companies, using access token that we received on previous step

https://api-dev-systima.azurewebsites.net/swagger-external/#/Company/CompanyController.getCompanies


curl -X 'GET' \
  'https://api-dev-systima.azurewebsites.net/api-external/companies' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjYmNkNjkzMi1lODkxLTQzNTktOWZlOS04YjU1NDg3MDJiNTAiLCJpYXQiOjE3MDMwODg4MzgsImV4cCI6MTcwMzE3NTIzOH0.kyAQ12duXMIuSV-chmZETeOghSJzeOYxRvFtRxdkAq1'

Var denne artikkelen nyttig?

Så bra!

Takk for din tilbakemelding

Beklager at vi ikke kunne være mer til hjelp

Takk for din tilbakemelding

Fortell oss hvordan vi kan forbedre denne artikkelen.

Velg minst én av grunnene

Tilbakemeldingen er sendt inn

Vi setter pris på tilbakemeldingen din og vil prøve å rette på artikkelen