Skip to content

Object Models

This technical design describes implementation and API for Object Classes Relations.

API

POST /api/object-models/

DANGER

⚠️ NOTE: This endpoint has been marked for deprecattion from Catalyst API 11.0.0. It's replacement is an improved endpoint that allows actions against full heirarchical structures, alleviating the need for multi-step transversal please visit: Hierarchical records creation endpoints for more information!

Creates Object Models.

Permissions

Requires authentication and SuperAdmin permission.

Request

  • Headers
Request Method: POST
Authorization: JWT access_token
  • Body
KeyTypeRequiredNotes
namestringtrue
descriptionstringfalse
object_classesArraytrueRelations between object classes

Request object_classes array

KeyTypeNotes
object_classintObject Class id
multiplicitystringChoices: (zero_or_more, zero_or_one)
parentintObject Class id
removable_relationboolFalse if: Exists a relation between a record from the corresponding parent class and a record from the corresponding child class. Exists Sequence with Child added/removed event. Exists Relation Lookup with corresponding classes.
modifiable_multiplicityboolFalse if there exist at least 2 relations between a single record from the corresponding parent class and several records from the corresponding child class and for all "root" classes.

Validations

  • name
    • This field is required.
    • This field may not be blank.
    • This field may not be null.
    • Ensure this field has no more than 100 characters.
  • description
    • This field may not be null.
    • Ensure this field has no more than 500 characters.
  • object_classes
    • This field is required.
    • This field may not be null.
    • non_fields_errors
      • Expected a list of items but got type <type>.
      • Relation contains loop.
      • Limit of "limit" top parents exceeded.
    • object_class
      • This field is required.
      • Invalid pk "value" - object does not exist.
      • This field may not be null.
      • The object class "value" might be given only once.
    • multiplicity
      • This field is required
      • This field may not be null.
      • "value" is not a valid choice.
    • parent
      • Invalid pk "value" - object does not exist.
      • Invalid pk "value" - Object Class not added to Object Model Definition.
      • Relation depth limit exceeded for Object Class ID <value>.
      • Limit of "limit" children exceeded for Object Class ID <value>.

Sample request body

json
POST /api/object-models/

{ 
  "name": "sample name",
  "description": "Sample description",
  "object_classes": [
    {
      "object_class": 6, 
      "multiplicity": "zero_or_one", 
      "parent": 7,
      "removable_relation": false,
      "modifiable_multiplicity": true
    },
     {
      "object_class": 7, 
      "multiplicity": "zero_or_one", 
      "parent": null,
      "removable_relation": true,
      "modifiable_multiplicity": false
    },
    {
      "object_class": 8, 
      "multiplicity": "zero_or_one", 
      "parent": 7,
      "removable_relation": true,
      "modifiable_multiplicity": false
    },
    {
      "object_class":9, 
      "multiplicity": "zero_or_one", 
      "parent": 8,
      "removable_relation": true,
      "modifiable_multiplicity": false
    },
    {
      "object_class":10, 
      "multiplicity": "zero_or_one", 
      "parent": 9,
      "removable_relation": true,
      "modifiable_multiplicity": false
    }
  ]
}

Response

KeyTypeNotes
idintAutomatically generated by the backend.
namestring
descriptionstring
object_classesArray
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.permissionsObjectDict describing permissions.

Response object_classes array

KeyTypeNotes
object_classintObject Class id
multiplicitystringChoices: (zero_or_more, zero_or_one)
parentintObject Class id
_meta.labelsObjectObject contains labels for Object Class
  • Successful status 201 Created
  • Response body schema
json
{
    "id": 17,
    "name": "sample name",
    "description": "Sample description",
    "object_classes": [
        {
            "object_class": 7,
            "multiplicity": "zero_or_more",
            "parent": null,
            "_meta": {
                "labels": {
                    "object_class": "some n323ame22233"
                }
            }
        },
        {
            "object_class": 6,
            "multiplicity": "zero_or_one",
            "parent": 7,
            "_meta": {
                "labels": {
                    "object_class": "some name22233"
                }
            }
        },
        {
            "object_class": 8,
            "multiplicity": "zero_or_one",
            "parent": 7,
            "_meta": {
                "labels": {
                    "object_class": "some name22233"
                }
            }
        },
        {
            "object_class": 9,
            "multiplicity": "zero_or_one",
            "parent": 8,
            "_meta": {
                "labels": {
                    "object_class": "some name222336"
                }
            }
        },
        {
            "object_class": 10,
            "multiplicity": "zero_or_one",
            "parent": 9,
            "_meta": {
                "labels": {
                    "object_class": "some name2223334"
                }
            }
        }
    ],
    "created_at": "2022-11-17T14:40:54.687803+01:00",
    "created_by": {
        "id": 2,
        "first_name": "ALX",
        "last_name": "Developer",
        "username": "alx.dev@autologyx.com",
        "company_name": "",
        "is_deleted": false,
        "account_type": "super_admin"
    },
    "modified_at": "2022-11-17T14:40:54.687836+01:00",
    "modified_by": {
        "id": 2,
        "first_name": "ALX",
        "last_name": "Developer",
        "username": "alx.dev@autologyx.com",
        "company_name": "",
        "is_deleted": false,
        "account_type": "super_admin"
    },
    "permissions": {
        "object_models": [
            "create",
            "edit",
            "view",
            "list"
        ]
    }
}

Errors

CauseResponse codeMessage
name missing400 Bad Request"name": ["This field is required."]
name is empty400 Bad Request"name": [ "This field may not be blank."]
name is null400 Bad Request"name": [ "This field may not be null."]
name to long400 Bad Request"name": ["Ensure this field has no more than 100 characters."]
description to long400 Bad Request"description": ["Ensure this field has no more than 500 characters."]
description is null400 Bad Request"description": [ "This field may not be null."]
object_classes missing400 Bad Request"object_classes": ["This field is required."]
object_classes is null400 Bad Request"object_classes": [ "This field may not be null." ]
object_classes not a list400 Bad Request"object_classes": {"non_field_errors": ["Expected a list of items but got type "type"."]}
object_classes contains loop400 Bad Request"object_classes": {"non_field_errors": ["Relation contains loop."]}
object_classes to many parents400 Bad Request"object_classes": {"non_field_errors": ["Limit of "limit" top parents exceeded."]}
object_class missing400 Bad Request"object_classes": {"object_class": ["This field is required."]}
object_class invalid ID400 Bad Request"object_classes": {"object_class": ["Invalid pk "value" - object does not exist."]}
object_class is null400 Bad Request"object_classes": {"object_class": ["This field may not be null."]}
object_class not unique400 Bad Request"object_classes": {"object_class": ["The object class "value" might be given only once."]}
multiplicity missing400 Bad Request"object_classes": {"multiplicity": ["This field is required."]}
multiplicity is null400 Bad Request"object_classes": {"multiplicity": [ "This field may not be null." ]}
multiplicity invalid value400 Bad Request"object_classes": {"multiplicity": [""value" is not a valid choice."]}
parent invalid ID400 Bad Request"object_classes": {"parent": ["Invalid pk "value" - object does not exist."]}
parent ID not on the list400 Bad Request"object_classes": {"parent": ["Invalid pk "value" - Object Class not added to Object Model Definition."]}
relation depth exceeded400 Bad Request"object_classes": {"parent": ["Relation depth limit exceeded for Object Class ID "value"."]}
To many children400 Bad Request"object_classes": {"parent": ["Limit of "limit" children exceeded for Object Class ID "value"."]}
Exceeded max number of Object Model Definitions400 Bad Request"detail": "Limit of 1 Object Model Definitions has been exceeded."
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."

