resources/segments/view/actions/batch
Provides a wide range of tools to update one or more filtered segments in batch. The batch operations include: Change text, Find & Replace, Change status and bookmarks, Pre-translate from memories etc.
URL
(POST) /resources/segments/view/actions/batch
PARAMETERS
The parameters are a JSON object included in the request body:
scope | The scope object. The segment must be within the scope. NOTE: This method does not support the Global Search scope. | Mandatory |
query | An optional query object. This allows to delimit the operation to a subset of the scope's segments. | Mandatory |
layout | The editor grid layout. Only fields included in the layout can be updated by the batch operations. If not set then a default layout will be created that covers only a minimal set of columns (typically source and target text). | Optional |
actions | A JSON object describing the actions to apply. See below. | Optional |
doSave | Optional, default is true. True: Changes are saved. False: Changes are not saved. The latter permits to obtain statistics about what data the operation will update without actually updating. | Optional |
The actions property is an object configuring the actual actions to apply:
actions | An array with one or more actions to apply. The structure of each element is described below. The action type is contained in property type. See the following links for details on each action type:
| Mandatory |
onChangeBookmark | Optional. When a segment text or a property of the text is updated by an operation then optionally update the bookmark value as follows:
| Optional |
onChangeStatus | Optional. When a segment text or a property of the text is updated by an operation then optionally update the status of the text as follows:
| |
Search filtering and sorting Not yet released. | ||
ctxboost | Optional. Specifies to what extent a matching context promotes a hit in the search results (you need to also set the ctx property).
With this setting you can give additional boost to hits that have the same context value as the segment being searched. The context of a segment typically contains formatting information such as "Heading 1", "Hyperlink" etc. or, when localizing software, string IDs or keys. Specifically with software localization this setting should be increased. | Optional, int? |
filter | Optional array of filters on various properties such as status, bookmarks, context, change date and so on. See chapter further down. | Optional object[]? |
Advanced filter and sort options
The tmoptions property is an optional JSON object with these properties:
Search filtering and sorting Not yet released. | ||
ctxboost | Optional. Specifies to what extent a matching context promotes a hit in the search results (you need to also set the ctx property).
With this setting you can give additional boost to hits that have the same context value as the segment being searched. The context of a segment typically contains formatting information such as "Heading 1", "Hyperlink" etc. or, when localizing software, string IDs or keys. Specifically with software localization this setting should be increased. | Optional, int? |
filters | Optional array of filters on various properties such as status, bookmarks, context, change date and so on. See chapter further down. | Optional object[]? |
RESULTS
A JSON with these properties:
total | The total number of segments processed / looked at. | int |
totalChanged | The total number of segments that were updated. Segments may not be updated if they already have the wanted value or they are read-only or another condition in the action does not apply. | int |
totalFailedToSave | Number of segments that could not be updated. Failure means a technical problem with the saving. This value should be 0 always. | int |
totalIssues | Used by certain actions only, such as Quick Check. This action can be configured to only count the number of problems without applying any changes. These algorithms update totalIssues. Other algorithms do not use this. Null is no action using this property is executed. | int? |
error | Null or an error message if there was a general issue with running the actions (e.g. no action selected at all). | string? |
items | Per each action executed, the statistics:
|
EXAMPLES
This example is obtained when running a bookmark action. The bookmarks of 2 out of 3 segments were updated. One segment was not updated and the reason may be multiple:
- The segment is read-only, for example locked
- The segment already has the wanted bookmark set
{
"total": 3,
"totalChanged": 2,
"totalFailedToSave": 0,
"totalIssues": null,
"error": null,
"items": [
{
"action": "Bookmark",
"total": 3,
"totalChanged": 2,
"totalIssues": null,
"updatedSegments": [],
"error": null
}
]
}
This example shows the result for two actions.
The QuickCheck is an algorithm that also counts the number of issues next to the number of changes if it is configured to not apply tag fixes (for example) but simply count the problems.
{
"total": 3,
"totalChanged": 2,
"totalFailedToSave": 0,
"totalIssues": 2,
"error": null,
"items": [
{
"action": "Bookmark",
"total": 3,
"totalChanged": 1,
"totalIssues": null,
"updatedSegments": [],
"error": null
},
{
"action": "QuickCheck",
"total": 3,
"totalChanged": 0,
"totalIssues": 2,
"updatedSegments": [],
"error": null
}
]
}