Note |
---|
This method will be available mid-February 2025. |
Use to upload a file and synchronize contents with a Flex container. The synchronization is two-way:
First, changes from the file can be optionally be pushed into the Flex container.
Second, the file contents is updated with the latest translations from the Flex container.
The result is your updated file.the uploaded file with updates, if any, from the Flex container.
NOTE: This method is designed for multilingual files only. Such as Excel, CSV, POT, XLIFF and others.
URL
Code Block |
---|
(POST) /api/apps/wbflex/documents/{id}/contents/sync |
...
The BODY must be a JSON object with these properties:
enabled
Specifies if content shall be synchronized into the Flex container or not.
file | A JSON object with the reference to the uploaded file, the parser configuration for content extraction and more. Please see a full list of properties here: Pushing content - "files" property . The file must be uploaded using media/upload to obtain a Example:
| object, Mandatory | push |
Code Block |
---|
"push": {
"enabled": true
} |
bool, Optional
The push
node has these properties:
pushMode | Optional, default is This field specifies how content is synchronized from the uploaded file to the Flex container. In many scenarios you want to sync source text changes from the file to Flex and translation changes from Flex back into the file. The options are:
| string, Optional |
isPreviewMode | Optional boolean, default is false. If true then the system simulates the update and returns all the details but it will not actually update the Flex container. | bool, Optional |
locales
The list of locales to push.
IMPORTANT: If null or not specified, then the system pushes source texts only (and skips translations)skipStatusError | Optional boolean, default is false. If true, then any texts with status in red color will not be pulled from the Flex container into the uploaded file. | bool, Optional |
timestamp
Optional date/time.
If specified, then the system will only update source texts or translations if those were last modified prior to this date.
The use case is to prevent erasing changes in the Flex container that are more recent than the changes in the file.
datetime, Optional
RESULTS
...
callback | Specify a URL which will be called upon success or failure of operation. This makes polling for operation status unnecessary. See Callbacks (with asynchronous operations) | object, Optional |
RESULTS
The operation may take more or less time depending on the amount of data to push. Therefore it is implemented as an asynchronous operation. The API method returns an Asynchronous operation result:
Code Block |
---|
{
"trm": {
"requestid":32230,
"status":"Waiting",
"statusText":"Waiting..."
}
} |
Specify the callback in the payload if you can process those. Otherwise and until the operation is not completed (status = Finished), you need to poll every few seconds until completion with requestid. When finished you obtain the results as a JSON:
Code Block |
---|
{
"trm": { ... }
"custom": {
"filetoken": "0b90f03b423b44dfbbea6969e9595f01",
"updatedSegments": 5,
"result": {
"type": "Push",
"transaction": "2a0968cc-b234-4a35-9718-9a9c9aedcc1f",
...
}
}
} |
The important fields are in the custom
node. It has these properties:
filetoken | Use to download the updated / synchronized file using media/get/{token} . This is the original file you uploaded with any updates on source text or translations pulled from the Flex container. | string |
updatedSegments | The total number of segments updated in the file. | bool |
result | Full details on the content pushed from the uploaded file to the Flex container. The information is described on this page (see the Results section and the It contains information on the segments, texts and meta-data updated in the Flex container. As well as many more details. | object |