GET /api/object-models/

Returns list of object classes.

Permissions

Requires authentication and SuperAdmin permission.

Request

  • Headers
Content-Type: application/json
Authorization: JWT access_token
  • Schema
json
GET /api/object-models/

Response

KeyTypeNotes
limitint
offsetint
total_countintTotal number of results visible to the user (based on permissions).
filtered_countintNumber of results visible to the user (based on permissions) with filters applied.
nexturlNext page URL (null if there is no next page)
previousurlPrevious page URL (null if there is no previous page)
resultsArrayList of results. Described in the next table.

Response results array

KeyTypeNotes
idintAutomatically generated by the backend.
namestring
descriptionstring
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.permissionsObjectDict describing permissions.
  • Successful status 200 OK
  • Response body schema
json
GET /api/object-models/

{
    "limit": 100,
    "offset": 0,
    "filtered_count": 1,
    "total_count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 17,
            "name": "simple name",
            "description": "Simple description",
            "created_at": "2022-11-17T14:40:54.687803+01:00",
            "created_by": {
                "id": 2,
                "first_name": "ALX",
                "last_name": "Developer",
                "username": "alx.dev@autologyx.com",
                "company_name": "",
                "is_deleted": false,
                "account_type": "super_admin"
            },
            "modified_at": "2022-11-17T14:40:54.687836+01:00",
            "modified_by": {
                "id": 2,
                "first_name": "ALX",
                "last_name": "Developer",
                "username": "alx.dev@autologyx.com",
                "company_name": "",
                "is_deleted": false,
                "account_type": "super_admin"
            },
            "permissions": {
                "object_models": [
                    "create",
                    "edit",
                    "view",
                    "list"
                ]
            }
        }
    ]
}

Errors

ErrorResponse codeMessage
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."

GET /api/object-models/id

Returns single object model by id.

Permissions

Requires authentication and SuperAdmin permission.

Request

  • URL parameters
KeyTypeNotes
idid
  • Headers
Content-Type: application/json
Authorization: JWT access_token

Response

KeyTypeNotes
idintAutomatically generated by the backend.
namestring
descriptionstring
object_classesArray
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.permissionsObjectDict describing permissions.

Response object_classes array

KeyTypeNotes
object_classintObject Class id
multiplicitystringChoices: (zero_or_more, zero_or_one)
parentintObject Class id
removable_relationboolFalse if: Exists a relation between a record from the corresponding parent class and a record from the corresponding child class. Exists Sequence with Child added/removed event. Exists Relation Lookup with corresponding classes.
modifiable_multiplicityboolFalse if there exist at least 2 relations between a single record from the corresponding parent class and several records from the corresponding child class and for all "root" classes.
_meta.labelsObjectObject contains labels for Object Class
  • Successful status 200 OK
  • Response body schema:
json
{
    "id": 17,
    "name": "simple name",
    "description": "Simple description",
    "object_classes": [
        {
            "object_class": 7,
            "multiplicity": "zero_or_more",
            "parent": null,
            "removable_relation": false,
            "modifiable_multiplicity": true,
            "_meta": {
                "labels": {
                    "object_class": "some class name"
                }
            }
        },
        {
            "object_class": 6,
            "multiplicity": "zero_or_one",
            "parent": 7,
            "removable_relation": false,
            "modifiable_multiplicity": true,
            "_meta": {
                "labels": {
                    "object_class": "some class name 2"
                }
            }
        }
    ],
    "created_at": "2022-11-17T14:40:54.687803+01:00",
    "created_by": {
        "id": 2,
        "first_name": "ALX",
        "last_name": "Developer",
        "username": "alx.dev@autologyx.com",
        "company_name": "",
        "is_deleted": false,
        "account_type": "super_admin"
    },
    "modified_at": "2022-11-17T14:40:54.687836+01:00",
    "modified_by": {
        "id": 2,
        "first_name": "ALX",
        "last_name": "Developer",
        "username": "alx.dev@autologyx.com",
        "company_name": "",
        "is_deleted": false,
        "account_type": "super_admin"
    },
     "permissions": {
        "object_models": [
            "create",
            "edit",
            "view",
            "list"
        ]
    }
}

Errors

ErrorResponse codeMessage
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."
Object Model with "id" does not exist404 Not Found"detail": "Not found."

PATCH /api/object-models/id/

Updates single Object Model.

Permissions

Requires authentication and SuperAdmin permission.

Request

  • URL parameters
KeyTypeNotes
idint
  • Headers
Request Method: PATCH
Authorization: JWT access_token
  • Body
KeyTypeRequiredNotes
namestringtrue
descriptionstringfalse
object_classesArraytrueRelations between object classes

Request object_classes array

KeyTypeNotes
object_classintObject Class id
multiplicitystringChoices: (zero_or_more, zero_or_one)
parentintObject Class id
removable_relationboolFalse if: Exists a relation between a record from the corresponding parent class and a record from the corresponding child class. Exists Sequence with Child added/removed event. Exists Relation Lookup with corresponding classes.
modifiable_multiplicityboolFalse if there exist at least 2 relations between a single record from the corresponding parent class and several records from the corresponding child class and for all "root" classes.
  • Sample request body
json
PATCH /api/object-models/1/

{ 
  "name": "sample name",
  "description": "Sample description",
  "object_classes": [
    {
      "object_class": 6, 
      "multiplicity": "zero_or_one", 
      "parent": 7,
      "removable_relation": true,
      "modifiable_multiplicity": false
    },
     {
      "object_class": 7, 
      "multiplicity": "zero_or_one", 
      "parent": null,
      "removable_relation": true,
      "modifiable_multiplicity": false
    },
    {
      "object_class": 8, 
      "multiplicity": "zero_or_one", 
      "parent": 7,
      "removable_relation": true,
      "modifiable_multiplicity": false
    },
    {
      "object_class":9, 
      "multiplicity": "zero_or_one", 
      "parent": 8,
      "removable_relation": true,
      "modifiable_multiplicity": false
    },
    {
      "object_class":10, 
      "multiplicity": "zero_or_one", 
      "parent": 9,
      "removable_relation": true,
      "modifiable_multiplicity": false
    }
  ]
}

Response

KeyTypeNotes
idintAutomatically generated by the backend.
namestring
descriptionstring
object_classesArray
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.permissionsObjectDict describing permissions.

Response object_classes array

KeyTypeNotes
object_classintObject Class id
multiplicitystringChoices: (zero_or_more, zero_or_one)
parentintObject Class id
_meta.labelsObjectObject contains labels for Object Class
  • Successful status 200 OK
  • Response body schema
