Connecting to the Event Service
Event publishers and consumers connect to the Event Service using TID application credentials, or “applications”. Applications can be created using the Cloud Console UI.
Create an application using the Cloud Console
The Cloud Console{:target=“_blank”} is available to all of Trimble, and uses two types of applications:
-
production
-
pre-production
Production applications exist in TID prod, while pre-production applications exist within TID stage. A production application can only be used to subscribe (or publish to) a production level event topic, while a pre-prod application can subscribe to any event topic. Event topics are not viewable on the Cloud Console but you can view a List of Available Events{:target=“_blank”} here on the docs site, and Create a Subscription via support ticket.
Get an access token
To connect to Trimble Event Service, you need to request an access token by way of an API request.
Include a Trimble Identity OAuth authentication token in the API request header. A valid token is required. If a token is expired, you will not be able to connect to Event Service. Ensure you are sending the correct, active token with your API calls. To fetch the client ID and secret of your application, see Set up an application in Cloud Console.
To generate access token:
-
Apply Base64-encoding to the application’s consumer key and consumer secret.
ClientID:ClientSecret -
To get an access token, use one of these API endpoints:
POST `https://stage.id.trimblecloud.com/oauth/token`—- OR —-POST `https://id.trimble.com/oauth/token` -
In the header include:
Key: AuthorizationValue: Basic<Base64 encoded “ClientID:ClientSecret">Content-Type: application/x-www-form-urlencoded
-
In the body include:
grant_type=client_credentials&scope=APPLICATION_NAME -
Example curl
curl --location --request POST 'https://id.trimble.com/oauth/token' \--header 'Authorization: Basic (Base64 encoded ClientID:ClientSecret)' \--header 'Content-Type: application/x-www-form-urlencoded' \--data-raw 'grant_type=client_credentials&scope=test'