Setup
Swagger Documentation
The API swagger documentation can be found here.
Authentication
The Lionbridge connectors team should have provided you with the client id and secret pair to access the Lionbridge Provider API staging environment. You may also be provided with an additional pair to access the Content API for generating test jobs for development and testing purposes. In order to authorize REST API calls, a token must be generated using the id and secret credential.
Use the Lionbridge’s identity endpoint and client credential workflow to obtain access token. Please note that the client id and secret that grant you access to the staging environment do not give you access to the production environment. Lionbridge will provide you with new client id and secret to work in production environment.
To obtain access token, send the following POST request to endpoint https://login.lionbridge.com/connect/token
curl --location --request POST 'https://login.lionbridge.com/connect/token' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'grant_type=client_credentials' --data-urlencode 'client_id=xxx' --data-urlencode 'client_secret=XXXXXXXX'
This returns an access token with expiry:
{"access_token":"<encoded token>","expires_in":3600,"token_type":"Bearer","scope":"contentapi.providerv2.staging.default "}
This token has an expiry, typically set to 1 hour (3600s). Once expired, the token is invalid and the user would be required to obtain a new token using the client id and secret. The recommendation for users is to obtain the token, and reuse it during future calls until it expires. This avoids unnecessary exposure of the client secret.
See the Auth0 page on client credential flow for more information about client credential flow.
Disclaimer: Staging environment is NOT meant for production. Data submitted to staging environment may be wiped out without notice.
Create a provider
Use the obtained token to access the API by including it in the header. For example, below is a sample call to create a provider, using cURL:
curl -X 'POST' "https://<api-address>/v2/providers" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer <encoded token>" -d '{
"name": "MyFirstProvider",
"siteId": "ACMECorp"
}'
Here, we are creating a provider with a name and siteId. The name can be set as you see fit. The siteId controls which ContentAPI user(s) can access this provider. In this case, the users belonging to ACMECorp are the ones who can submit jobs to this provider. When your provider connector is ready for integration, Lionbridge connectors team will provide you the siteId’s to establish the required routing between you and ContentAPI users.
The response shows the created provider,
{
"name": "MyFirstProvider",
"siteId": "ACMECorp",
"id": "SmKgdqRCRwGHsMHuiyTzGA",
"creatorId": "<uuid>"
}