Create or Modify Objects
Create objects of the specified type or, in case the specified "id" already exists, modifies objects already created without the need for the function to load objects. If no "id" is provided, an insertion occurs.
POST /create-or-modify-objects.fcgi
Parameters
- object (string) : Type of object to be created or modified. See the topic List of Objects to consult the complete list of available objects.
- values (array of JSON objects) : Each element must be a JSON object representing the object to be created. Each key must be a valid field of the object, and the values must have the appropriate type.
Response
- changes (64-bit integer): Number of created or modified objects.
Request example
This request will create a user.
$.ajax({
url: "/create_or_modify_objects.fcgi?session=" + session,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
object: "users",
values: [{"id":1, registration: '1234', name: 'Walter H. White', password: 'Heisenberg'}]
})
});
Response example
{"changes": 1}