Trimble.Entitlements.Licenses
title: “trimble.entitlements.licenses” description: “trimble.entitlements.licenses Namespace” lead: "" date: 2023-06-12T13:46:25-06:00 lastmod: 2023-06-12T13:46:25-06:00 draft: false images: [] menu: docs: parent: “rego-api” weight: 342 toc: true
Namespace Reference
Definition
Provides a function to get licenses for a user from the Trimble Entitlement Management System (EMS).
trimble.entitlements.licenses.get
trimble.entitlements.licenses.get(environment, token, accountId)Parameters
environment string
The EMS environment to target. This value must be either "stage" or "prod".
token string
The access token used to authenticate the request. This is typically the user’s JSON Web Token acquired from Trimble Identity.
accountId string
The account ID of the user for which the license validation is to be performed.
Returns
A Rego array containing all licenses for the user. See the Trimble Entitlement Services API reference for more information about the members for each item in the array.
Remarks
Token
The token argument must be a valid JWT. In most cases, we recommend using the existing methods to inject tokens as part of the request to the appliance decision endpoint (see Input query format). The appliance validates all tokens that are injected via the POST request.
For example, specifying bearer authentication for the auth member of the POST request body of the decision API will allow you to access the token in Rego as input.caller_auth.jwt. The JWT used to authenticate the request to the appliance is also accessible via input.appliance_auth.jwt.
Errors
This built-in exits immediately if any errors are encountered during policy evaluation and returns a 500 status with error details from the appliance decision endpoint. These errors include:
- Any non-2xx or invalid response from EMS. This built-in expects the response from EMS to contain a 2xx status code and a valid JSON body that contains paginated results.
- Invalid Rego arguments.
Endpoints
The following base URLs are used for obtaining user licenses from EMS:
| Environment | URL |
|---|---|
stage | https://cloud.stage.api.trimblecloud.com/cloud/ems-v4/4.1/entitlements/licenses |
prod | https://cloud.api.trimble.com/cloud/ems-v4/4.1/entitlements/licenses |
Caching
You can specify caching directives for data obtained from EMS during package registration. No data is cached by default unless cache durations for the URLs above are specified during package registration.