3 minute read
Job workflow
Start processing a job
Method: PATCH /providers/{providerId}/jobs/{jobId}
To indicate your connector has started processing this job, use the PATCH job method with the “statusCode” set to “IN_TRANSLATION”.
{
"statusCode": "IN_TRANSLATION"
}
This lets the submitter know the job has been received by the provider, and prevents the job from appearing when querying for new jobs on the next invocation. Depending on TMS, this may be the point where a job or project will be set up on the TMS side.
Get asset tasks
Method: GET /providers/{providerId}/jobs/{jobId}/assetTasks
Next, use this method to query for a list of Asset Tasks under this job. Each asset task includes the following information:
- source and target languages
- file name
- file transfer information
These allow the source content to be retrieved.
Get support assets (Optional)
Method: GET /providers/{providerId}/jobs/{jobId}/supportAssets
The job may include support assets, which are reference material that aids translation work but are not meant to be translated. Like asset tasks, they can be retrieved as files to be included when submitting the source content to TMS.
Start processing each asset task
Method: PATCH /providers/{providerId}/jobs/{jobId}/assetTasks/{assetTaskId}
Indicate your connector has started processing asset tasks. For each asset task, use the PATCH method with “statusCode” set to “IN_TRANSLATION”.
{
"statusCode": "IN_TRANSLATION"
}
Retrieve source file
Method: GET /providers/{providerId}/jobs/{jobId}/assetTasks/{assetTaskId}/sourceFile
This method is used to download the source file of an asset task. Note that the method uses HTTP redirect, by returning a 307 response code. Clients are expected to follow the url in the Location header. Most HTTP client libraries do this automatically or can be enabled by a configuration setting. For example, cURL has a -L option.
Note that it is not uncommon for multiple asset tasks to share the same source fileId, when the same file is used for multiple target languages. Efficient handling of this scenario can reduce the ‘chattiness’ of the integration and improve turnaround time.
Perform translation
Now that the source file and all metadata related to the asset task have been retrieved, the connector can submit the asset task into TMS.
Initiate upload of translated file
Method: POST /providers/{providerId}/jobs/{jobId}/assetTasks/{assetTaskId}/translatedFile
When the source file has been translated, the connector should upload the translated file. This is a 2-step process. The POST method listed is the first step. It returns a FileTransfer object which contains the necessary information for uploading the file to Lionbridge FMS. For more information, please visit the ContentAPI v2 developer page on file transfer.
Set asset task state
Method: PATCH /providers/{providerId}/jobs/{jobId}/assetTasks/{assetTaskId}
Once the translated file has been uploaded, use the PATCH method with:
{
"statusCode": "TRANSLATION_SUBMITTED",
"translatedFileId": "<fmsFileId of the translated file>",
}
This signals the asset task has been translated, and is ready for review by the job submitter.