Work with Import and Export XLIFF APIs
This article explains how you can import and export XLIFF files using APIs.
Overview
Import and Export XLIFF API allows you to export the XLIFF template for engagements that are ready for translation and import the translated XLIFF file from the localization platform to the engagement.
Import XLIFF API
This API allows you to import XLIFF content for translations of engagements from your localization platform.
Request Method: Post
Path: v1/localization/import
Parameters:
Name | Type | Required | Description |
---|---|---|---|
file | File | true | the XLIFF file |
Response Structure:
- 201 - Created
- 432 - XLIFF parsing error
- 433 - Engagement id not found in XLIFF file
- 434 - Target language is not part of subscription's allowed languages
- 437 - Strategy is not valid
- 438 - XLIFF version is not supported
Example:
curl --location --request POST 'https://api.aptrinsic.com/v1/localization/import' \ --header 'X-APTRINSIC-API-KEY: xxxxxxxxxx-xxxx-xxxx-xxxxxxxx' \ --header 'Content-Type: multipart/form-data; boundary=BOUNDARY' \ --form 'file=@"en_sp.xliff"'
Note: You can also upload translated files to an active engagement in a non production environment using the Import API.
Export XLIFF API
This is an API for getting the XLIFF template for engagements that are ready for translation. View the import XLIFF content for translations when you export an XLIFF file using Export XLIFF API.
IMPORTANT: This is applicable only when the values of version and strategy of import and export remain the same.
Request Method: Get
Path: /v1/localization/export
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
version | File | false | 2.0 | The XLIFF version to be exported (default 2.0) |
trgLang | string | false | Language codes | Target language to be included in XLIFF |
strategy | string | false | html/contexual |
|
engagementId | string | false | Only specific ID filter | |
productKey | string | false |
Corresponding product key of the subscription |
|
env | string | false | prod | int, QA, stage, prod |
metadata | boolean | false | false | Indicates returning metadata only, without the engagement content. |
If the export operation is successful, the endpoint returns a zip file containing .xlf files as a binary stream (Content-Type: application/octet-stream). If the operation fails, it returns one of the following errors.
Response Error Status Codes:
- 435 - Engagement is not found
- 436 - Engagement has no content
- 437 - Strategy is not valid
- 438 - XLIFF version is not supported
Note: You can download an uploaded XLIFF file using Export API. This provides you with a translated file that lets you edit content easily.
IMPORTANT: This is applicable only when the values of version and strategy of import and export XLIFF files remain the same.