Load Objects

Loads all objects of the specified type, this operation is similar to the SELECT database command. The HTTP method used to send the data is POST.

POST /load_objects.fcgi

Parameters

  • object (string) : Type of object to load. See the topic List of Objects in order to consult the complete list of all available objects.
  • fields (string array) : Fields to be received from the object. If this parameter is not present, all fields will be received (optional).
  • limit (int) : Maximum number of objects to acquire (optional).
  • offset (int) : Skip the first offset objects that would be acquired. Useful for implementing pagination (optional). The limit parameter must be set otherwise offset will be ignored.
  • order (array of strings) : Which fields should be used to order objects. If any of the elements has the special value "ascending" or "descending", the sorting will be ascending or descending, respectively (optional). If multiple "ascending" or "descending" values are defined, only the last definition will be taken into account. If the specified field must belong to an object other than the one being loaded, you can pass a JSON object with the following parameters { object: 'object', field: 'field' }, where "object" and "field" are the object and field by which you want to sort.
  • group (string array) : This field determines the grouping of fields, very similar to the group_by of a database (optional). It's an array that can contain the name of the field that will be grouped or the object if the field does not belong to the original table. { object: 'object', field: 'field' }, where object and field are the object and field you want to sort by.
  • join (string) : This field determines how the tables will be grouped. This field is a string that can have two values: "LEFT" or "INNER" (optional).
  • where (string) : Which objects to acquire (optional). Through this parameter, it is possible to specify filters to receive only some objects. Each key must be the type of the object to be acquired, and each value must be a JSON object. For example: where: { users: {} }. The key of each JSON object must be the object's field, and the value must be the filter used. For example: where: { users: { id: 1 } }. In the example above, only users that have an id equal to 1 (one) will be filtered. Note that the object's attribute type (integer, string, etc.) must be the same type that is being used as a filter. The filter can also specify one of the following comparison operators: The equals operator ('=', '==', 'LIKE'), this is the default operator and does not need to be specified. The not equal to operator ('!=', '<>', 'NOT LIKE'). The greater than operator ('>'). The less than operator ('<'). The greater than or equal to operator ('>='). The less than or equal to operator ('<='). The in operator ('IN'). The not in operator ('NOT IN'). Operators can be specified using a JSON object whose key is the operator and the value is the constraint value. For example: where: { users: { id: {"!=": 1} } }. In the example above, only users that have an id other than 1 (one) will be acquired. You can also specify multiple constraints. For example: where: { users: { id: {">=": 1, "<=": 2} } } in the above example only users that have an id greater than 1 (one) and less than 2 (two) will be acquired. Do not explicitly list more than 999 elements if you use a list of ids as a filter in the where parameter. Otherwise, the request will fail.

Response

  • NAME_OF_OBJECT (array of JSON objects) : Each JSON object represents a loaded object.

Request example

This request will load all users

$.ajax({
  url: "/load_objects.fcgi?session=" + session,
  type: 'POST',
  contentType: 'application/json',
  data: JSON.stringify({
    object: "users"
  })
});

Response example

{
    "users":[{"id":1,"registration":"","name":"th0","password":"","salt":"","expires":0,"user_type_id":0,"begin_time":0,"end_time":0},{"id":2,"registration":"","name":"th1","password":"","salt":"","expires":0,"user_type_id":0,"begin_time":0,"end_time":0},{"id":3,"registration":"","name":"th2","password":"","salt":"","expires":0,"user_type_id":0,"begin_time":0,"end_time":0},{"id":4,"registration":"","name":"th3","password":"","salt":"","expires":0,"user_type_id":0,"begin_time":0,"end_time":0},{"id":5,"registration":"","name":"th4","password":"","salt":"","expires":0,"user_type_id":0,"begin_time":0,"end_time":0},{"id":6,"registration":"","name":"th5","password":"","salt":"","expires":0,"user_type_id":0,"begin_time":0,"end_time":0},{"id":7,"registration":"1234","name":"Walter White","password":"Heisenberg","salt":"","expires":0,"user_type_id":0,"begin_time":0,"end_time":0},{"id":8,"registration":"0123","name":"Walter White","password":"Heisenberg","salt":"","expires":0,"user_type_id":0,"begin_time":0,"end_time":0}
}

Request example

This request exemplifies the use of where, which returns only the access logs that have an id value greater than 1 and an event value equal to 7.

$.ajax({
      url: "/load_objects.fcgi?session=" + session,
      type: 'POST',
      contentType: 'application/json',
      data: JSON.stringify({
        "object": "access_logs",
        "where":[
          {
              "object": "access_logs",
              "field": "id",
              "operator": ">",
              "value": 1,
              "connector": ") AND ("            
          },
          {
              "object": "access_logs",
              "field": "event",
              "operator": "=",
              "value": 7          
          }
        ]
      })
});

Loading Large User Bases with Biometrics

To carry out proper loading of large user bases, a procedure must be adopted to act properly. It is necessary to use a template synchronization process through a mechanism implemented in the API.

The synchronization process ensures the proper loading of large databases. First, you must use the endpoint template_sync_init.fcgi, responsible for disabling the synchronization of loaded templates. Then you must load the templates with create_objects.fcgi. After that, you must re-enable and perform synchronization of templates loaded through a request to endpoint template_sync_end.fcgi.

Details about the execution of these endpoints are shown below.

POST /template_sync_init.fcgi

Parameters

This call has no parameters.

Response

Empty response.

POST /template_sync_end.fcgi

Parameters

This call has no parameters.

Response

Empty response.