Skip to main content

Authentication

Gain API Access

TimeDetect uses Visma Connect for authentication. To gain access, you need to register an application on the Visma Developer Portal by following the steps below.

1. Log in to Visma Developer Portal

When testing the API, log in to Stage. When in production with real users, use the Production environment.

2. Add the application

Go to "My Applications" > "Add Application" > "Service (Machine-to-Machine)".

Fill in the required details, save your application and create/publish it. Note the client_id.

client_id

For clarity and ease of support, please ensure your client_id identifies your company and/or product. For example, intempus_anomaly_detection.

3. Add the Integration

Select the Machine Learning Factory API Stage/Prod API and the relevant scope (machine-learning-factory-api-<stage/prod>:td). Note that the video below shows the scope for PayrollDetect.

Wait for the integration request to be accepted. Feel free to contact the TimeDetect team to speed up the process.

4. Generate secret

In the the application created, generate and securely store the client_secret.

Generate (Temporary) Access Token

To use the API you need an access token generated by Visma Connect's API. These have a lifetime of up to 60 minutes, depending on what you selected when setting up the application.

To generate an access token from the Visma Connect API, follow these steps:

  1. Initiate a POST request to:
  2. Include the header Content-Type: application/x-www-form-urlencoded
  3. Provide the following parameters in the request body:
    • grant_type: client_credentials
    • client_id: YOUR_CLIENT_ID_FROM_STEP_3
    • scope: YOUR_SCOPE_FROM_STEP_7
    • client_secret: YOUR_SECRET_FROM_STEP_9
  4. Send the request and retrieve the access_token from the response.
cURL (stage)
curl -X POST https://connect.identity.stagaws.visma.com/connect/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&scope=machine-learning-factory-api-stage:td&client_secret=YOUR_SECRET"

Replace YOUR_CLIENT_ID and YOUR_SECRET.

cURL (prod)
curl -X POST https://connect.visma.com/connect/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&scope=machine-learning-factory-api-prod:td&client_secret=YOUR_SECRET"

Replace YOUR_CLIENT_ID and YOUR_SECRET.

Use the Access Token in API requests

Include the Authorization header with the Bearer YOUR_ACCESS_TOKEN for all your requests to the TimeDetect API.

The base url for the Production environment is https://api.machine-learning-factory.visma.com/td and the for the Stage environment is https://api.machine-learning-factory.stage.visma.com/td. The API integration scope for the TimeDetect API is td. This is needed when requesting access to the API.

You are now ready to make requests to the TimeDetect API! 🎉

Further Reading

  • For more information about Visma Connect OAuth 2.0 Bearer Token Authentication, we refer to the Visma Connect Confluence.