Delete objects and relations from the Alfabet database
The endpoint delete provides a means to delete objects and relations from the Alfabet database.
In the Alfabet database, relations between objects are based on the REFSTR object class property of objects. They are stored in two ways:
References: A 1:1 relation with another object is stored directly in the database table of the object class referencing another object. The REFSTR of the referenced object class is stored in the column for the object class property establishing the relation. For example, a local component has an object class property Owner . The REFSTR of the application the local component is defined for is stored in the database column OWNER.
Reference Arrays: 1:n relation are only stored in exceptional cases directly in the database table of the object class referencing another object class. Typically, an object class property of the type ReferenceArray does not have a database column in the object class table. Instead, reference arrays are stored in the RELATIONS table of the Alfabet database. Each entry in the RELATIONS table stores the information about the REFSTR of the object establishing the relation, the REFSTR of the object that is referenced, and the name of the object class property establishing the relation. If an object references three other objects, three entries are available in the relations table.
If you delete an object that has relations stored in the RELATIONS table, these relations are not deleted automatically when the object is deleted. You must delete the relations separately to clear the the RELATIONS table from relations to or from non existent objects.
Endpoint name: delete
HTTP method: POST
Service call: URLOfTheAlfabetAPIServer/api/v2/delete
Authorization Header Field: Authorization:TypeValue
Click for details about authorization.
Additional Header Fields: Content-Type: application/json; charset=utf-8
Body: The body is a JSON object with the following structure:
- {
- "CurrentProfile": "Portfolio Admin",
- "Refs": ["RefStrOfObject","RefStrOfObject"],
- "Relations": [{
- "FromRef": "RefStrOfObject",
- "Property": "ObjectClassPropertyName",
- "ToRef": "RefStrOfObject"
- },
- {
- "FromRef": "RefStrOfObject",
- "Property": "ObjectClassPropertyName",
- "ToRef": "RefStrOfObject"
- }]
- }
Field | Mandatory/Optional | Required Value |
---|---|---|
"Refs":["RefstrOfObject","RefstrOfObject"] | Optional | An array containing one or multiple values of the REFSTR property of objects in the Alfabet database that shall be deleted. |
|
Optional | A JSON list of objects, each object representing a relation to be deleted. For each relation that shall be deleted, the following fields must be defined:
|
"CurrentProfile":"Portfolio Admin" | Mandatory | The user profile is used to evaluate whether the Alfabet user used for authorization has the permissions to delete object data. The Portfolio Admin user profile must be specified to execute object deletion via RESTful service calls. |
Return value: The return value is a JSON object with one field "Count" that informs about the number of objects and relations that were deleted.
RESTful Service call:
Service call: https://AlfabetCloud/AlfabetAPIServer/api/v2/delete
HTTP method: POST
Headers:
- Authorization: bearer eyJ0eXAiOiJKVxMiJ9.eyJpc3MiOiJhbGZhYmV0IiwiaWF0IjoiMTU3MzAzMjA0NiIsImV4cCI6IjE1NzMwMzMyNDYiLCJxc2giOm51bGwsInN1YiI6IkFwaSBBdXRoZW50aWNhdGlvbiIsImNvbnRleHQiOnsidXNlciI6eyJVc2VyS2V5IjoiQUxGQUJFRDRUNGNc1R5cGUiOjB9fX0.PJC0EWtlUETbraV7NckVkRTFVm356y6K9JyhFR245hXp-2ApttryATZ_dAL0bi_GZpeJx7iqr_lRIA
- Content-Type: application/json; charset=utf-8
Body:
- {
- "CurrentProfile": "Portfolio Admin",
- "Refs": ["76-2518-0","76-3246-0","405-3-0"],
- "Relations": [{
- "FromRef": "76-2518-0",
- "Property": "BelongsTo",
- "ToRef": "76-3246-0"
- }
- ]
- }
In the service call, three objects are deleted. One of the deleted objects has a relation to the other deleted object via a ReferenceArray. The relation must be deleted separately. It is not automatically deleted when the objects are deleted.
Response of the service call:
- {
- "Count": 4
- }