Finding documents / Flex
The methods below permit to find Flex documents by various filter criteria: Find all Flex documents, Find Flex documents changed since a given date/time, Find documents by name, ID etc. and so on. See examples below. If user credentials are worker level (and not manager level), the user can only access Flex documents in Wordbee that have a job assigned to that user. Managers can see all flex documents.
For the full API documentation, see:
List all flex documents
To list all flex documents to which user has access:
(POST) /api/apps/wbflex/list
The result contains an array with the flex documents. The most important properties are:
- id: This is the ID you need to pass to all the other Flex API methods. It is a string such as "2234" or "c7787" (the flex document is related to a Codyt job of the user).
dtchange: Last date/time when the content of the flex file changed. For example, when translation was edited or a meta data modified.
- name: The flex document name.
- src: The source language code
- srct: The source language title
- paragraphs: Total strings in the container. "segments" may be more if the system splits strings.
- pid: The project ID
- preference: The project reference.
{
"total": 4,
"count": 4,
"rows": [
{
"id": "9371",
"dtchange": "2019-06-15T13:45:30.0000000Z",
"did": 9371,
"jid": null,
"src": "en",
"srct": "English",
"name": "folder\\mysoftware.wbflex",
"paragraphs": 2002,
"segments": 2002,
"pid": 3263,
"connector": null,
"preference": "Software Translation Project"
}
....
}
Please look at the detailed method documentation to see how pagination works.
Find flex documents by project reference
Include a query string in the request body. Set content type to "application/json":
(POST) /api/apps/wbflex/list
Include the following string in the request body.
{ "query": "{preference}.Matches(\"Project-1123\")" }
The query language is very powerful and lets you filter on most properties: Query language
Find flex documents changed after a date
Include a query string in the request body.
(POST) /api/apps/wbflex/list
Include the following string in the request body. Set content type to "application/json"
{ "query": "{dtchange}.Matches(\"2018-10-25 22:30:00\"), \">=\")" }
The query language is very powerful and lets you filter on most properties: Query language
List all projects with number of flex documents (aggregation 1)
Use the aggregation feature of lists. We aggregate data by project reference.
(POST) /api/apps/wbflex/list/aggregations/projects
The result is:
{
"total": 4,
"buckets": [
{
"value": 123,
"title": "Software project 1",
"css": null,
"query": null,
"count": 1
},
{
"value": 287,
"title": "Software project 2",
"css": null,
"query": null,
"count": 3
}
],
"properties": {
"id": "projects",
"name": "Flex projects",
"desc": "Shows list of Wordbee projects with both project ID and Reference."
}
}
You only need to know these properties in the list:
- value: The project ID ("pid" property in the projects list)
- title: The project reference
- count: Number of flex documents in this project
List all projects with number of flex documents (aggregation 2)
Use the aggregation feature of lists. We aggregate data by project reference. Contrary to the above aggregation, we do not include the project ID with the results.
(POST) /api/apps/wbflex/list/aggregations/preference
The result is:
{
"total": 4,
"buckets": [
{
"value": "Software project 1",
"title": "Software project 1",
"css": null,
"query": null,
"count": 1
},
{
"value": "Software project 2",
"title": "Software project 2",
"css": null,
"query": null,
"count": 3
}
],
"properties": {
"id": "preference",
"name": "Flex projects",
"desc": "Shows list of Wordbee projects with number of contained flex documents."
}
}
You only need to know these properties in the list:
- value: The project reference (same as title)
- count: Number of flex documents in this project
Access rights
See Which access rights are required by API users?