apps/wbflex/documents/{id}/fields
This method provides information on languages and data fields available with a Flex document. The method will return:
Source language and all available target languages with language code and name.
List of available custom fields, including segment-level and language-level fields.
Last modification date fields, one per language.
And others.
Why would you need to call this method? In most cases you definitely do not need to! For example, when you enumerate a Flex document you already do get the information about languages. What the present method gives you in addition definitely is all the custom fields. This may be useful if you intend to read or write custom fields.
URL
(GET) /api/apps/wbflex/documents/{id}/fields
PARAMETERS
URL parameters are:
id | Specify either a document ID (such as 1000) or a job ID (such as c300). | string, Mandatory |
RESULTS
The result is a JSON array. Each element represents a data-field and comes with these properties:
id | A unique identifier of the data-field. Examples,
See detailed description further down. | string |
title | The title of the field. Such as “English”. With custom fields, this is the name of the custom field. | string |
category | The field category. See chapter apps/wbflex/documents/{id}/fields | FIELDS CATEGORIES | string |
locale | If the field refers to a specific language then this contains the language code. Otherwise it is null. | string? |
qualifier | Any additional information identifying the field. For example, with custom fields this contains the sequential number of the custom field. | string? |
readonly | If true, then this field can only be pulled but not pushed into a Flex container (updating is not possible). | bool |
EXAMPLES
Show flex document properties for document with ID equals 300:
(GET) /apps/wbflex/documents/300/fields
Results are:
[
{ "id": "loc-en", "title": "English", "category": "loc", "locale": "en", "qualifier": null },
{ "id": "loc-fr", "title": "Frensh", "category": "loc", "locale": "fr", "qualifier": null },
{ "id": "loc-es", "title": "Spanish", "category": "loc", "locale": "es", "qualifier": null },
{ "id": "cf-2", "title": "My segment level field", "category": "cf", "locale": null, "qualifier": "1" },
{ "id": "cf-3-fr", "title": "My language specific field", "category": "cf", "locale": "fr", "qualifier": "1" },
{ "id": "date", "title": "Last change", "category": "mod", "locale": null, "qualifier": null },
{ "id": "date-en", "title": "Last change English", "category": "mod", "locale": "en", "qualifier": null },
{ "id": "date-fr", "title": "Last change French", "category": "mod", "locale": "fr", "qualifier": null },
{ "id": "maxlength", "title": "Maximum chars", "category": "maxlength", "locale": null, "qualifier": null },
{ "id": "minlength", "title": "Minimumchars", "category": "minlength", "locale": null, "qualifier": null },
]
FIELD CATEGORIES
The category property can be any of:
loc | The source text or the translated text. Property locale specifies the language code of the text. |
cf | A custom field. Check for locale to see if the custom field is attached to a specific language or to the segment as a whole. Also check qualifier to get the sequential number of the custom field. |
mod | The last modification date of a language (locale is specified) or the segment (locale is null). |
maxlength | Length constraint for translation. Defines the maximum allowed characters. Note that this field is not language dependent. |
minlength | Length constraint for translation. Defines the minimum allowed characters. Note that this field is not language dependent. |
key | The segment key. |
To understand how to get the actual data for the above fields please read the documentation on pulling data: apps/wbflex/documents/{id}/contents/pull
Copyright Wordbee - Buzzin' Outside the Box since 2008