Change the properties of existing objects
The details about the service call are provided under Change or add object data to the Alfabet database . This section describes the content of the Objects field of the service call that must be set to alter existing objects.
The Objects field of the request to update objects contains the following fields:
Field name | Required Value | Remark |
---|---|---|
REFSTR | The value of the REFSTR property of the object that shall be updated. | Object can only be updated for a subset of object classes. Click for information about the object classes that can be updated. Use a service call to the endpoint objects to find out about the REFSTR of existing objects. Click for information about the service call to export object information. |
Values | A JSON object with one field for each property that shall be defined.
The field name is identical to the Name of the object class property written in lower-case letters. The field value is identical to the value of the object class property of the created object. |
Only the properties listed under Scope for object creation and update can be set for a new object. You can set relations to other objects in a second step with the service call to the same endpoint with the settings described under Create or update relations between objects.
The property REFSTR cannot be defined in the JSON request. It is set automatically during creation of the object and returned in the return value of the service call. The value of each field must match the following conditions.
|
Translations | A list of JSON objects, each object representing a translation and having two fields. The DataCulture field defines the language code of the data culture (for example fr-FR ), and the Values field that contains a field for each translation to be added with the field name being identical to the property name and the field value being identical to the translation that shall be added. | This field is optional and shall be added if translations of object class names and descriptions shall be provided for one or multiple cultures. |
GenericAttributes | A JSON list of objects, with one JSON object for each generic attribute to create or update. Each JSON object has three fields:
|
The object class GenericAttribute stores properties for different object classes. If generic attributes shall be defined for objects created via an endpoint update, the generic attributes must be created directly within the request for the object it belongs to. |
RESTful Service call:
Service call: https://AlfabetCloud/AlfabetAPIServer/api/v2/update
HTTP method: PUT
Headers:
- Authorization: bearer eyJ0eXAiOiJKVxMiJ9.eyJpc3MiOiJhbGZhYmV0IiwiaWF0IjoiMTU3MzAzMjA0NiIsImV4cCI6IjE1NzMwMzMyNDYiLCJxc2giOm51bGwsInN1YiI6IkFwaSBBdXRoZW50aWNhdGlvbiIsImNvbnRleHQiOnsidXNlciI6eyJVc2VyS2V5IjoiQUxGQUJFRDRUNGNc1R5cGUiOjB9fX0.PJC0EWtlUETbraV7NckVkRTFVm356y6K9JyhFR245hXp-2ApttryATZ_dAL0bi_GZpeJx7iqr_lRIA
- Content-Type: application/json; charset=utf-8
Body:
- {
- "CurrentProfile": "Portfolio Admin",
- "APICulture":"AlfabetFastLane_API",
- "Objects": [{
- "RefStr" : "95-61-0",
- "Values" : {
- "shortname": "TG1",
- "status": "Planned"
- }
- "Translations":[
- {"DataCulture" : "de-DE",
- "Values":{"name": "Testgruppe 1"}
- },
- {"DataCulture" : "fr-FR",
- "Values":{"name": "Groupe Controle 1"}
- }
- ]
- "GenericAttributes": [{
- "RefStr": "",
- "Values": {"Name": "Integer Attribute 1",
- "Group": "",
- "Type": "Integer",
- "Value": "99999"},
- "Translations": [{
- "DataCulture": "de-DE",
- "Values": {"Name": "Integer-Attribut"}
- }]
- }]
- },
- {
- "RefStr" : "95-62-0",
- "Values" : {
- "shortname": "TG2",
- }
- "Translations":[
- {"DataCulture" : "de-DE",
- "Values":{"name": "Testgruppe 1"}
- },
- {"DataCulture" : "fr-FR",
- "Values":{"name": "Groupe Controle 1"}
- }
- ]
- }]
- }
In the service call, two application groups are updated. A generic attribute that was not previously defined for the application group is defined for one of the application groups. A generic attribute is a separate object. With the call, one generic attribute object was created and two application group objects were updated.
Response of the service call:
- {
- "NewObjects": 1,
- "Count": 3
- }