Skip to main content

Propagate changes to many segments

This method propagates translations of one or more segments to other branches. Identify the segments by their branch and either a list of keys or a query instruction.

The way propagation works depends on the custom script configured for your platform by the Wordbee Solutions team. Propagation is usually initiated on demand from the Editor.

URL

CODE
(POST) /api/apps/wbflex/documents/{id}/branches/propagate

PARAMETERS

The URL parameters are:

id

Specify the Flex container ID

string, Mandatory

The BODY must be a JSON object with these properties:

query

Optional segments filter. Either specify keys+branch or query to select the segments to propagate.

Specify this property if you want to select the segments to propagate with a filter. See resources/segments/search and check out the documentation for the query property.

object, Optional

keys

Optional list of keys. Either specify keys+branch or query to select the segments to propagate.

Specify this property if you want to specify the segments to propagate by their keys.

string[], Optional

branch

The branch of the segments. Must be set in conjunction with keys.

string?, Optional

locales

Optional list of target locales. If not specified, the system will propagate all translations, otherwise just the locales specified.

string[], Optional

event

Optional. Specifies the type of propagation:

  • TranslationUpdated : The default. Will run the script to propagate translation changes.

  • SourceUpdated : Will run the script to propagate source text changes.

string?, Optional

maxSegments

To optionally delimit the maximum number of segments to propagate. A hard limit of 100.000 applies.

int?, Optional

preview

Optional preview mode, default is false.

If true, then any changes will not be saved back. The method will still return statistics for the changes but without saving them at the end.

bool, Optional

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 is asynchronous and may take a few seconds to complete. The method returns an Asynchronous operation result:

CODE
{
  "trm": {
    "requestid":32230,
    "status":"Waiting",
    "statusText":"Waiting..."
  }
}

Specify the callback in the payload to be automatically notified of completion. Otherwise you need to poll the operation for completion (until status = “Finished”). When finished (or via the callback) you obtain the results as a JSON:

CODE
{
    "trm": { ... }
    "custom": {
        "filteredSegments": 100,
        "changedSegments": 23,
        "changedTexts": 23,
        "changedTextsByLocale": { "fr": 20, "es": 3 },
        "savedSegments": 23
    }
}

The result provides an indication of how many segments were updated by the script.

  • filteredSegments: Total segments selected (see keys and query parameters).

  • changedSegments: The number of segments that were modified, typically in other branches if a change occurred.

  • changedTexts: The number of texts (values or metadata) that were affected by changes to the segments.

  • savedSegments: The number of segments actually saved. This should be identical to changedSegments.

 

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.