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 Engagement, Knowledge Center Bot, and Article that are ready for translation and import the translated XLIFF file from the localization platform to the Engagement, Knowledge Center Bot, and Article.
Import XLIFF API
This API allows you to import XLIFF content for translations of Engagements, Knowledge Center Bot, and Articles from your localization platform.
Request Method: Post
Path:
Type |
Endpoint |
Engagement |
v1/localization/import/engagements |
Knowledge Center Bot |
v1/localization/import/kcbot |
Articles |
v1/localization/import/articles |
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
Using the export XLIFF APIs, you can now download the blank template, or the translated XLIFF files for Knowledge Center and Articles.
IMPORTANT: This is applicable only when the values of version and strategy of import and export remain the same.
Request Method: Get
Path:
Type |
Endpoint |
Engagement |
v1/localization/export/engagements |
Knowledge Center Bot |
v1/localization/export/kcbot |
Articles |
v1/localization/export/articles |
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
version | File | false | 2.0 | The XLIFF version to be exported (default 2.0) |
trgLang | string | true | Language codes | Target language to be included in XLIFF |
strategy | string | false | html/contexual |
|
engagementId/ articleId/ <Need to add> |
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.