Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This method permits to update segments. In a typical editing environment, you would use resources/segments/search to retrieve segments, apply changes and submit those changes with the present method. Some of the properties here require you to understand concepts explained in the search API. 

URL

(PUT) /api/resources/segments/view/update

PARAMETERS

The message body contains a JSON object with these properties.

scope

The scope object. It delimits the total range of segments and related resources that can be queried.

Example:

"scope": { "type": "Project", "projectid": 1234 }
Mandatory, object
layout

Optional layout object. The layout is required when updating language level content such as source text or translation text.

If not specified, the system expects that update operations are for the scope's source and first target language. This may not be what is expected. It is strongly recommended to explicitly set this object with the language(s) to be updated.

Example for updating French and English content. The index is assigned starting from 0 and will be referenced in the updates node below. Property ftype defines the type of column, value 1 refers to the text content.

"layout": {
		"columns": [
			{ "index": 0, "ftype": 1, "loc": "fr" },
			{ "index": 1, "ftype": 1, "loc": "en-US" }
		]
	}

When updating language custom fields or labels, to attach comments to a language, etc. then you will need to add more columns to target those properties. Please see  layout object for more information.

Segment level fields including segment custom fields, do not require column definitions.


Optional, object?
updates

An array with update instructions.

Example to update the English (United States) translation. The "_1" property key refers to the layout column with index = 1, prefixed with an underscore character. The sid property is the segment ID.

"updates": [
		{
			"sid": 21567228,
			"cols": {
				"_1": { "txt": { "val": "My new translation" } }
			}
		}
	]

Example for updating translation and setting the status to OK (green) - see resources/segments/search to learn more on the different fields and values.

Example for updating multiple segments, source texts, translations and status:

"updates": [
		{
			"sid": 21567228,
			"cols": {
				"_1": { "txt": { "val": "Please click here", "st": 1 } }
			}
		},
		{
			"sid": 21567240,
			"cols": {
				"_0": { "txt": { "val": "Öffne den Dialog" } }
				"_1": { "txt": { "val": "Open the dialog", "st": 1 } }
			}
		}
	]

Optional,

string




Auto propagation All parameters are optional unless you want to enable auto-propagation.Optional
autoPropagate

Optional, default is false. Set to true to activate auto-propagation.

Set to false only if there is a possibility that user access rights have changed. False enforces the system to recalculate all access rights for the specified scope.


Optional, bool?
localeSourceMust be set if auto propagation is enabled. Specifies the language in which to look for identicals.string, Optional
localeTargetMust be set if auto propagation is enabled. Specifies the target language that shall be updated with auto propagated translations.string, Optional
targetDocumentIdOptional, document that shall be affected by auto-propagate. If not specified, propagation applies to full scope.int?, Optional
propagateTo

excludePropagationToStatus

RESULTS

The method returns the details of the updated segments (with the language details specified in the layout).

Each element has these properties:

result.rowsArray of the updated segments. See this page for details: Segment Details (Object)object[]
result.docsDetails of the documents that are referenced by result.rows. This contains the same information as sent back by resources/segments/search (check this page for details)object[]
results.usersDetails of the users that are referenced by result.rows. This contains the same information as sent back by resources/segments/search (check this page for details)object[]

EXAMPLES

We submit this update:

PUT /api/resources/segments/view/update
BODY:
{
	"layout": {
		"columns": [
			{ "index": 0, "ftype": 1, "fqualifier": 0, "loc": "fr" },
			{ "index": 1, "ftype": 1, "fqualifier": 0, "loc": "en-US" }
		]
	},
	"scope": {
		"type": "Project",
		"projectid": 6632
	},
	"updates": [
		{
			"sid": 21567228,
			"cols": {
				"_0": {
					"txt": {
						"val": "Nouvelle traduction"
					}
				}
			}
		}
	]
}

And get this result back:

{
	"result": {
		"rows": [
			{
				"no": "2",
				"ts": "2020-04-17T09:18:23.4389404Z",
				"sid": 21567229,
				"did": 36250,
				"dsid": 7719,
				"cty": 1,
				"sdid": 1,
				"bsid": 2,
				"bssid": 0,
				"edit": true,
				"tags": null,
				"tmx": [],
				"split": true,
				"ctx": "ListParagraph",
				"ctx_edit": true,
				"chmin": null,
				"chmax": null,
				"ch_edit": true,
				"lbls": [],
				"lbls_edit": true,
				"cfs": [],
				"cfs_edit": true,
				"tbx": [],
				"_changed": true,
				"cols": {
					"_0": {
						"column": 0,
						"txt": {
							"val": "Nouvelle traduction",
							"st": 0,
							"bk": 0,
							"tsk": null,
							"loc": "fr",
							"cmc": 0,
							"ed": 1,
							"rep": 0,
							"usid": 2,
							"usdt": "2020-04-17T09:18:23.4389404Z",
							"hh": false,
							"sim": 0,
							"err": null,
							"lck": false,
							"lck_edit": true,
							"hn": null,
							"hp": null,
							"cfs": [],
							"cfs_edit": true,
							"lbls": [],
							"lbls_edit": true,
							"usfid": null,
							"usfdt": null,
							"tbx": [],
							"sent": null,
							"sentdt": null,
							"tmx": []
						},
						"txt_edit": true
					},
					"_1": {
						"column": 1,
						"txt": {
							"val": "New translation",
							"st": 0,
							"bk": 0,
							"tsk": null,
							"loc": "en-US",
							"cmc": 0,
							"ed": 0,
							"rep": 0,
							"usid": null,
							"usdt": "2020-04-14T12:34:32.2196478Z",
							"hh": false,
							"sim": 0,
							"err": null,
							"lck": false,
							"lck_edit": true,
							"hn": 1681133032,
							"hp": -126583649,
							"cfs": [],
							"cfs_edit": true,
							"lbls": [],
							"lbls_edit": true,
							"usfid": null,
							"usfdt": null,
							"tbx": [],
							"sent": null,
							"sentdt": null,
							"tmx": []
						},
						"txt_edit": true
					}
				}
			}
		],
		"docs": {
			"_36250": {
				"did": 36250,
				"dsid": 7719,
				"name": "english.docx",
				"pmax": null,
				"pmin": null,
				"ptype": 4,
				"pdomain": "MSWORD",
				"previewapp": null,
				"previewurl": null,
				"previewtf": null,
				"edit": true
			}
		},
		"users": {
			"_2": {
				"id": 2,
				"nm": "Internal Translator A",
				"cid": 2,
				"cnm": "My LSP"
			}
		}
	}
}

  • No labels