Create new objects in the Alfabet database
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 field Objects of the service call that must be set to create new objects. The Objects field of the request to create one or multiple new objects contains the following fields:
Field name | Required Value | Remark |
---|---|---|
ClassName | The value of the Name attribute of the Alfabet FastLane object class for that the object shall be created. | Object can only be created for a subset of object classes. Click for information about the object classes that can be updated. |
Id | An integer that is a unique identifier inside the JSON request. | Each object created in a single JSON request must have a different ID. The ID is only used within the single JSON request. It does not have any impact on the Alfabet FastLane database. As soon as the objects are created, the IDs are no longer coupled to the objects and can be used in other service calls. |
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 two fields. This includes the DataCulture field that 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, generic reference data 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": [{
- "ClassName" : "ApplicationGroup",
- "Id" : "1",
- "Values" : {
- "name": "Test Group 1",
- "shortname": "TestG1"
- }
- "Translations":[
- {"DataCulture" : "de-DE",
- "Values":{"name": "Testgruppe 1"}
- },
- {"DataCulture" : "fr-FR",
- "Values":{"name": "Groupe Controle 1"}
- }
- ]
- ]
- },
- {
- "ClassName" : "ApplicationGroup",
- "Id" : "2",
- "Values" : {
- "name": "Test Group 2",
- "shortname": "TestG2"
- },
- "Translations":[
- {"DataCulture" : "de-DE",
- "Values":{"name": "Testgruppe 2"}
- },
- {"DataCulture" : "fr-FR",
- "Values":{"name": "Groupe Controle 2"}
- }
- ],
- "GenericAttributes": [{
- "RefStr": "",
- "Values": {"Name": "Integer Attribute 1",
- "Group": "",
- "Type": "Integer",
- "Value": "99999"},
- "Translations": [{
- "DataCulture": "de-DE",
- "Values": {"Name": "Integer-Attribut"}
- }]
- }]
- }]
- }
In the service call, two application groups and one generic attribute are created.
Response of the service call:
- {
- "NewObjects": {
- 1: "157-61-0",
- 2: "157-62-0",
- 3: "689-857-0" }
- "Count": 3
- "NewObjects": {
- }