Skip to main content

apps/wbflex/documents/{id}/components/status

This method retrieves a list of components that are fully translated in one or more languages since a specified date/time.

The method makes it easy to retrieve or deliver translations by component and language. Rather than pulling partially translated components you can now pull only full translated components.

Use cases:

  • Get fully completed components individually by language. For example, French is finished now but maybe Spanish is not yet.

  • Get fully bookmarked components individually by language. This is useful if your workflow requires bookmarks to be set to flag “ready for delivery” (rather than resetting the segment translation status).

URL

CODE
(POST) /api/apps/wbflex/documents/{id}/components/status

PARAMETERS

URL Parameters

The URL parameters are:

id

Specify either a document ID (such as 1000) or a job ID (such as c300).

string, Mandatory

Body

The body must contain a JSON object with optional filters.

All filter options are optional. If you do not specify a filter you will receive every single component appearing in the document.

If you specify filters then you will receive the components of the filtered segments.

changed

Mandatory date.

The method filters components and languages where any segment in the language was modified at or after this date. For example you will then receive all components and translations that are newly completed since recently.

Note: The date must be at maximum 7 days into the past.

Example:

CODE
{
  "changed": "2021-10-01T00:00:00Z"
}

datetime, Mandatory

metric

Identifies which languages in a component shall be returned. The options are:

  • StatusNoneOk : Translations in a component must all be in status “gray” or “green” (and none in “red”). Permits to select components that are fully translated.

  • StatusOk : Translations in component must all be in “green” status. Permits to select components that are fully translated and flagged “green”.

  • BookmarkBlue : Translations must all be bookmarked with the blue color. If your workflow requires that translators or revisers flag completely finished translations with a bookmark then this is the way to go.

If not specified then StatusNotOk is used.

Example: Select those components and languages where translation were finished between changed and now:

CODE
{
  "metric": "StatusNoneOk"
}

string?, Optional

invert

When false (default), the metric operates as described above.

If true then the method returns the languages that do not satisfy the metric requirement.

Example: Select those components and languages that were edited since changed but remain unfinished:

CODE
{
  "metric": "StatusNoneOk",
  "invert": true
}

bool?, Optional

locales

Optional list of locales. If not specified, the system uses all Flex document target languages.

With this property you can restrict the results to a subset of languages. The list can also contain the source language.

Example:

CODE
"status": [ "fr", "de" ]

string[]?, Optional

components

Optional list of component IDs. By default this is null. If specified, the method will only dig into these components.

Example to filter translations bookmarked in either gray or blue:

CODE
"components": [ "frontend.module1", "backend.sql", "backend.classes" ]

Note: You can specify up to 500 elements.

string[]?, Optional

component

Optional filter on components using a prefix, suffix, infix, wildcard or regex pattern.

See String filter (Filter) for details.

Example to filter all components starting with “frontend.”. It captures “frontend.ux”, “frontend.page1.js” etc.

CODE
"component": { "value": "frontend.", "mode": "Prefix" ]

object?, Optional

callbackurl, 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)

Optional

RESULTS

Wait for results

The API method returns an Asynchronous operation result:

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


You can poll the status or use the callback parameter. When the operation is complete, the results are in the custom property

CODE
{
    "trm": {
        "requestid": 32230,
        "isbatch": false,
        "status": "Finished",
        "statusText": "Finished!"
    },
    "custom": {
       "filetoken": "9ccc2599ac5a4cf99cf7875639ab72c9",
       "components": 2
    }
}


The components is the total number of filtered components. To download the actual results (list of components) pass the filetoken to this method:media/get/{token} :

CODE
(GET) /api/media/get/9ccc2599ac5a4cf99cf7875639ab72c9

Obtaining results

As described above, you use media/get/{token} to download the final results.

These are a JSON array with the list of filtered components. Each element has these properties:

  • k : The component ID.

  • s : Total segments in this component.

  • l : List of locales that satisfy the selected metric.

Note: We count the segments as they appear in the translation editor. For example, a Flex segment may be split into multiple segments in Wordbee to ease translation.

Example: We see 1 component that was translated into German and French and 1 component that was translated into German since the last week (if you set the changed-date to a week ago).

CODE
[
    {
        "k": "software.interface",
        "s": 23,
        "l": {
            "de": 23,
            "fr": 23
        }
    },
    {
        "k": "software.library",
        "s": 102,
        "l": {
            "de": 102
        }
    }
]

Pulling the segment details

Once you identified completed components / languages, you can download these.

Use apps/wbflex/documents/{id}/contents/pull and simply populate the components property.

EXAMPLES

Find components and languages that were completed since 24 hours and I can deliver back to my client

The API call would be:

CODE
(POST) /api/apps/wbflex/documents/{id}/components/status
BODY:
{
  "metric": "StatusNoneOk",
  "changed": "2021-10-01T00:00:00Z"
}

Find components and languages that were modified since 24 hours but are still not complete

The API call would be:

CODE
(POST) /api/apps/wbflex/documents/{id}/components/status
BODY:
{
  "metric": "StatusNoneOk",
  "invert": true,
  "changed": "2021-10-01T00:00:00Z"
}

JavaScript errors detected

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

If this problem persists, please contact our support.