json
{
    "id": 17,
    "name": "Sample name",
    "description": "Sample description",
    "object_classes": [
        {
            "object_class": 7,
            "multiplicity": "zero_or_more",
            "parent": null,
            "_meta": {
                "labels": {
                    "object_class": "some n323ame22233"
                }
            }
        },
        {
            "object_class": 6,
            "multiplicity": "zero_or_one",
            "parent": 7,
            "_meta": {
                "labels": {
                    "object_class": "some name22233"
                }
            }
        },
        {
            "object_class": 8,
            "multiplicity": "zero_or_one",
            "parent": 7,
            "_meta": {
                "labels": {
                    "object_class": "some name22233"
                }
            }
        },
        {
            "object_class": 9,
            "multiplicity": "zero_or_one",
            "parent": 8,
            "_meta": {
                "labels": {
                    "object_class": "some name222336"
                }
            }
        },
        {
            "object_class": 10,
            "multiplicity": "zero_or_one",
            "parent": 9,
            "_meta": {
                "labels": {
                    "object_class": "some name2223334"
                }
            }
        }
    ],
    "created_at": "2022-11-17T14:40:54.687803+01:00",
    "created_by": {
        "id": 2,
        "first_name": "ALX",
        "last_name": "Developer",
        "username": "alx.dev@autologyx.com",
        "company_name": "",
        "is_deleted": false,
        "account_type": "super_admin"
    },
    "modified_at": "2022-11-17T14:40:54.687836+01:00",
    "modified_by": {
        "id": 2,
        "first_name": "ALX",
        "last_name": "Developer",
        "username": "alx.dev@autologyx.com",
        "company_name": "",
        "is_deleted": false,
        "account_type": "super_admin"
    },
     "permissions": {
        "object_models": [
            "create",
            "edit",
            "view",
            "list"
        ]
    }
}

Errors

CauseResponse codeMessage
name missing400 Bad Request"name": ["This field is required."]
name is empty400 Bad Request"name": [ "This field may not be blank."]
name is null400 Bad Request"name": [ "This field may not be null."]
name to long400 Bad Request"name": ["Ensure this field has no more than 100 characters."]
description to long400 Bad Request"description": ["Ensure this field has no more than 500 characters."]
description is null400 Bad Request"description": [ "This field may not be null."]
object_classes is null400 Bad Request"object_classes": [ "This field may not be null." ]
object_classes not a list400 Bad Request"object_classes": {"non_field_errors": ["Expected a list of items but got type "type"."]}
object_classes contains loop400 Bad Request"object_classes": {"non_field_errors": ["Relation contains loop."]}
object_classes to many parents400 Bad Request"object_classes": {"non_field_errors": ["Limit of "limit" top parents exceeded."]}
object_class missing400 Bad Request"object_classes": {"object_class": ["This field is required."]}
object_class invalid ID400 Bad Request"object_classes": {"object_class": ["Invalid pk "value" - object does not exist."]}
object_class is null400 Bad Request"object_classes": {"object_class": ["This field may not be null."]}
object_class not unique400 Bad Request"object_classes": {"object_class": ["The object class "value" might be given only once."]}
object_class existing record400 Bad Request"object_classes": {"non_field_errors": ["Relation between "parent_class_name" and "child_class_name" can’t be removed because at least 1 relation between Records of these Classes exists."]}
object_class existing sequence400 Bad Request"object_classes": {"non_field_errors": ["Relation between "parent_class_name" and "child_class_name" can’t be removed because at least 1 Sequence is referring to it. Sequence ids: [sequence_id1, sequence_id2,..]." ]}
object_class existing document template400 Bad Request"object_classes": {"non_field_errors": ["Relation between "parent_class_name" and "child_class_name" can’t be removed because at least 1 Document template is referring to it. Document template ids: [template_id1, template_id2,..]." ]}
multiplicity missing400 Bad Request"object_classes": {"multiplicity": ["This field is required."]}
multiplicity is null400 Bad Request"object_classes": {"multiplicity": [ "This field may not be null." ]}
multiplicity invalid value400 Bad Request"object_classes": {"multiplicity": [""value" is not a valid choice."]}
multiplicity existing record400 Bad Request"object_classes": {"multiplicity": ["'Zero or one' value is invalid for relation between "parent_class_name" and "child_class_name" because at least 1 Record of Class "parent_class_name" has multiple children Records of Class "child_class_name"." ]}
parent invalid ID400 Bad Request"object_classes": {"parent": ["Invalid pk "value" - object does not exist."]}
parent ID not on the list400 Bad Request"object_classes": {"parent": ["Invalid pk "value" - Object Class not added to Object Model Definition."]}
relation depth exceeded400 Bad Request"object_classes": {"parent": ["Relation depth limit exceeded for Object Class ID "value"."]}
To many children400 Bad Request"object_classes": {"parent": ["Limit of "limit" children exceeded for Object Class ID "value"."]}
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."
Invalid id in URL404 Not Found"detail": ["Not found."]

OPTIONS /api/object-models/

Permissions

Requires authentication only.

Request

  • Headers
Content-Type: application/json
Authorization: JWT access_token
  • Schema
json
OPTIONS /api/object-models/

Response

  • Successful status 200 OK
  • Response body:
json
{
  "list": {
    "columns": [
      {
        "alias": "id",
        "type": "int",
        "predicates": [],
        "sort_ok": false
      },
      {
        "alias": "name",
        "type": "string",
        "predicates": [],
        "sort_ok": false
      },
      {
        "alias": "description",
        "type": "string",
        "predicates": [],
        "sort_ok": false
      },
      {
        "alias": "created_at",
        "type": "datetime",
        "predicates": [],
        "sort_ok": false
      },
      {
        "alias": "created_by",
        "type": "user",
        "predicates": [],
        "sort_ok": false
      },
      {
        "alias": "modified_at",
        "type": "datetime",
        "predicates": [],
        "sort_ok": false
      },
      {
        "alias": "modified_by",
        "type": "user",
        "predicates": [],
        "sort_ok": false
      }
    ]
  },
  "details": {
    "schema": [
      {
        "alias": "name",
        "type": "string",
        "required": true,
        "validators": [
          {
            "type": "min_length",
            "length": 1
          },
          {
            "type": "max_length",
            "length": 100
          }
        ]
      },
      {
        "alias": "description",
        "type": "string",
        "required": false,
        "validators": [
          {
            "type": "max_length",
            "length": 500
          }
        ]
      },
      {
        "alias": "object_classes",
        "schema": [
          {
            "alias": "object_class",
            "type": "enum",
            "required": true,
            "autocomplete": "/api/object-classes/autocomplete/?text__icontains="
          },
          {
            "alias": "multiplicity",
            "type": "enum",
            "required": true,
            "values": [
              [
                "zero_or_one",
                "Zero or one"
              ],
              [
                "zero_or_more",
                "Zero or more"
              ]
            ]
          }
        ]
      }
    ]
  },
  "restrictions": {
    "limit_parents": 5,
    "limit_children": 5,
    "limit_depth": 5
  }
}

GET /api/object-models/id/object-class/class_id/parents/

Returns parent for the specific Object Class in Object Model.

Permissions

Requires authentication and object_classes.view permission for the specific Object Class.

Request

  • URL parameters
KeyTypeNotes
idid
class_idid
  • Headers
Content-Type: application/json
Authorization: JWT access_token

Response array

KeyTypeNotes
idintObject Class id.
namestring
  • Successful status 200 OK
  • Response body schema:

Important

Parent class names are show only if the user has view class permission for the given parent class. Otherwise "name": NULL.

json
[
  {
    "id": <int>,
    "name": <str>
  }
]

Errors

ErrorResponse codeMessage
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."
Object Model with "id" does not exist404 Not Found"detail": "Not found."
Object Class with "id" does not exist404 Not Found"detail": "Not found."

GET /api/object-models/id/object-class/class_id/children/

Returns children for the specific Object Class in Object Model.

Permissions

Requires authentication and object_classes.view permission for the specific Object Class.

Request

  • URL parameters
KeyTypeNotes
idid
class_idid
  • Headers
Content-Type: application/json
Authorization: JWT access_token

Response array

KeyTypeNotes
idintObject Class id.
namestring
multiplicityenumValues: zero_or_one, zero_or_more.
_meta.permissionsObjectObject describing permissions.
  • Successful status 200 OK
  • Response body schema:

