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
| Key | Type | Required | Notes |
|---|---|---|---|
| name | string | true | |
| description | string | false | |
| object_classes | Array | true | Relations between object classes |
Request object_classes array
| Key | Type | Notes |
|---|---|---|
| object_class | int | Object Class id |
| multiplicity | string | Choices: (zero_or_more, zero_or_one) |
| parent | int | Object Class id |
| removable_relation | bool | False 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_multiplicity | bool | False 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
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
| Key | Type | Notes |
|---|---|---|
| id | int | Automatically generated by the backend. |
| name | string | |
| description | string | |
| object_classes | Array | |
| created_at | datetime | |
| created_by | user | |
| modified_at | datetime | |
| modified_by | user | |
| _meta.permissions | Object | Dict describing permissions. |
Response object_classes array
| Key | Type | Notes |
|---|---|---|
| object_class | int | Object Class id |
| multiplicity | string | Choices: (zero_or_more, zero_or_one) |
| parent | int | Object Class id |
| _meta.labels | Object | Object contains labels for Object Class |
- Successful status
201 Created - Response body schema
{
"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
| Cause | Response code | Message |
|---|---|---|
| name missing | 400 Bad Request | "name": ["This field is required."] |
| name is empty | 400 Bad Request | "name": [ "This field may not be blank."] |
| name is null | 400 Bad Request | "name": [ "This field may not be null."] |
| name to long | 400 Bad Request | "name": ["Ensure this field has no more than 100 characters."] |
| description to long | 400 Bad Request | "description": ["Ensure this field has no more than 500 characters."] |
| description is null | 400 Bad Request | "description": [ "This field may not be null."] |
| object_classes missing | 400 Bad Request | "object_classes": ["This field is required."] |
| object_classes is null | 400 Bad Request | "object_classes": [ "This field may not be null." ] |
| object_classes not a list | 400 Bad Request | "object_classes": {"non_field_errors": ["Expected a list of items but got type "type"."]} |
| object_classes contains loop | 400 Bad Request | "object_classes": {"non_field_errors": ["Relation contains loop."]} |
| object_classes to many parents | 400 Bad Request | "object_classes": {"non_field_errors": ["Limit of "limit" top parents exceeded."]} |
| object_class missing | 400 Bad Request | "object_classes": {"object_class": ["This field is required."]} |
| object_class invalid ID | 400 Bad Request | "object_classes": {"object_class": ["Invalid pk "value" - object does not exist."]} |
| object_class is null | 400 Bad Request | "object_classes": {"object_class": ["This field may not be null."]} |
| object_class not unique | 400 Bad Request | "object_classes": {"object_class": ["The object class "value" might be given only once."]} |
| multiplicity missing | 400 Bad Request | "object_classes": {"multiplicity": ["This field is required."]} |
| multiplicity is null | 400 Bad Request | "object_classes": {"multiplicity": [ "This field may not be null." ]} |
| multiplicity invalid value | 400 Bad Request | "object_classes": {"multiplicity": [""value" is not a valid choice."]} |
| parent invalid ID | 400 Bad Request | "object_classes": {"parent": ["Invalid pk "value" - object does not exist."]} |
| parent ID not on the list | 400 Bad Request | "object_classes": {"parent": ["Invalid pk "value" - Object Class not added to Object Model Definition."]} |
| relation depth exceeded | 400 Bad Request | "object_classes": {"parent": ["Relation depth limit exceeded for Object Class ID "value"."]} |
| To many children | 400 Bad Request | "object_classes": {"parent": ["Limit of "limit" children exceeded for Object Class ID "value"."]} |
| Exceeded max number of Object Model Definitions | 400 Bad Request | "detail": "Limit of 1 Object Model Definitions has been exceeded." |
| Insufficient permissions | 403 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
GET /api/object-models/Response
| Key | Type | Notes |
|---|---|---|
| limit | int | |
| offset | int | |
| total_count | int | Total number of results visible to the user (based on permissions). |
| filtered_count | int | Number of results visible to the user (based on permissions) with filters applied. |
| next | url | Next page URL (null if there is no next page) |
| previous | url | Previous page URL (null if there is no previous page) |
| results | Array | List of results. Described in the next table. |
Response results array
| Key | Type | Notes |
|---|---|---|
| id | int | Automatically generated by the backend. |
| name | string | |
| description | string | |
| created_at | datetime | |
| created_by | user | |
| modified_at | datetime | |
| modified_by | user | |
| _meta.permissions | Object | Dict describing permissions. |
- Successful status
200 OK - Response body schema
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
| Error | Response code | Message |
|---|---|---|
| Insufficient permissions | 403 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
| Key | Type | Notes |
|---|---|---|
| id | id |
- Headers
Content-Type: application/json
Authorization: JWT access_tokenResponse
| Key | Type | Notes |
|---|---|---|
| id | int | Automatically generated by the backend. |
| name | string | |
| description | string | |
| object_classes | Array | |
| created_at | datetime | |
| created_by | user | |
| modified_at | datetime | |
| modified_by | user | |
| _meta.permissions | Object | Dict describing permissions. |
Response object_classes array
| Key | Type | Notes |
|---|---|---|
| object_class | int | Object Class id |
| multiplicity | string | Choices: (zero_or_more, zero_or_one) |
| parent | int | Object Class id |
| removable_relation | bool | False 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_multiplicity | bool | False 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.labels | Object | Object contains labels for Object Class |
- Successful status
200 OK - Response body schema:
{
"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
| Error | Response code | Message |
|---|---|---|
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
| Object Model with "id" does not exist | 404 Not Found | "detail": "Not found." |
PATCH /api/object-models/id/
Updates single Object Model.
Permissions
Requires authentication and SuperAdmin permission.
Request
- URL parameters
| Key | Type | Notes |
|---|---|---|
| id | int |
- Headers
Request Method: PATCH
Authorization: JWT access_token- Body
| Key | Type | Required | Notes |
|---|---|---|---|
| name | string | true | |
| description | string | false | |
| object_classes | Array | true | Relations between object classes |
Request object_classes array
| Key | Type | Notes |
|---|---|---|
| object_class | int | Object Class id |
| multiplicity | string | Choices: (zero_or_more, zero_or_one) |
| parent | int | Object Class id |
| removable_relation | bool | False 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_multiplicity | bool | False 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
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
| Key | Type | Notes |
|---|---|---|
| id | int | Automatically generated by the backend. |
| name | string | |
| description | string | |
| object_classes | Array | |
| created_at | datetime | |
| created_by | user | |
| modified_at | datetime | |
| modified_by | user | |
| _meta.permissions | Object | Dict describing permissions. |
Response object_classes array
| Key | Type | Notes |
|---|---|---|
| object_class | int | Object Class id |
| multiplicity | string | Choices: (zero_or_more, zero_or_one) |
| parent | int | Object Class id |
| _meta.labels | Object | Object contains labels for Object Class |
- Successful status
200 OK - Response body schema
{
"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
| Cause | Response code | Message |
|---|---|---|
| name missing | 400 Bad Request | "name": ["This field is required."] |
| name is empty | 400 Bad Request | "name": [ "This field may not be blank."] |
| name is null | 400 Bad Request | "name": [ "This field may not be null."] |
| name to long | 400 Bad Request | "name": ["Ensure this field has no more than 100 characters."] |
| description to long | 400 Bad Request | "description": ["Ensure this field has no more than 500 characters."] |
| description is null | 400 Bad Request | "description": [ "This field may not be null."] |
| object_classes is null | 400 Bad Request | "object_classes": [ "This field may not be null." ] |
| object_classes not a list | 400 Bad Request | "object_classes": {"non_field_errors": ["Expected a list of items but got type "type"."]} |
| object_classes contains loop | 400 Bad Request | "object_classes": {"non_field_errors": ["Relation contains loop."]} |
| object_classes to many parents | 400 Bad Request | "object_classes": {"non_field_errors": ["Limit of "limit" top parents exceeded."]} |
| object_class missing | 400 Bad Request | "object_classes": {"object_class": ["This field is required."]} |
| object_class invalid ID | 400 Bad Request | "object_classes": {"object_class": ["Invalid pk "value" - object does not exist."]} |
| object_class is null | 400 Bad Request | "object_classes": {"object_class": ["This field may not be null."]} |
| object_class not unique | 400 Bad Request | "object_classes": {"object_class": ["The object class "value" might be given only once."]} |
| object_class existing record | 400 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 sequence | 400 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 template | 400 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 missing | 400 Bad Request | "object_classes": {"multiplicity": ["This field is required."]} |
| multiplicity is null | 400 Bad Request | "object_classes": {"multiplicity": [ "This field may not be null." ]} |
| multiplicity invalid value | 400 Bad Request | "object_classes": {"multiplicity": [""value" is not a valid choice."]} |
| multiplicity existing record | 400 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 ID | 400 Bad Request | "object_classes": {"parent": ["Invalid pk "value" - object does not exist."]} |
| parent ID not on the list | 400 Bad Request | "object_classes": {"parent": ["Invalid pk "value" - Object Class not added to Object Model Definition."]} |
| relation depth exceeded | 400 Bad Request | "object_classes": {"parent": ["Relation depth limit exceeded for Object Class ID "value"."]} |
| To many children | 400 Bad Request | "object_classes": {"parent": ["Limit of "limit" children exceeded for Object Class ID "value"."]} |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
| Invalid id in URL | 404 Not Found | "detail": ["Not found."] |
OPTIONS /api/object-models/
Permissions
Requires authentication only.
Request
- Headers
Content-Type: application/json
Authorization: JWT access_token- Schema
OPTIONS /api/object-models/Response
- Successful status
200 OK - Response body:
{
"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
| Key | Type | Notes |
|---|---|---|
| id | id | |
| class_id | id |
- Headers
Content-Type: application/json
Authorization: JWT access_tokenResponse array
| Key | Type | Notes |
|---|---|---|
| id | int | Object Class id. |
| name | string |
- 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.
[
{
"id": <int>,
"name": <str>
}
]Errors
| Error | Response code | Message |
|---|---|---|
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
| Object Model with "id" does not exist | 404 Not Found | "detail": "Not found." |
| Object Class with "id" does not exist | 404 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
| Key | Type | Notes |
|---|---|---|
| id | id | |
| class_id | id |
- Headers
Content-Type: application/json
Authorization: JWT access_tokenResponse array
| Key | Type | Notes |
|---|---|---|
| id | int | Object Class id. |
| name | string | |
| multiplicity | enum | Values: zero_or_one, zero_or_more. |
| _meta.permissions | Object | Object 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.
[
{
"id": <int>,
"name": <str>,
"multiplicity": <enum>,
"_meta": {
"labels": {
"multiplicity": <str>
},
"permissions": {
"list": <bool>,
"view": <bool>,
"object_records": {
"create": <bool>,
"list": <bool>
}
}
}
}
]Errors
| Error | Response code | Message |
|---|---|---|
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
| Object Model with "id" does not exist | 404 Not Found | "detail": "Not found." |
| Object Class with "id" does not exist | 404 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_tokenResponse
| Key | Type | Notes |
|---|---|---|
| limit | int | |
| offset | int | |
| total_count | int | Total number of items visible to the user (based on permissions). |
| filtered_count | int | Number of items visible to the user (based on permissions) with filters applied. |
| next | URL / null | Next page URL (null if there is no next page) |
| previous | URL / null | Previous page URL (null if there is no previous page) |
| results | Array | Described in the next table. |
Response results array
| Key | Type | Notes |
|---|---|---|
| id | id | |
| object_name | string | |
| object_class | int | |
| created_at | datetime | |
| created_by | user | |
| modified_at | datetime | |
| modified_by | user | |
| _meta | Object | _meta result |
Response _meta object
| Key | Type | Notes |
|---|---|---|
| permissions | Object | |
| labels | Object | |
| users | Object | Optional, added only if show_fields is passed. |
| user_groups | Object | Optional, added only if show_fields is passed. |
Response _meta.users object
| Key | Type | Notes |
|---|---|---|
| <user_id> | user |
_meta.users contains max 50 user objects for first 50 unique items from user type fields.
Response _meta.user_groups object
| Key | Type | Notes |
|---|---|---|
| <users_group_id> | Object | Contains 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
{
"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
| Parameter | Example | Notes |
|---|---|---|
| id | ..&ordering=id | Ascending |
| id | ..&ordering=-id | Descending (-) |
| created_at | ..&ordering=created_at | Ascending |
| created_at | ..&ordering=-created_at | Descending (-) |
| modified_at | ..&ordering=modified_at | Ascending |
| modified_at | ..&ordering=-modified_at | Descending (-) |
| object_name | ..&ordering=object_name | Ascending |
| object_name | ..&ordering=-object_name | Descending (-) |
| field_<field_alias> | ..&show_fields=field_alias&ordering=field_alias | Ascending |
| field_<field_alias> | ..&show_fields=field_alias&ordering=-field_alias | Descending (-) |
Ordering by related Result Class Fields
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.
Filtering by Object Record related fields
| Parameter | Type | Example |
|---|---|---|
| result_class | = | {build}/api/object-models/{model_id}/object-records/?result_class=1 |
| result_class_created_at | datetime | {build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_created_at__gte=2022-01-01 |
| result_class_created_by | set | {build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_created_by__in=123,234,345 |
| result_class_modified_at | datetime | {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_by | set | {build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_modified_by=123 |
| result_class_object_name | string | {build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_object_name__icontains=foobar |
| show_fields | string | {build}/api/object-models/{model_id}/object-records/?result_class=1&result_class_object_class=12&show_fields=field_alias |
| child_class_{cid}_id | int + enum | {build}/api/object-models/{model_id}/object-records/?result_class=1&child_class_{cid}_id=3 |
| child_class_{cid}_created_at | datetime | {build}/api/object-models/{model_id}/object-records/?result_class=1&child_class_{cid}_created_at__gte=2022-01-01 |
| child_class_{cid}_created_by | set | {build}/api/object-models/{model_id}/object-records/?result_class=1&child_class_{cid}_created_by__in=123,234,345 |
| child_class_{cid}_modified_at | datetime | {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_by | set | {build}/api/object-models/{model_id}/object-records/?result_class=1&child_class_{cid}_modified_by=123 |
| child_class_{cid}_object_name | string | {build}/api/object-models/{model_id}/object-records/?result_class=1&child_class_{cid}_object_name__icontains=foobar |
| parent_class_{pid}_id | int + enum | {build}/api/object-models/{model_id}/object-records/?result_class=1&parent_class_{pid}_id=3 |
| parent_class_{pid}_created_at | datetime | {build}/api/object-models/{model_id}/object-records/?result_class=1&parent_class_{pid}_created_at__gte=2022-01-01 |
| parent_class_{pid}_created_by | set | {build}/api/object-models/{model_id}/object-records/?result_class=1&parent_class_{pid}_created_by__in=123,234,345 |
| parent_class_{pid}_modified_at | datetime | {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_by | set | {build}/api/object-models/{model_id}/object-records/?result_class=1&parent_class_{pid}_modified_by=123 |
| parent_class_{pid}_object_name | string | {build}/api/object-models/{model_id}/object-records/?result_class=1&parent_class_{pid}_object_name__icontains=foobar |
result_classis required
show_fieldsis 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.
Filtering by related Result Class 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
| Parameter | Type | Example |
|---|---|---|
| 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
| Error | Response code | Message |
|---|---|---|
| Filter created_by with wrong user id | 400 Bad Request | "detail": {"created_by": ["Select a valid choice. That choice is not one of the available choices."]} |
| Filter modified_by with wrong user id | 400 Bad Request | "detail": {"modified_by": ['Select a valid choice. That choice is not one of the available choices."]} |
| Missing object_class parameter | 400 Bad request | "detail": { "object_class": ["This field is required"] } |
| Invalid object_class parameter | 400 Bad request | "detail": { "object_class": ["Invalid pk "{object_class}" - object does not exist."] } |
| More that 10 combined filter params | 400 Bad Request | "detail": ["Too many filters. Max = {MAX}"] |
| Invalid Child Class parameter | 400 Bad Request | "detail": ["Invalid parameter "child_class_field". Expected "child_class_{id}_{expression}"."] |
| Invalid Parent Class parameter | 400 Bad Request | "detail": ["Invalid parameter "parent_class_field". Expected "parent_class_{id}_{expression}"."] |
| Invalid Child Class id | 400 Bad Request | "detail": ["Invalid pk "value" - object does not exist."] |
| Invalid Child Class type | 400 Bad Request | "detail": ["Invalid child class id. Must be an integer in "child_class_{type}_id"."] |
| Invalid Parent Class type | 400 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 value | 400 Bad Request | "detail": { "field_decimal": ["A valid number is required."] } |
| Range filter for class field of int type must include exact 2 numbers | 400 Bad Request | "detail": { "field_integer": ["Range query expects two values."] } |
| Wrong class field type string value | 400 Bad Request | "detail": { "field_text": ["Field "field_text" expected a string but got ""number"" ] } |
| Wrong datetime format for datetime field type | 400 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 type | 400 Bad Request | "detail": { "field_date": ["Date has wrong format. Use one of these formats instead: YYYY-MM-DD."]} |
| Wrong value for choice/multichoice field type | 400 Bad Request | "detail": { "field_set": [" "{value}" is not a valid choice."]} |
| Wrong value for user field type | 400 Bad Request | "detail": { "field_user": [" "{value}" is not a valid choice."]} |
| Wrong value type for user field type | 400 Bad Request | "detail": { "field_user": ["The value must be an array of integers."]} |
| Requesting user is not authenticated | 401 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
| Key | Type | Notes |
|---|---|---|
| id | id | Object Model |
| class_id | id | Object Class |
- Headers
Content-Type: application/json
Authorization: JWT access_tokenResponse array
| Key | Type | Notes |
|---|---|---|
| id | int | Object Class id |
| name | string | Object Class name |
| has_children | bool | Object Class has children |
| children_count | int | Object Class children count |
| children | list[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.
[
{
"id": <int>,
"name": <str>,
"has_children": <bool>,
"children_count": <int>,
"children": <list>
}
]Errors
| Error | Response code | Message |
|---|---|---|
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
| Object Model with "id" does not exist | 404 Not Found | "detail": "Not found." |
| Object Class with "id" does not exist | 404 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
| Key | Type | Notes |
|---|---|---|
| id | id | Object Model |
- Headers
Content-Type: application/json
Authorization: JWT access_tokenResponse array
| Key | Type | Notes |
|---|---|---|
| id | int | Object Class id |
| name | string | Object Class name |
| has_children | bool | Object Class has children |
| children_count | int | Object Class children count |
| children | list[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.
[
{
"id": <int>,
"name": <str>,
"has_children": <bool>,
"children_count": <int>,
"children": <list>
}
]Errors
| Error | Response code | Message |
|---|---|---|
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
| Object Model with "id" does not exist | 404 Not Found | "detail": "Not found." |
| Object Class with "id" does not exist | 404 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
| Key | Type | Notes |
|---|---|---|
| object_record | int | Object Record id |
| parent | int | Object 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.viewpermission 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.viewpermission for this Record.
Sample request body
POST /api/object-models/1/object-records/
{
"object_record": 2,
"parent": 3
}Response
| Key | Type | Notes |
|---|---|---|
| object_record | int | |
| parent | int | |
| created_at | datetime | |
| created_by | user |
- Successful status
201 Created - Response body schema
{
"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
| Cause | Response code | Message |
|---|---|---|
| object_record missing | 400 Bad Request | "object_record": ["This field is required."] |
| object_record is null | 400 Bad Request | "object_record": [ "This field may not be null."] |
| object_record insufficient permissions | 400 Bad Request | "object_record": ["Invalid pk "value" - You do not have permission for this Record."] |
| object_record invalid ID | 400 Bad Request | "object_record": ["Invalid pk "value" - object does not exist."] |
| object_record to many children | 400 Bad Request | "object_record": ["Only one child Record of class "value" is allowed."] |
| object_record invalid relation | 400 Bad Request | "object_record": ["Invalid pk "value" - Record of class "class_name" can’t be added as a child."] |
| parent missing | 400 Bad Request | "parent": ["This field is required."] |
| parent is null | 400 Bad Request | "parent": [ "This field may not be null."] |
| parent insufficient permissions | 400 Bad Request | "parent": ["Invalid pk "value" - You do not have permission for this Record."] |
| parent invalid ID | 400 Bad Request | "parent": ["Invalid pk "value" - object does not exist."] |
| parent object_record not unique | 400 Bad Request | "non_field_errors": ["The fields object_record, parent must make a unique set."] |
| Invalid id in URL | 404 Not Found | "detail": ["Not found."] |
| Insufficient permissions | 403 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
| Key | Type | Notes |
|---|---|---|
| object_records | list | Object Records ids list |
| parent | int | Object 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
POST /api/object-models/1/object-records/batch
{
"object_records": [1,2],
"parent": 3
}Response
| Key | Type | Notes |
|---|---|---|
| object_record | list | |
| parent | int | |
| _meta.labels | Object | Object contains labels for Object Records |
- Successful status
201 Created - Response body schema
{
"parent": 3,
"object_record": [1,2],
"_meta": {
"labels": {
"parent": "some name3"
"object_class": ["some name1", "some name2"]
}
}
}Errors
| Cause | Response code | Message |
|---|---|---|
| object_records missing | 400 Bad Request | "object_records": ["This field is required."] |
| object_records is null | 400 Bad Request | "object_records": [ "This field may not be null."] |
| object_records invalid ID | 400 Bad Request | "object_records": ["Invalid pk "value" - object does not exist."] |
| object_records limit exceed | 400 Bad Request | "object_records": ["Up to 50 items allowed."] |
| parent missing | 400 Bad Request | "parent": ["This field is required."] |
| parent is null | 400 Bad Request | "parent": ["This field may not be null."] |
| parent insufficient permissions | 400 Bad Request | "parent": ["Invalid pk "value" - You do not have permission for this Record."] |
| parent invalid ID | 400 Bad Request | "parent": ["Invalid pk "value" - object does not exist."] |
| Invalid id in URL | 404 Not Found | "detail": ["Not found."] |
| Insufficient permissions | 403 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
OPTIONS /api/object-models/1/object-records/batch/Response
- Successful status
200 OK - Response body:
{
"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
| Key | Type | Notes |
|---|---|---|
| id | pk | |
| parent_record_id | pk |
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_tokenResponse
| Key | Type | Notes |
|---|---|---|
| limit | int | |
| offset | int | |
| total_count | int | Total number of results visible to the user (based on permissions). |
| filtered_count | int | Number of results visible to the user (based on permissions) with filters applied. |
| next | url | Next page URL (null if there is no next page) |
| previous | url | Previous page URL (null if there is no previous page) |
| results | Array | List of results. Described in the next table. |
Response results array
| Key | Type | Notes |
|---|---|---|
| object_record | Object | Object Records |
| created_at | datetime | |
| created_by | user | |
| _meta.permissions | Object |
- Successful status
200 OK - Response body schema
{
"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
| Parameter | Example | Notes |
|---|---|---|
| object_record__id | ?ordering=object_record__id | Ascending |
| object_record__id | ?ordering=-object_record__id | Descending (-) |
| object_record__created_at | ?ordering=object_record__created_at | Ascending |
| object_record__created_at | ?ordering=-object_record__created_at | Descending (-) |
| object_record__modified_at | ?ordering=object_record__modified_at | Ascending |
| object_record__modified_at | ?ordering=-object_record__modified_at | Descending (-) |
| created_at | ?ordering=created_at | Ascending |
| created_at | ?ordering=-created_at | Descending (-) |
| <field_alias> | {build}/api/object-records/?object_class=12&show_fields=field_alias&ordering=field_alias | Ascending |
| <field_alias> | {build}/api/object-records/?object_class=12&show_fields=field_alias&ordering=-field_alias | Descending (-) |
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
| Parameter | Type | Notes | Sample url param |
|---|---|---|---|
| object_record__object_class | pk | Filter is required. The value must be the ID of the "child class" | &object_record__object_class=1 |
| show_fields | Array[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
| Cause | Response code | Message |
|---|---|---|
object_record__object_class missing | 400 Bad Request | "object_record__object_class": ["This field is required"] |
| To many fields selected | 400 Bad Request | "show_fields": ["At most {limit} values are allowed."] |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
Invalid id in URL | 404 Not Found | "detail": ["Not found."] |
Invalid parent_record_id in URL | 404 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
| Key | Type | Notes |
|---|---|---|
| id | pk | |
| child_record_id | pk |
- Headers
GET /api/object-models/1/object-records/1/parents/?show_fields=field_alias_1,field_alias_2
Request Method: GET
Authorization: JWT access_tokenResponse
| Key | Type | Notes |
|---|---|---|
| limit | int | |
| offset | int | |
| total_count | int | Total number of results visible to the user (based on permissions). |
| filtered_count | int | Number of results visible to the user (based on permissions) with filters applied. |
| next | url | Next page URL (null if there is no next page) |
| previous | url | Previous page URL (null if there is no previous page) |
| results | Array | List of results. Described in the next table. |
Response results array
| Key | Type | Notes |
|---|---|---|
| object_record | Object | Object Records |
| created_at | datetime | The date and time when the relation between child and parent object record was created |
| created_by | user | The user who create the relation between child and parent object record |
| _meta.permissions | Object |
- Successful status
200 OK - Response body schema
{
"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
| Parameter | Example | Notes |
|---|---|---|
| object_record__id | ?ordering=object_record__id | Ascending |
| object_record__id | ?ordering=-object_record__id | Descending (-) |
| object_record__created_at | ?ordering=object_record__created_at | Ascending |
| object_record__created_at | ?ordering=-object_record__created_at | Descending (-) |
| object_record__modified_at | ?ordering=object_record__modified_at | Ascending |
| object_record__modified_at | ?ordering=-object_record__modified_at | Descending (-) |
| created_at | ?ordering=created_at | Ascending |
| created_at | ?ordering=-created_at | Descending (-) |
| <field_alias> | {build}/api/object-records/?object_class=12&show_fields=field_alias&ordering=field_alias | Ascending |
| <field_alias> | {build}/api/object-records/?object_class=12&show_fields=field_alias&ordering=-field_alias | Descending (-) |
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
| Parameter | Type | Notes | Sample url param |
|---|---|---|---|
| show_fields | Array[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
| Cause | Response code | Message |
|---|---|---|
| To many fields selected | 400 Bad Request | "show_fields": ["At most {limit} values are allowed."] |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
Invalid id in URL | 404 Not Found | "detail": ["Not found."] |
child_record_id is a top parent object record | 404 Not Found | "detail": ["Not found."] |
Invalid id in URL | 404 Not Found | "detail": ["Not found."] |
Invalid child_record_id in URL | 404 Not Found | "detail": ["Not found."] |
| Any other request method is used | 405 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
| Key | Type | Notes |
|---|---|---|
| id | pk | |
| parent_id | pk | |
| child_id | pk |
- Headers
Content-Type: application/json
Authorization: JWT access_token- Schema
DELETE /api/object-models/`id`/object-records/`parent_id`/children/`child_id`/Response
- Successful status
204 No Content
Errors
| Error | Response code | Message |
|---|---|---|
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
| Invalid id in URL | 404 Not Found | "detail": "Not found." |
| Invalid parent_id in URL | 404 Not Found | "detail": "Not found." |
| Invalid child_id in URL | 404 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
OPTIONS /api/object-models/`id`/object-records/`parent_id`/children/Response
- Successful status
200 OK - Response body:
{
"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_tokenResponse
| Key | Type | Notes |
|---|---|---|
| limit | int | |
| offset | int | |
| total_count | int | Total number of items visible to the user (based on permissions). |
| filtered_count | int | Number of items visible to the user (based on permissions) with filters applied. |
| next | URL / null | Next page URL (null if there is no next page) |
| previous | URL / null | Previous page URL (null if there is no previous page) |
| results | Array | Described in the next table. |
Response results array
| Key | Type | Notes |
|---|---|---|
| value | id | |
| text | string | |
| is_child | bool | Records that are children of given parent are marked as true |
Response example
- Status
200 OK - Body
{
"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.
| Parameter | Type | Example |
|---|---|---|
| object_class | enum | autocomplete/?object_class=12 |
| text | string | autocomplete/?object_class=12&text__icontains=foobar |
object_classis required
| Error | Response status code | Response message |
|---|---|---|
| Invalid id in URL | 404 Not Found | "detail": ["Not found."] |
| Invalid parent_id in URL | 404 Not Found | "detail": ["Not found."] |
| Missing object_class parameter | 400 Bad Request | "detail": { "object_class": ["This field is required.” ] } |
| Invalid object_class parameter | 400 Bad Request | "detail": { "object_class": ["This class is not related with given parent."]} |
| Insufficient permissions to parent record | 403 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
| Key | Type | Required | Notes |
|---|---|---|---|
| object_class | string | true | |
| children | string | true | Required 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
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
| Key | Type | Notes |
|---|---|---|
| id | uuid | |
| status | string | |
| url | string |
- Successful status
201 Created - Response body schema
{
"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
| Cause | Response code | Message |
|---|---|---|
| Maximum of limit records passed in the request | 400 Bad Request | "detail": ["Limit of "limit" records that can be passed in one request has been exceeded."] |
| Invalid data structure | 400 Bad Request | "detail": ["Incorrect data structure."] |
| Requesting user is not authenticated | 401 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
| Key | Type | Notes |
|---|---|---|
| id | uuid |
- Headers
Content-Type: application/json
Authorization: JWT access_tokenResponse
| Key | Type | Notes |
|---|---|---|
| id | uuid | Automatically generated by the backend. |
| status | string | |
| error_message | string | |
| created_records | Array | list 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 []
| Key | Type | Notes |
|---|---|---|
| object_class | int | Object Class id |
| object_records | Array | Array of record IDs created in that class as part of this transaction. |
- Successful status
200 OK - Response body schema:
{
"id": <UUID>,
"status": <enum>,
"error_message" <object>
}"error_message" details:
- Errors for Object Records creation.
| Error | error_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.
| Error | error_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.
| Error | error_message |
|---|---|
| All errors follow the same pattern | {"object_class": {"id": {class_id}, "errors": {"field_slug1": [Object Record Field Errors ...]}}} |
Errors
| Error | Response code | Message |
|---|---|---|
| Requesting user is not authenticated | 401 Unauthorized | "detail": "You do not have permission to perform this action." |
| Object Model with "id" does not exist | 404 Not Found | "detail": "Not found." |
| Transaction ID does not exist | 404 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