Object Class Forms
Object Class forms are used for viewing, creating, and updating Object Records.
Since forms are used by Autologyx frontend, they are defined there as well. Autologyx backend provides merely storage and access to forms. It does not validate them. It does not used them in the application backend logic.
Object Class forms can be integrated with the Autologyx frontend application, or they can be used as standalone pages. The distinction is solely on the frontend and hence it has no impact on the backend / API implementation.
For now, each Object Class form is associated with one Object Class (this may change with the introduction of class relations).
In the current scope this document describes only standalone forms for creating Object Records. It will expand as needed.
Permissions
Permissions for Standalone Forms can be checked
| Context | Endpoint | Location | Available perms |
|---|---|---|---|
| Any Class | GET /api/users/permissions/ | object_class_forms | list |
| Specific Class | GET /api/object-classes/{class_id}/ | _meta.permissions.object_class_forms | list, view, edit, create, delete |
References
Object Class Forms API
POST /api/object-class-forms/
Creates new form for a given Object Class.
Permissions
Requires authentication and object_class_forms.create permission which is true if edit perm is enabled for Object Class for which the form is being created.
Required parameters
| Key | Type | Notes |
|---|---|---|
| name | string | Unique (case insensitive) for the given Object Class. Max length = 100 (configurable) |
| object_class | int | |
| type | enum | For now, only "create" value is allowed. |
| configuration | json |
Optional parameters
| Key | Type | Notes |
|---|---|---|
| is_enabled | bool | Set to "false" if omitted. |
| custom_components | set | Custom Components ids used in form configuration. |
Request example
- Headers
Request Method: POST
Location: /api/object-class-forms/
Authorization: JWT access_token{
"name": "Simple form",
"object_class": 235,
"type": "create",
"is_enabled": true,
"configuration": <json>,
"custom_components": [1, 2, 3]
}Response
| Key | Type | Notes |
|---|---|---|
| uuid | uuid | Automatically generated by the backend. |
| name | string | |
| object_class | int | |
| type | enum | For now, only "create" is supported. |
| is_enabled | bool | |
| created_at | datetime | |
| created_by | user | |
| modified_at | datetime | |
| modified_by | user | |
| _meta.labels | Object | "object_class": |
| _meta.permissions | Object | Dict describing permissions. |
- Status
201 CREATED - Body
{
"uuid": "966ab882-0120-46bc-a8e0-fe901d298063",
"name": "Simple form",
"object_class": 235,
"type": "create",
"is_enabled": true,
"created_at": "2021-08-12T11:21:51.877690+02:00",
"created_by": <user>,
"modified_at": "2021-09-14T11:11:31.127734+02:00",
"modified_by": <user>,
"_meta": {
"labels": {
"object_class": "Simple matter"
},
"permissions": {
"list": true,
"view": true,
"edit": true,
"create": true,
"delete": true,
"object_records": {
"create": true
}
}
}
}Restriction
- Maximum length of form name = 100 characters.
Errors
| Error | Response code | Message |
|---|---|---|
| "name" is missing | 400 Bad Request | "name": [ "This field is required." ] |
| "name" is empty string | 400 Bad Request | "name": [ "This field may not be blank." ] |
| "name" is null | 400 Bad Request | "name": [ "This field may not be null." ] |
| "name" has > 100 chars | 400 Bad Request | "name": [ "Ensure this field has no more than 100 characters." ] |
| "name" is not unique | 400 Bad Request | "name": [ "This field must be unique." ] |
| "object_class" is missing | 400 Bad Request | "object_class": [ "This field is required." ] |
| "object_class" is null | 400 Bad Request | "object_class": [ "This field may not be null." ] |
| "object_class" is not int | 400 Bad Request | "object_class": [ "Incorrect type. Expected pk value, received {type}." ] |
| Class with "object_class" does not exist | 400 Bad Request | "object_class": [ "Invalid pk \"{value}\" - object class does not exist." ] |
| User has not perm "edit" to given "object_class" | 400 Bad Request | "object_class": [ "You do not have permission to use this object class." ] |
| "type" is missing | 400 Bad Request | "type": [ "This field is required." ] |
| "type" is null | 400 Bad Request | "type": [ "This field may not be null." ] |
| "type" is not "create" | 400 Bad Request | "type": [ "\"{value}\" is not a valid choice." ] |
| "configuration" is missing | 400 Bad Request | "configuration": [ "This field is required." ] |
| "configuration" is null | 400 Bad Request | "configuration": [ "This field may not be null." ] |
| Number of components > 100 | 400 Bad Request | "detail": ["Ensure this list has at most 100 items."] |
| custom_components.component missing | 400 Bad Request | "custom_components": {"component": ["This field is required."]} |
| custom_components.component is empty | 400 Bad Request | "custom_components": {"component": ["This field may not be blank."]} |
| custom_components.component is null | 400 Bad Request | "custom_components": {"component": ["This field may not be null."]} |
| custom_components.component doesn't exists | 400 Bad Request | "custom_components": {"component": ["Invalid pk "99900" - object does not exist."]} |
| custom_components.component is not enabled | 400 Bad Request | "custom_components": ["Custom component 1 - object not enabled.",] |
| Max 100 forms per class exceeded | 400 Bad Request | "detail": [ "Limit of 100 standalone forms for the class has been exceeded." ] |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
GET /api/object-class-forms/
Lists Object Class forms based on query parameters and caller permissions.
Permissions
Requires authentication and object_class_forms.list permission which is true for all authenticated users.
Response contains only the forms for which the caller has object_class.view permission for the associated class.
Request example
- Headers
Request Method: GET
Location: /api/object-class-forms/
Authorization: JWT access_tokenResponse
| Key | Type | Notes |
|---|---|---|
| limit | int | |
| offset | int | |
| total_count | int | Total number of forms visible to the user (based on permissions). |
| filtered_count | int | Number of forms 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 |
|---|---|---|
| uuid | uuid | |
| name | string | |
| object_class | int | |
| type | enum | Values: create, update, summary, list, etc. For now only create is supported. |
| is_enabled | bool | |
| created_at | datetime | |
| created_by | user | |
| modified_at | datetime | |
| modified_by | user | |
| _meta.labels | Object | "object_class": |
| _meta.permissions | Object | Dict describing permissions. |
Response example
- Status
200 OK - Body
{
"limit": 100,
"offset": 0,
"filtered_count": 1,
"total_count": 20,
"next": null,
"previous": null,
"results": [
{
"uuid": "966ab882-0120-46bc-a8e0-fe901d298063",
"name": "Simple form",
"object_class": 235,
"type": "create",
"is_enabled": true,
"created_at": "2021-08-12T11:21:51.877690+02:00",
"created_by": <user>,
"modified_at": "2021-09-14T11:11:31.127734+02:00",
"modified_by": <user>,
"_meta": {
"labels": {
"object_class": "Simple matter"
},
"permissions": {
"list": true,
"view": true,
"edit": true,
"create": true,
"delete": true,
"object_records": {
"list": true,
"view": true,
"edit": true,
"create": true,
"delete": true
}
}
}
}
]
}Sorting
| Parameter | Example | Notes |
|---|---|---|
| name | {build}/api/object-class-forms/?ordering=name | Ascending |
| name | {build}/api/object-class-forms/?ordering=-name | Descending (-) |
| created_at | {build}/api/object-class-forms/?ordering=created_at | Ascending |
| created_at | {build}/api/object-class-forms/?ordering=-created_at | Descending (-) |
| modified_at | {build}/api/object-class-forms/?ordering=modified_at | Ascending |
| modified_at | {build}/api/object-class-forms/?ordering=-modified_at | Descending (-) |
Filtering
For the full description of standard predicates see ALX API standards - Developers guide.
| Parameter | Predicates | Example |
|---|---|---|
| uuid | = | {build}/api/object-class-forms/?uuid=f02bfc83-4342-495d-b092-f1e082f33abb |
| name | standard string | {build}/api/object-class-forms/?name__icontains=foobar |
| object_class | standard set | {build}/api/object-class-forms/?object_class__in=3,33,333 |
| type | standard enum | {build}/api/object-class-forms/?type__in=create |
| is_enabled | standard Boolean | {build}/api/object-class-forms/?is_enabled=true |
| created_at | standard datetime | {build}/api/object-class-forms/?created_at__gte=2022-01-01 |
| created_by | standard set | {build}/api/object-class-forms/?created_by__in=123,234,345 |
| modified_at | standard datetime | {build}/api/object-class-forms/?modified_at__range=2022-01-01,2022-01-31 |
| modified_by | standard set | {build}/api/object-class-forms/?modified_by=123 |
Errors
| Error | Response code | Message |
|---|---|---|
| Wrong ordering value | 400 Bad Request | "ordering": ["Select a valid choice. {value} is not one of the available choices."] |
GET /api/object-class-forms/form_uuid/
Retrieves the form.
Permissions
Requires authentication and object_class_forms.view permission which is true if view perm is enabled for Object Class for which the form is being created.
URL parameters
| Key | Type | Notes |
|---|---|---|
| uuid | uuid |
Request example
- Headers
Request Method: GET
Location: /api/object-class-forms/966ab882-0120-46bc-a8e0-fe901d298063/
Authorization: JWT access_tokenResponse
| Key | Type | Notes |
|---|---|---|
| uuid | uuid | |
| name | string | |
| object_class | int | |
| type | enum | |
| is_enabled | bool | |
| created_at | datetime | |
| created_by | user | |
| modified_at | datetime | |
| modified_by | user | |
| _meta.labels | Object | "object_class": |
| _meta.permissions | Object | Dict describing permissions |
Response example
- Status
200 OK - Body
{
"uuid": "966ab882-0120-46bc-a8e0-fe901d298063",
"name": "Simple form",
"object_class": 235,
"type": "create",
"is_enabled": true,
"created_at": "2021-08-12T11:21:51.877690+02:00",
"created_by": <user>,
"modified_at": "2021-09-14T11:11:31.127734+02:00",
"modified_by": <user>,
"_meta": {
"labels": {
"object_class": "Simple matter"
},
"permissions": {
"list": true,
"view": true,
"edit": true,
"create": true,
"delete": true,
"object_records": {
"create": true
}
}
}
}Errors
| Error | Response code | Message |
|---|---|---|
| Form with "uuid" does not exist | 404 Not Found | "detail": "Not found." |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
PATCH /api/object-class-forms/form_uuid/
Update the form.
Permissions
Requires authentication and object_class_forms.edit permission which is true if edit perm is enabled for Object Class for which the form is being created.
Allowed parameters
| Key | Type | Notes |
|---|---|---|
| name | string | Unique (case insensitive) for the given Object Class. Max length = 100 (configurable) |
| is_enabled | bool | |
| configuration | json | |
| custom_components | set | Custom Components ids used in form configuration. |
Any parameter not listed above are silently ignored if passed.
Request example
- Headers
Request Method: PATCH
Location: /api/object-class-forms/966ab882-0120-46bc-a8e0-fe901d298063/
Authorization: JWT access_token- Body
{
"name": "Simple form - modified",
"is_enabled": false,
"custom_components": [1, 2, 3],
}Response
| Key | Type | Notes |
|---|---|---|
| uuid | uuid | |
| name | string | |
| object_class | int | |
| type | enum | |
| is_enabled | bool | |
| created_at | datetime | |
| created_by | user | |
| modified_at | datetime | |
| modified_by | user | |
| _meta.labels | Object | "object_class": |
| _meta.permissions | Object | "object_records": |
Response example
- Status
200 OK - Body
{
"uuid": "966ab882-0120-46bc-a8e0-fe901d298063",
"name": "Simple form",
"object_class": 235,
"type": "create",
"is_enabled": true,
"created_at": "2021-08-12T11:21:51.877690+02:00",
"created_by": <user>,
"modified_at": "2021-09-14T11:11:31.127734+02:00",
"modified_by": <user>,
"_meta": {
"labels": {
"object_class": "Simple matter"
},
"permissions": {
"list": true,
"view": true,
"edit": true,
"create": true,
"delete": true,
"object_records": {
"create": true
}
}
}Errors
| Error | Response code | Message |
|---|---|---|
| Form with "uuid" does not exist | 404 Not Found | "uuid": [ "Invalid pk "{value}" - form does not exist." ] |
| "name" is empty string | 400 Bad Request | "name": [ "This field may not be blank." ] |
| "name" is null | 400 Bad Request | "name": [ "This field may not be null." ] |
| "name" has > 100 chars | 400 Bad Request | "name": [ "Ensure this field has no more than 100 characters." ] |
| "name" is not unique | 400 Bad Request | "name": [ "This field must be unique." ] |
| "configuration" is null | 400 Bad Request | "configuration": [ "This field may not be null." ] |
| Number of components > 100 | 400 Bad Request | "detail": ["Ensure this list has at most 100 items."] |
| custom_components.component missing | 400 Bad Request | "custom_components": {"component": ["This field is required."]} |
| custom_components.component is empty | 400 Bad Request | "custom_components": {"component": ["This field may not be blank."]} |
| custom_components.component is null | 400 Bad Request | "custom_components": {"component": ["This field may not be null."]} |
| custom_components.component doesn't exists | 400 Bad Request | "custom_components": {"component": ["Invalid pk "99900" - object does not exist."]} |
| custom_components.component is not enabled | 400 Bad Request | "custom_components": ["Custom component 1 - object not enabled.",] |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
DELETE /api/object-class-forms/form_uuid/
Deletes the form.
Permissions
Requires authentication and object_class_forms.delete permission which is true if edit perm is enabled for Object Class for which the form is being created.
Request example
- Headers
Request Method: DELETE
Location: /api/object-class-forms/966ab882-0120-46bc-a8e0-fe901d298063/
Authorization: JWT access_tokenResponse example
- Status
204 No Content - Body
Errors
| Error | Response code | Message |
|---|---|---|
| Form with "uuid" does not exist | 404 Not Found | "detail": "Not found." |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
OPTIONS /api/object-class-forms/
Permissions
Requires authentication only.
Request example
- Headers
Request Method: OPTIONS
Location: /api/object-class-forms/Response example
- Status
200 OK - Body
{
"list": {
"columns": [
{
"alias": "uuid",
"type": "uuid",
"predicates": [
"exact"
],
"sort_ok": false
},
{
"alias": "name",
"type": "string",
"predicates": [
"exact",
"iexact",
"contains",
"icontains",
"startswith",
"istartswith",
"endswith",
"iendswith"
],
"sort_ok": true
},
{
"alias": "is_enabled",
"type": "bool",
"predicates": [
"exact"
],
"sort_ok": false
},
{
"alias": "created_at",
"type": "datetime",
"predicates": [
"exact",
"gt",
"gte",
"lt",
"lte",
"range"
],
"sort_ok": true
},
{
"alias": "created_by",
"type": "user",
"predicates": [
"exact",
"in"
],
"sort_ok": false,
"autocomplete": "/api/users/autocomplete/?text__icontains="
},
{
"alias": "modified_at",
"type": "datetime",
"predicates": [
"exact",
"gt",
"gte",
"lt",
"lte",
"range"
],
"sort_ok": true
},
{
"alias": "modified_by",
"type": "user",
"predicates": [
"exact",
"in"
],
"sort_ok": false,
"autocomplete": "/api/users/autocomplete/?text__icontains="
}
]
},
"details": {
"schema": [
{
"alias": "name",
"type": "string",
"required": true,
"validators": [
{
"type": "max_length",
"length": 100
}
]
},
{
"alias": "type",
"type": "enum",
"required": true,
"validators": [
{
"value": "create",
"text": "Create Object Record"
}
]
},
{
"alias": "is_enabled",
"type": "bool",
"required": false
}
]
},
"restrictions": {
"limit_items_in_object_class": 100
}
}