Important

Child class names are show only if the user has view class permission for the given child class. Otherwise "name": NULL.

json
[
  {
    "id": <int>,
    "name": <str>,
    "multiplicity": <enum>,
    "_meta": {
        "labels": {
            "multiplicity": <str>
        },
        "permissions": {
            "list": <bool>,
            "view": <bool>,
            "object_records": {
                "create": <bool>,
                "list": <bool>
            }
        }
    }
  }
]

Errors

ErrorResponse codeMessage
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."
Object Model with "id" does not exist404 Not Found"detail": "Not found."
Object Class with "id" does not exist404 Not Found"detail": "Not found."

GET /api/object-models/id/object-records/

List Related Object Records based on query parameters and caller permissions.

Important

Access to endpoint require passing Result Class filter /api/object-models/<model_id>/object-records/?result_class=<object_class_id>

Permissions

Requires authentication and object_records.list permission

Request example

  • Headers
Request Method: GET
Location: /api/object-models/<model_id>/object-records/
Authorization: JWT access_token

Response

KeyTypeNotes
limitint
offsetint
total_countintTotal number of items visible to the user (based on permissions).
filtered_countintNumber of items visible to the user (based on permissions) with filters applied.
nextURL / nullNext page URL (null if there is no next page)
previousURL / nullPrevious page URL (null if there is no previous page)
resultsArrayDescribed in the next table.

Response results array

KeyTypeNotes
idid
object_namestring
object_classint
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_metaObject_meta result

Response _meta object

KeyTypeNotes
permissionsObject
labelsObject
usersObjectOptional, added only if show_fields is passed.
user_groupsObjectOptional, added only if show_fields is passed.

Response _meta.users object

KeyTypeNotes
<user_id>user

_meta.users contains max 50 user objects for first 50 unique items from user type fields.

Response _meta.user_groups object

KeyTypeNotes
<users_group_id>ObjectContains group id, name and num_of_members

_meta.user_groups contains max 50 user group objects for first 50 unique items from user type fields.

Response example

  • Status 200 OK
  • Body
json
{
  "limit": 100,
  "offset": 0,
  "filtered_count": 21,
  "total_count": 21,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 21,
      "object_name": "21",
      "object_class": 2,
      "status": "initiated",
      "created_at": "2022-08-18T12:23:25.927304+02:00",
      "created_by": {
        "id": 2,
        "first_name": "ALX",
        "last_name": "Developer",
        "username": "alx.dev@autologyx.com",
        "company_name": "",
        "is_deleted": false,
        "account_type": "super_admin"
      },
      "modified_at": "2022-08-18T12:23:25.927359+02:00",
      "modified_by": {
        "id": 2,
        "first_name": "ALX",
        "last_name": "Developer",
        "username": "alx.dev@autologyx.com",
        "company_name": "",
        "is_deleted": false,
        "account_type": "super_admin"
      },
      "field_usertype": {"users": [23]},
      "_meta": {
        "permissions": {
          "list": true,
          "view": true,
          "edit": true,
          "create": true,
          "delete": true,
          "edit_owners": true,
          "view_owners": true,
          "tasks": {
            "list": true,
            "view": true,
            "edit": true,
            "delete": true,
            "create": true,
            "complete": true,
            "assign": true
          }
        },
        "labels": {
          "object_class": "Some class name"
        },
        "users": {
            "23": {
                "id": 23,
                "first_name": "John",
                "last_name": "Smith",
                "username": "j.smith@autologyx.com",
                "company_name": "Autologyx",
                "is_deleted": false,
                "account_type": "super_admin"
            }
        },
        "allowed_status_transitions": [],
        "forbidden_actions": []
      }
    },
    {
      "id": 20,
      "object_name": "20",
      "object_class": 2,
      "status": "initiated",
      "created_at": "2022-08-18T12:21:35.921861+02:00",
      "created_by": {
        "id": 2,
        "first_name": "ALX",
        "last_name": "Developer",
        "username": "alx.dev@autologyx.com",
        "company_name": "",
        "is_deleted": false,
        "account_type": "super_admin"
      },
      "modified_at": "2022-08-18T13:43:42.874876+02:00",
      "modified_by": {
        "id": 2,
        "first_name": "ALX",
        "last_name": "Developer",
        "username": "alx.dev@autologyx.com",
        "company_name": "",
        "is_deleted": false,
        "account_type": "super_admin"
      },
      "_meta": {
        "permissions": {
          "list": true,
          "view": true,
          "edit": true,
          "create": true,
          "delete": true,
          "edit_owners": true,
          "view_owners": true,
          "tasks": {
            "list": true,
            "view": true,
            "edit": true,
            "delete": true,
            "create": true,
            "complete": true,
            "assign": true
          }
        },
        "labels": {
          "object_class": "Some class2"
        },
        "allowed_status_transitions": [],
        "forbidden_actions": []
      }
    },
  ]
}

Sorting

ParameterExampleNotes
id..&ordering=idAscending
id..&ordering=-idDescending (-)
created_at..&ordering=created_atAscending
created_at..&ordering=-created_atDescending (-)
modified_at..&ordering=modified_atAscending
modified_at..&ordering=-modified_atDescending (-)
object_name..&ordering=object_nameAscending
object_name..&ordering=-object_nameDescending (-)
field_<field_alias>..&show_fields=field_alias&ordering=field_aliasAscending
field_<field_alias>..&show_fields=field_alias&ordering=-field_aliasDescending (-)

Result Class Fields Query String parameters are included in Object Classes - GET /api/object-classes/{object_class_id}/fields/autocomplete/ endpoint.

The fields types / columns available for Ordering :

string
int
float
date
datetime
email
enum

The custom field from ordering should also be included in show_fields parameter only then ordering by this field will be enabled.

Filtering

For the full description of standard predicates see ALX API standards - Developers guide.

