Smartcat API usage examples

Sending files for translation

In order to send documents for translation in SmartCAT, you must create a project and then upload the desired files to that project. Projects are created using the method:

POST: /api/integration/v1/project/create

Files can be uploaded either in the same request that creates the project or separately, using the method:

POST: /api/integration/v1/project/document

Obtaining the status of a translation

The status of a project can be determined using the method:

GET: /api/integration/v1/project/{projectId} 

This method returns the complete project model, including a list of all the documents with status information and translation progress in each phase. The status of a specific document can be determined using the method:

GET: /api/integration/v1/document 

This method returns information on a specific document, including status and translation progress.

You can also set up change notification callbacks for changes in project or document status using the method:

POST: /api/integration/v1/callback

This method specifies the URL to which SmartCAT will send status change notifications for your projects and/or documents. 

Status change notifications for your projects and/or documents will be received at the address <your_URL>/project/status. The query report will include a list of project identifiers for which the project status changed. Sample query:

POST /api/callback/project/status HTTP/1.1
Host: example.local
Content-Type: application/json
["1e2d703f-9def-4d27-ab4d-350cbbe8c44b", "b5bf9123-31b3-4e45-9ee9-8c14d15a4145"]

You can obtain complete project information using these identifiers.

Similarly, notification of document status changes can be delivered to the address <your_URL>/document/status, e.g.:

POST /api/callback/document/status HTTP/1.1
Host: example.local
Content-Type: application/json
["189_25", "310_25"]

Downloading the completed translation

The completed translation can be downloaded using the method

POST: /api/integration/v1/document/export

after providing a list of identifiers for the documents required.

This method requests assembly of the translation for the documents specified, and returns the task identifier for the assembly task.

You can then use the method

GET: /api/integration/v1/document/export/{taskId}

to check the task status and receive the completed file.

How to Update an Existing FIle

A new version of a file already translated or for which translation is currently in progress can be uploaded using the method

PUT: /api/integration/v1/document/update

After the file is updated, all changed or added segments will be tagged for translation. The remaining segments will be left unchanged.

Creating an assignment

To assign a specific language specialist or a few for a document, use the method

POST: /api/integration/v1/document/assign

This method allows one or more language specialists to be assigned from your account or from the SmartCAT database.

Was this article helpful?