- URL:
- https://<root>/services/<serviceName>/sharedTemplates/update
- Methods:
POST
- Required Capability:
- SharedTemplateEditing capability enabled on the service
- Version Introduced:
- 11.4
Description
The update
operation modifies existing shared templates in the back-end data source. Only template owners, or organization administrators, can update a shared template. Once a template has been updated, clients will be able to access the templates with the new values. Support for this operation is indicated when the service's supports
property is set as true
and the service has the Shared
capability enabled.
Request parameters
Parameter | Details |
---|---|
(Required) | An array of shared templates to be updated. The array should only contain the fields that will be updated, as well as their modified values. Fields not specified in the array will remain unchanged. The Syntax
Example
|
| The response format. The default format is Values: |
Example usage
The following is a sample POST request for the update
operation that demonstrates updating two feature templates. The first updates the template's name
and description
fields. The second updates the other template's name
, description
, visible
, and status
fields, as well as resetting the definition
.
POST /webadaptor/rest/services/MyService/FeatureServer/sharedTemplates/update HTTP/1/1
Host: machine.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []
sharedTemplates=[{"globalId": "{4521FC4A-293D-4457-A7D4-9D6496DFA377}","name": "PS- point tool NEW","description": "multiple updates in payload"},{"globalId": "{143B038A-EA78-4E81-BAA3-A1060431F493}","name": "test Anno template","description": "multiple updates in payload","visible": false,"status": "private","definition": {"defaultValues": {"Angle": 0,"AnnotationClassID": 1,"CharacterSpacing": 10,"CharacterWidth": 100,"Element": "","FlipAngle": 90,"FontLeading": 0,"FontName": "Constantia","FontSize": 8,"FontStyle": "Bold Italic","HorizontalAlignment": 0,"Override": 0,"Status": 0,"SymbolID": 1,"TextString": "Left","Underline": 0,"VerticalAlignment": 2,"WordSpacing": 100,"XOffset": 0,"YOffset": 0}}}]&f=pjson
The sample code below show the JSON array in the above request, formatted for readability:
[
{
"globalId": "{4521FC4A-293D-4457-A7D4-9D6496DFA377}",
"name": "PS- point tool NEW",
"description": "multiple updates in payload"
},
{
"globalId": "{143B038A-EA78-4E81-BAA3-A1060431F493}",
"name": "test Anno template",
"description": "multiple updates in payload",
"visible": false,
"status": "private",
"definition": {
"defaultValues": {
"Angle": 0,
"AnnotationClassID": 1,
"CharacterSpacing": 10,
"CharacterWidth": 100,
"Element": "",
"FlipAngle": 90,
"FontLeading": 0,
"FontName": "Constantia",
"FontSize": 8,
"FontStyle": "Bold Italic",
"HorizontalAlignment": 0,
"Override": 0,
"Status": 0,
"SymbolID": 1,
"TextString": "Left",
"Underline": 0,
"VerticalAlignment": 2,
"WordSpacing": 100,
"XOffset": 0,
"YOffset": 0
}
}
}
]
JSON Response syntax
[
{
<result1>
},
{
<result2>
}
]
JSON Response example
The sample response below demonstrates the response returned when the operation completes successfully. The example below shows that two shared templates were successfully updated:
[
{
"templateId": 51,
"globalId": "{83EDCDB5-9CEE-4384-B713-18BD1969D819}",
"hash": "{1E597512-A127-4516-80A4-8DB449D0E257}"
},
{
"templateId": 52,
"globalId": "{DF6534B7-DE7C-425B-8B08-4DB789A39A01}",
"hash": "{B957F388-EF63-467C-A13E-F5C3E530C599}"
}
]
The sample response below demonstrates the response returned when the operation fails. When the operation fails, all changes are rolled back. The example below demonstrates a failure response that is returned when an organization member who is not the template owner, nor an organization administrator, attempts to update a shared template.
{
"error": {
"code": 400,
"message": "Requested operation is not supported by this service.",
"details": []
}
}