ParameterTypeExample
result_class={build}/api/object-models/{model_id}/object-records/?result_class=1
result_class_created_atdatetime{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_created_at__gte=2022-01-01
result_class_created_byset{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_created_by__in=123,234,345
result_class_modified_atdatetime{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_modified_at__range=2022-01-01,2022-01-31
result_class_modified_byset{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_modified_by=123
result_class_object_namestring{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_object_name__icontains=foobar
show_fieldsstring{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_object_class=12&show_fields=field_alias
child_class_{cid}_idint + enum{build}/api/object-models/{model_id}/object-records/?result_class=1&child_class_{cid}_id=3
child_class_{cid}_created_atdatetime{build}/api/object-models/{model_id}/object-records/?result_class=1&child_class_{cid}_created_at__gte=2022-01-01
child_class_{cid}_created_byset{build}/api/object-models/{model_id}/object-records/?result_class=1&child_class_{cid}_created_by__in=123,234,345
child_class_{cid}_modified_atdatetime{build}/api/object-models/{model_id}/object-records/?result_class=1&child_class_{cid}_modified_at__range=2022-01-01,2022-01-31
child_class_{cid}_modified_byset{build}/api/object-models/{model_id}/object-records/?result_class=1&child_class_{cid}_modified_by=123
child_class_{cid}_object_namestring{build}/api/object-models/{model_id}/object-records/?result_class=1&child_class_{cid}_object_name__icontains=foobar
parent_class_{pid}_idint + enum{build}/api/object-models/{model_id}/object-records/?result_class=1&parent_class_{pid}_id=3
parent_class_{pid}_created_atdatetime{build}/api/object-models/{model_id}/object-records/?result_class=1&parent_class_{pid}_created_at__gte=2022-01-01
parent_class_{pid}_created_byset{build}/api/object-models/{model_id}/object-records/?result_class=1&parent_class_{pid}_created_by__in=123,234,345
parent_class_{pid}_modified_atdatetime{build}/api/object-models/{model_id}/object-records/?result_class=1&parent_class_{pid}_modified_at__range=2022-01-01,2022-01-31
parent_class_{pid}_modified_byset{build}/api/object-models/{model_id}/object-records/?result_class=1&parent_class_{pid}_modified_by=123
parent_class_{pid}_object_namestring{build}/api/object-models/{model_id}/object-records/?result_class=1&parent_class_{pid}_object_name__icontains=foobar

result_class is required

show_fields is required to attach fields with their value to the response each object record. It is possible to specify multiple fields by separating them with a comma. Max 10 fields.

Object Class Fields Query String parameters are included in Object Classes - GET /api/object-classes/{object_class_id}/fields/autocomplete/ endpoint.

This endpoint contains also predicates assigned for each type.

The fields types / columns available for filtering :

bool
string
int
float
date
datetime
email
phone
url
set
enum
user
document

At most, 10 total fields of any type from the object class are allowed for filtering.

For predicates in, containssome, containsall values must be separated by comma ,. If single value contains comma inside, char must be escaped by \,.

?result_class_field_set__in=first\,text,second

The User type field is unique because it stores both a list of users and groups. Therefore, filtering by this field requires specifying which of these values will be filtered.

?result_class_field_user__users__containsall=1,2,3

?result_class_field_user__user_groups__containssome=21,42,54

The Document type field supports only isempty predicate. It checks whether the field contains any files or not.

?result_class_field_document__isempty=true

ParameterTypeExample
field_<bool_type_alias>bool{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_bool_alias=false&child_class_{cid}_field_bool_alias=false
field_<text_type_alias>string{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_string_alias__contains=test&child_class_{cid}_field_string_alias=aa
field_<integer_type_alias>int{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_integer__gt=1&child_class_{cid}_field_integer__lt=3
field_<decimal_type_alias>int{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_decimal__gt=1.5&child_class_{cid}field_decimal=3.2&parent_class_field_decimal__gt=2.9
field_<date_type_alias>date{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_date=2000-09-23&child_class_{cid}_field_date=2000-09-21
field_<datetime_type_alias>datetime{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_datetime=2000-09-23 10:00:00&child_class_{cid}_field_datetime__gt=2000-09-23 11:00:00
field_<email_type_alias>string{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_email__contains=test&child_class_{cid}_field_email__contains=aa
field_<phone_type_alias>string{build}/api/object-models/{model_id}/object-records/?result_classd=1&result_class_field_phone__contains=123&child_class_{cid}_field_phone=12345678
field_<url_type_alias>url{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_url__iexact=http://website.sample&child_class_{cid}_field_url__contains=test
field_<set_type_alias>set{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_set__containsall=abc,some,text,cde&child_class_{cid}_field_set__containssome=aaa,bbb
field_<enum_type_alias>enum{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_enum__in=abc,some,text,cde&child_class_{cid}_field_enum=ccc
field_<user_type_alias>user{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_user__users__containsall=1,2,3&child_class_{cid}__field_user__users__containsall=1,2
field_<user_type_alias>user{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_user__user_groups__containssome=21,42,54&child_class_{cid}__field_user__user_groups__containsall=21
field_<document_type_alias>document{build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_field_document__isempty=false&parent_class_{pid}_field_document__isempty=true

Errors

ErrorResponse codeMessage
Filter created_by with wrong user id400 Bad Request"detail": {"created_by": ["Select a valid choice. That choice is not one of the available choices."]}
Filter modified_by with wrong user id400 Bad Request"detail": {"modified_by": ['Select a valid choice. That choice is not one of the available choices."]}
Missing object_class parameter400 Bad request"detail": { "object_class": ["This field is required"] }
Invalid object_class parameter400 Bad request"detail": { "object_class": ["Invalid pk "{object_class}" - object does not exist."] }
More that 10 combined filter params400 Bad Request"detail": ["Too many filters. Max = {MAX}"]
Invalid Child Class parameter400 Bad Request"detail": ["Invalid parameter "child_class_field". Expected "child_class_{id}_{expression}"."]
Invalid Parent Class parameter400 Bad Request"detail": ["Invalid parameter "parent_class_field". Expected "parent_class_{id}_{expression}"."]
Invalid Child Class id400 Bad Request"detail": ["Invalid pk "value" - object does not exist."]
Invalid Child Class type400 Bad Request"detail": ["Invalid child class id. Must be an integer in "child_class_{type}_id"."]
Invalid Parent Class type400 Bad Request"detail": ["Invalid parent class id. Must be an integer in "parent_class_{type}_id"."]
Relation not exists.400 Bad Request"detail": ["Object Class ID "{child_class.id}" is not related with parent Class ID "{result_class.id}"."]
Wrong class field type decimal value400 Bad Request"detail": { "field_decimal": ["A valid number is required."] }
Range filter for class field of int type must include exact 2 numbers400 Bad Request"detail": { "field_integer": ["Range query expects two values."] }
Wrong class field type string value400 Bad Request"detail": { "field_text": ["Field "field_text" expected a string but got ""number"" ] }
Wrong datetime format for datetime field type400 Bad Request"detail": { "field_datetime": ["Datetime has wrong format. Use one of these formats instead: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM-HH:MM Z]."]}
Wrong date format for date field type400 Bad Request"detail": { "field_date": ["Date has wrong format. Use one of these formats instead: YYYY-MM-DD."]}
Wrong value for choice/multichoice field type400 Bad Request"detail": { "field_set": [" "{value}" is not a valid choice."]}
Wrong value for user field type400 Bad Request"detail": { "field_user": [" "{value}" is not a valid choice."]}
Wrong value type for user field type400 Bad Request"detail": { "field_user": ["The value must be an array of integers."]}
Requesting user is not authenticated401 Unauthorized"detail": "Authentication credentials were not provided."

GET /api/object-models/id/object-classes/hierarchy/class_id/

Returning the Object Classes list with the support for relational hierarchy of Object Class in Object Model.

Permissions

Requires authentication and object_classes.view permission for the specific Object Class.

Request

  • URL parameters
KeyTypeNotes
ididObject Model
class_ididObject Class
  • Headers
Content-Type: application/json
Authorization: JWT access_token

Response array

KeyTypeNotes
idintObject Class id
namestringObject Class name
has_childrenboolObject Class has children
children_countintObject Class children count
childrenlist[dict]List of children Object Classes
  • Successful status 200 OK
  • Response body schema:

Important

Parent class names are show only if the user has view class permission for the given parent class. Otherwise "name": NULL.

json
[
  {
    "id": <int>,
    "name": <str>,
    "has_children": <bool>,
    "children_count": <int>,
    "children": <list>
  }
]

Errors

ErrorResponse codeMessage
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."
Object Model with "id" does not exist404 Not Found"detail": "Not found."
Object Class with "id" does not exist404 Not Found"detail": "Not found.

GET /api/object-models/id/object-classes/hierarchy/

Returning the Object Classes list with the support for relational hierarchy of Object Class in Object Model.

Permissions

Requires authentication and object_classes.view permission for the specific Object Class.

Request

  • URL parameters
KeyTypeNotes
ididObject Model
  • Headers
Content-Type: application/json
Authorization: JWT access_token

Response array

KeyTypeNotes
idintObject Class id
namestringObject Class name
has_childrenboolObject Class has children
children_countintObject Class children count
childrenlist[dict]List of children Object Classes
  • Successful status 200 OK
  • Response body schema:

Important

Parent class names are show only if the user has view class permission for the given parent class. Otherwise "name": NULL.

json
[
  {
    "id": <int>,
    "name": <str>,
    "has_children": <bool>,
    "children_count": <int>,
    "children": <list>
  }
]

Errors

ErrorResponse codeMessage
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."
Object Model with "id" does not exist404 Not Found"detail": "Not found."
Object Class with "id" does not exist404 Not Found"detail": "Not found.

POST /api/object-models/id/object-records/

Creates Object Record Relations.

Permissions

Requires authentication.

Request

  • Headers
Request Method: POST
Authorization: JWT access_token
  • Body
KeyTypeNotes
object_recordintObject Record id
parentintObject Record id

Validations

  • object_record
    • This field is required.
    • This field may not be null.
    • Invalid pk "value" - object does not exist.
    • Invalid pk "value" - You do not have object_records.view permission for this Record.
    • Only one child Record of class "class_name" is allowed.
    • Invalid pk "value" - Record of class "class_name" can’t be added as a child.
  • parent
    • This field is required.
    • This field may not be null.
    • Invalid pk "value" - object does not exist.
    • Invalid pk "value" - You do not have object_records.view permission for this Record.

Sample request body

json
POST /api/object-models/1/object-records/

{ 
  "object_record": 2,
  "parent": 3
}

Response

KeyTypeNotes
object_recordint
parentint
created_atdatetime
created_byuser
  • Successful status 201 Created
  • Response body schema
json
{
    "object_record": 2,
    "parent": 3,
    "created_at": "2022-11-17T14:40:54.687803+01:00",
    "created_by": {
        "id": 2,
        "first_name": "ALX",
        "last_name": "Developer",
        "username": "alx.dev@autologyx.com",
        "company_name": "",
        "is_deleted": false,
        "account_type": "super_admin"
    },
    "_meta": {
        "labels": {
            "object_record": "Some name2",
            "parent": "Some name3"
        }
    }
}

Errors

CauseResponse codeMessage
object_record missing400 Bad Request"object_record": ["This field is required."]
object_record is null400 Bad Request"object_record": [ "This field may not be null."]
object_record insufficient permissions400 Bad Request"object_record": ["Invalid pk "value" - You do not have permission for this Record."]
object_record invalid ID400 Bad Request"object_record": ["Invalid pk "value" - object does not exist."]
object_record to many children400 Bad Request"object_record": ["Only one child Record of class "value" is allowed."]
object_record invalid relation400 Bad Request"object_record": ["Invalid pk "value" - Record of class "class_name" can’t be added as a child."]
parent missing400 Bad Request"parent": ["This field is required."]
parent is null400 Bad Request"parent": [ "This field may not be null."]
parent insufficient permissions400 Bad Request"parent": ["Invalid pk "value" - You do not have permission for this Record."]
parent invalid ID400 Bad Request"parent": ["Invalid pk "value" - object does not exist."]
parent object_record not unique400 Bad Request"non_field_errors": ["The fields object_record, parent must make a unique set."]
Invalid id in URL404 Not Found"detail": ["Not found."]
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."

POST /api/object-models/id/object-records/batch/

Creates Object Records Relations.

Permissions

Requires authentication.

Request

  • Headers
Request Method: POST
Authorization: JWT access_token
  • Body
KeyTypeNotes
object_recordslistObject Records ids list
parentintObject Record id

Validations

  • object_records
    • This field is required.
    • This field may not be null.
    • Invalid pk "value" - object does not exist.
    • Up to 50 items allowed.
  • parent
    • This field is required.
    • This field may not be null.
    • Invalid pk "value" - object does not exist.
    • Invalid pk "value" - You do not have permission for this Record.

Sample request body

json
POST /api/object-models/1/object-records/batch

{ 
  "object_records": [1,2],
  "parent": 3
}

Response

KeyTypeNotes
object_recordlist
parentint
_meta.labelsObjectObject contains labels for Object Records
  • Successful status 201 Created
  • Response body schema
json
{   
    "parent": 3,
    "object_record": [1,2],
    "_meta": {
        "labels": {
            "parent": "some name3"
            "object_class": ["some name1", "some name2"]
        }
    }
}

Errors

CauseResponse codeMessage
object_records missing400 Bad Request"object_records": ["This field is required."]
object_records is null400 Bad Request"object_records": [ "This field may not be null."]
object_records invalid ID400 Bad Request"object_records": ["Invalid pk "value" - object does not exist."]
object_records limit exceed400 Bad Request"object_records": ["Up to 50 items allowed."]
parent missing400 Bad Request"parent": ["This field is required."]
parent is null400 Bad Request"parent": ["This field may not be null."]
parent insufficient permissions400 Bad Request"parent": ["Invalid pk "value" - You do not have permission for this Record."]
parent invalid ID400 Bad Request"parent": ["Invalid pk "value" - object does not exist."]
Invalid id in URL404 Not Found"detail": ["Not found."]
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."

OPTIONS /api/object-models/id/object-records/batch/

Permissions

Requires authentication only.

Request

  • Headers
Content-Type: application/json
Authorization: JWT access_token
  • Schema
json
OPTIONS /api/object-models/1/object-records/batch/

Response

  • Successful status 200 OK
  • Response body:
json
{
    "batch": {
        "schema": [
            {
                "alias": "object_records",
                "type": "set",
                "required": true,
                "autocomplete": "/api/object-records/autocomplete/?object_class={object_class_id}&text__icontains="
            }
        ]
    },
    "restrictions": {
        "limit_items_in_batch": 50
    }
}

GET /api/object-models/id/object-records/parent_record_id/children/

Retrieve children Object Records list.

Permissions

Requires authentication and object_records.view permission for the given parent and children object record.

Request

  • URL parameters
KeyTypeNotes
idpk
parent_record_idpk

Important

To retrieve children Object Records list - param filter object_record__object_class is necessary. The value is an id of the child Object Class. More in Filtering section.

  • Headers
GET /api/object-models/1/object-records/1/children/?object_record__object_class=1&show_fields=field_alias_1,field_alias_2

Request Method: GET
Authorization: JWT access_token

Response

KeyTypeNotes
limitint
offsetint
total_countintTotal number of results visible to the user (based on permissions).
filtered_countintNumber of results visible to the user (based on permissions) with filters applied.
nexturlNext page URL (null if there is no next page)
previousurlPrevious page URL (null if there is no previous page)
resultsArrayList of results. Described in the next table.

Response results array

KeyTypeNotes
object_recordObjectObject Records
created_atdatetime
created_byuser
_meta.permissionsObject
  • Successful status 200 OK
  • Response body schema
json
{
  "limit": <int>,
  "offset": <int>,
  "filtered_count": <int>,
  "total_count": <int>,
  "next": <str | null>,
  "previous": <str | null>,
  "results": [
    {
      "object_record": { 
        "id": <object_record_id>, 
        "object_name": <str>, 
        "object_class": <object_class_id>, 
        "status": "initiated",
        "created_at": <datetime>, 
        "created_by": <user>, 
        "modified_at": <datetime>, 
        "modified_by": <user>, 
        "_meta": { 
          "labels": { 
            "object_class": <object_class_label>, 
          }, 
          "allowed_status_transitions": [ ],
          "forbidden_actions": [ ],
        },
        "field_alias_1" = <any>,
        "field_alias_2" = <any>
      },
      "created_at": <datetime>,
      "created_by": <user>,
      "_meta": { 
        "permissions": { 
          "list": true, 
          "view": true, 
          "create": true, 
          "edit": true, 
          "delete": true 
        } 
      } 
    }
  ]
}

Sorting

ParameterExampleNotes
object_record__id?ordering=object_record__idAscending
object_record__id?ordering=-object_record__idDescending (-)
object_record__created_at?ordering=object_record__created_atAscending
object_record__created_at?ordering=-object_record__created_atDescending (-)
object_record__modified_at?ordering=object_record__modified_atAscending
object_record__modified_at?ordering=-object_record__modified_atDescending (-)
created_at?ordering=created_atAscending
created_at?ordering=-created_atDescending (-)
<field_alias>{build}/api/object-records/?object_class=12&show_fields=field_alias&ordering=field_aliasAscending
<field_alias>{build}/api/object-records/?object_class=12&show_fields=field_alias&ordering=-field_aliasDescending (-)

Ordering by object record fields is possible only if the field is included in the show_fields parameter and works in the similar way as defined in the Ordering by related Object Class Fields section.

Filtering

ParameterTypeNotesSample url param
object_record__object_classpkFilter is required. The value must be the ID of the "child class"&object_record__object_class=1
show_fieldsArray[str]Filter is optional. Only the specified fields are returned in the response. Param should be given as list of field_{alias}&show_fields=field_{alias_1},field_{alias_2}

Errors

CauseResponse codeMessage
object_record__object_class missing400 Bad Request"object_record__object_class": ["This field is required"]
To many fields selected400 Bad Request"show_fields": ["At most {limit} values are allowed."]
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."
Invalid id in URL404 Not Found"detail": ["Not found."]
Invalid parent_record_id in URL404 Not Found"detail": ["Not found."]

GET /api/object-models/id/object-records/child_record_id/parents/

Retrieve a list of all parent records for a given child. The list will include only one level (one level up) of parent.

Permissions

Requires authentication and object_records.view permission for the given child and parent object records.

Request

  • URL parameters
KeyTypeNotes
idpk
child_record_idpk
  • Headers
GET /api/object-models/1/object-records/1/parents/?show_fields=field_alias_1,field_alias_2

Request Method: GET
Authorization: JWT access_token

Response

KeyTypeNotes
limitint
offsetint
total_countintTotal number of results visible to the user (based on permissions).
filtered_countintNumber of results visible to the user (based on permissions) with filters applied.
nexturlNext page URL (null if there is no next page)
previousurlPrevious page URL (null if there is no previous page)
resultsArrayList of results. Described in the next table.

Response results array

KeyTypeNotes
object_recordObjectObject Records
created_atdatetimeThe date and time when the relation between child and parent object record was created
created_byuserThe user who create the relation between child and parent object record
_meta.permissionsObject
  • Successful status 200 OK
  • Response body schema
json
{
  "limit": <int>,
  "offset": <int>,
  "filtered_count": <int>,
  "total_count": <int>,
  "next": <str | null>,
  "previous": <str | null>,
  "results": [
    {
      "object_record": { 
        "id": <object_record_id>, 
        "object_name": <str>, 
        "object_class": <object_class_id>, 
        "status": "initiated",
        "created_at": <datetime>, 
        "created_by": <user>, 
        "modified_at": <datetime>, 
        "modified_by": <user>, 
        "_meta": { 
          "labels": { 
            "object_class": <object_class_label>, 
          }, 
          "allowed_status_transitions": [ ],
          "forbidden_actions": [ ],
        },
        "field_alias_1" = <any>,
        "field_alias_2" = <any>
      },
      "created_at": <datetime>,
      "created_by": <user>,
      "_meta": { 
        "permissions": { 
          "list": true, 
          "view": true, 
          "create": true, 
          "edit": true, 
          "delete": true 
        } 
      } 
    }
  ]
}

Sorting

ParameterExampleNotes
object_record__id?ordering=object_record__idAscending
object_record__id?ordering=-object_record__idDescending (-)
object_record__created_at?ordering=object_record__created_atAscending
object_record__created_at?ordering=-object_record__created_atDescending (-)
object_record__modified_at?ordering=object_record__modified_atAscending
object_record__modified_at?ordering=-object_record__modified_atDescending (-)
created_at?ordering=created_atAscending
created_at?ordering=-created_atDescending (-)
<field_alias>{build}/api/object-records/?object_class=12&show_fields=field_alias&ordering=field_aliasAscending
<field_alias>{build}/api/object-records/?object_class=12&show_fields=field_alias&ordering=-field_aliasDescending (-)

Ordering by object record fields is possible only if the field is included in the show_fields parameter and works in the similar way as defined in the Ordering by related Object Class Fields section.

Filtering

ParameterTypeNotesSample url param
show_fieldsArray[str]Filter is optional. Only the specified fields are returned in the response. Param should be given as list of field_{alias}&show_fields=field_{alias_1},field_{alias_2}

Errors

CauseResponse codeMessage
To many fields selected400 Bad Request"show_fields": ["At most {limit} values are allowed."]
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."
Invalid id in URL404 Not Found"detail": ["Not found."]
child_record_id is a top parent object record404 Not Found"detail": ["Not found."]
Invalid id in URL404 Not Found"detail": ["Not found."]
Invalid child_record_id in URL404 Not Found"detail": ["Not found."]
Any other request method is used405 Method not allowed

DELETE /api/object-models/id/object-records/parent_id/children/child_id/

Deletes single object relation record.

Permissions

Requires authentication and object_records.view permission for given parent and child.

Request

  • URL parameters
KeyTypeNotes
idpk
parent_idpk
child_idpk
  • Headers
Content-Type: application/json
Authorization: JWT access_token
  • Schema
json
DELETE /api/object-models/`id`/object-records/`parent_id`/children/`child_id`/

Response

  • Successful status 204 No Content

Errors

ErrorResponse codeMessage
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."
Invalid id in URL404 Not Found"detail": "Not found."
Invalid parent_id in URL404 Not Found"detail": "Not found."
Invalid child_id in URL404 Not Found"detail": "Not found."

OPTIONS /api/object-models/id/object-records/parent_id/children/

Permissions

Requires authentication only.

Request

  • Headers
Content-Type: application/json
Authorization: JWT access_token
  • Schema
json
OPTIONS /api/object-models/`id`/object-records/`parent_id`/children/

Response

  • Successful status 200 OK
  • Response body:
json
{
  "list": {
    "columns": [
      {
        "alias": "object_record",
        "schema": [
          {
            "alias": "id",
            "type": "int",
            "predicates": [],
            "sort_ok": true
          },
          {
            "alias": "object_name",
            "type": "string",
            "predicates": [],
            "sort_ok": false
          },
          {
            "alias": "object_class",
            "type": "int",
            "predicates": [
              "exact",
              "gt",
              "gte",
              "lt",
              "lte",
              "range"
            ],
            "sort_ok": false
          },
          {
            "alias": "created_at",
            "type": "datetime",
            "predicates": [],
            "sort_ok": true
          },
          {
            "alias": "created_by",
            "type": "user",
            "predicates": [],
            "sort_ok": false
          },
          {
            "alias": "modified_at",
            "type": "datetime",
            "predicates": [],
            "sort_ok": true
          },
          {
            "alias": "modified_by",
            "type": "user",
            "predicates": [],
            "sort_ok": false
          }
        ]
      },
      {
        "alias": "created_at",
        "type": "datetime",
        "predicates": [],
        "sort_ok": false
      },
      {
        "alias": "created_by",
        "type": "user",
        "predicates": [],
        "sort_ok": false
      }
    ]
  },
  "details": {
    "schema": [
      {
        "alias": "object_record",
        "type": "enum",
        "required": true,
        "autocomplete": "/api/object-records/autocomplete/?object_class={object_class_id}&text__icontains="
      }
    ]
  }
}

GET /api/object-models/id/object-records/parent_id/children/autocomplete/

API for searching Object Records to be added as child in relation.

Important

Access to endpoint require passing Object Class filter /api/object-models/<id>/object-records/<parent_id>/children/autocomplete/?object_class=object_class_id>

Permissions

Requires authentication and object_records.view permission for the given parent.

Request example

  • Headers
Request Method: GET
Authorization: JWT access_token

Response

KeyTypeNotes
limitint
offsetint
total_countintTotal number of items visible to the user (based on permissions).
filtered_countintNumber of items visible to the user (based on permissions) with filters applied.
nextURL / nullNext page URL (null if there is no next page)
previousURL / nullPrevious page URL (null if there is no previous page)
resultsArrayDescribed in the next table.

Response results array

KeyTypeNotes
valueid
textstring
is_childboolRecords that are children of given parent are marked as true

Response example

  • Status 200 OK
  • Body
json
{
  "limit": 100,
  "offset": 0,
  "filtered_count": 2,
  "total_count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "value": 21,
      "text": "21",
      "is_child": true,
      "status": "initiated",
      "_meta": {
        "allowed_status_transitions": [],
        "forbidden_actions": []
      }
    },
    {
      "value": 20,
      "text": "20",
      "is_child": false,
      "_meta": {
        "allowed_status_transitions": [],
        "forbidden_actions": []
      }
    }
  ]
}

Filtering

For the full description of standard predicates see ALX API standards - Developers guide.

ParameterTypeExample
object_classenumautocomplete/?object_class=12
textstringautocomplete/?object_class=12&text__icontains=foobar

object_class is required

ErrorResponse status codeResponse message
Invalid id in URL404 Not Found"detail": ["Not found."]
Invalid parent_id in URL404 Not Found"detail": ["Not found."]
Missing object_class parameter400 Bad Request"detail": { "object_class": ["This field is required.” ] }
Invalid object_class parameter400 Bad Request"detail": { "object_class": ["This class is not related with given parent."]}
Insufficient permissions to parent record403 Forbidden"detail": "You do not have permission to perform this action."

POST /api/object-models/model_id/object-records/descendants/

Creates parent and child Object Records with relations simultaneously.

Permissions

Requires authentication.

Request

  • Headers
Request Method: POST
Authorization: JWT access_token
  • Body
KeyTypeRequiredNotes
object_classstringtrue
childrenstringtrueRequired only for root Object Class (first level).

Validations

  • object_class
    • This field is required.
    • This field may not be null.
  • children
    • This field is required (only for first level tree)
    • This field is list or null

Sample request body

json
POST /api/object-models/1/object-records/descendants/

{
  "object_class": <int>,
  "field_<field_alias>": <any_allowed>,
  ...
  "children": [
    {
      "object_class": <int>,
      "field_<field_alias>": <any_allowed>,
      "field_<field_alias>": <any_allowed>,
      ...
      "children": [
        {
          "object_class": <int>,
          "children": []
        }
      ]
    },
    {
      "object_class": <int>,
      "children": []
    }
  ]
}

Response

KeyTypeNotes
iduuid
statusstring
urlstring
  • Successful status 201 Created
  • Response body schema
json
{
  "id": "7fa04f22-b30a-4e83-b2c0-5087d9d224e5",
  "status": "queued",
  "url": "https://test.com/api/object-models/1/object-records/transactions/7fa04f22-b30a-4e83-b2c0-5087d9d224e5/" 
}

Errors

CauseResponse codeMessage
Maximum of limit records passed in the request400 Bad Request"detail": ["Limit of "limit" records that can be passed in one request has been exceeded."]
Invalid data structure400 Bad Request"detail": ["Incorrect data structure."]
Requesting user is not authenticated401 Unauthorized"detail": "Authentication credentials were not provided."

GET /api/object-models/1/object-records/descendants/

Response example

  • Status 405 Method Not Allowed

PATCH /api/object-models/1/object-records/descendants/

Response example

  • Status 405 Method Not Allowed

PUT /api/object-models/1/object-records/descendants/

Response example

  • Status 405 Method Not Allowed

DELETE /api/object-models/1/object-records/descendants/

Response example

  • Status 405 Method Not Allowed

OPTIONS /api/object-models/1/object-records/descendants/

Response example

  • Status 405 Method Not Allowed

GET /api/object-models/id/object-records/transactions/transaction_id/

Returns single object transaction by id.

Important

Processed transactions, whether successful or failed, are automatically deleted 7 days after the completion of processing.

Permissions

Requires authentication.

Request

  • URL parameters
KeyTypeNotes
iduuid
  • Headers
Content-Type: application/json
Authorization: JWT access_token

Response

KeyTypeNotes
iduuidAutomatically generated by the backend.
statusstring
error_messagestring
created_recordsArraylist of all records created in the transaction, grouped by their object class

Request created_records array

The created_records list is returned only when the transaction has status completed. For the other statuses, the created_records field is present but is always an empty list []

KeyTypeNotes
object_classintObject Class id
object_recordsArrayArray of record IDs created in that class as part of this transaction.
  • Successful status 200 OK
  • Response body schema:
json
{
  "id": <UUID>,
  "status": <enum>,
  "error_message" <object>
}

"error_message" details:

  • Errors for Object Records creation.
Errorerror_message
Invalid class id{"object_class": ["Invalid pk "class_id" - object does not exist."]}
Invalid class type{"object_class": ["Incorrect type. Expected pk value, received {type}."]}
Insufficient permissions to create Object Record{"object_class": ["You do not have permission to create Object Record for Object Class ID "class_id""]}
Object Record limit exceed{"detail" ["Limit of {limit} number of Object Records in Object Class ID "class_id" has been exceeded."]}
  • Errors for creating a relationship between parents and child Object Records.
Errorerror_message
Relationship between classes does not exist{"detail": ["Object Class ID "parent_class_id" is not related with parent Class ID "parent_class_id"."]}
Multiplicity exceed{"detail": ["Only one child Record of Object Class ID "class_id" is allowed."]}
  • Errors for each type of Object Record Field.
Errorerror_message
All errors follow the same pattern{"object_class": {"id": {class_id}, "errors": {"field_slug1": [Object Record Field Errors ...]}}}

Errors

ErrorResponse codeMessage
Requesting user is not authenticated401 Unauthorized"detail": "You do not have permission to perform this action."
Object Model with "id" does not exist404 Not Found"detail": "Not found."
Transaction ID does not exist404 Not Found"detail": "Not found."

POST /api/object-models/id/object-records/transactions/

Response example

  • Status 404 Not Found

POST /api/object-models/id/object-records/transactions/transaction_id/

Response example

  • Status 405 Method Not Allowed

PATCH /api/object-models/id/object-records/transactions/transaction_id/

Response example

  • Status 405 Method Not Allowed

PUT /api/object-models/id/object-records/transactions/transaction_id/

Response example

  • Status 405 Method Not Allowed

DELETE /api/object-models/id/object-records/transactions/transaction_id/

Response example

  • Status 405 Method Not Allowed

OPTIONS /api/object-models/id/object-records/transactions/transaction_id/

Response example

  • Status 405 Method Not Allowed