Skip to content

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

ContextEndpointLocationAvailable perms
Any ClassGET /api/users/permissions/object_class_formslist
Specific ClassGET /api/object-classes/{class_id}/_meta.permissions.object_class_formslist, 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

KeyTypeNotes
namestringUnique (case insensitive) for the given Object Class. Max length = 100 (configurable)
object_classint
typeenumFor now, only "create" value is allowed.
configurationjson

Optional parameters

KeyTypeNotes
is_enabledboolSet to "false" if omitted.
custom_componentssetCustom Components ids used in form configuration.

Request example

  • Headers
Request Method: POST
Location: /api/object-class-forms/
Authorization: JWT access_token
json
{
  "name": "Simple form",
  "object_class": 235,
  "type": "create",
  "is_enabled": true,
  "configuration": <json>,
  "custom_components": [1, 2, 3]
}

Response

KeyTypeNotes
uuiduuidAutomatically generated by the backend.
namestring
object_classint
typeenumFor now, only "create" is supported.
is_enabledbool
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.labelsObject"object_class":
_meta.permissionsObjectDict describing permissions.
  • Status 201 CREATED
  • Body
json
{
  "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

  1. Maximum length of form name = 100 characters.

Errors

ErrorResponse codeMessage
"name" is missing400 Bad Request"name": [ "This field is required." ]
"name" is empty string400 Bad Request"name": [ "This field may not be blank." ]
"name" is null400 Bad Request"name": [ "This field may not be null." ]
"name" has > 100 chars400 Bad Request"name": [ "Ensure this field has no more than 100 characters." ]
"name" is not unique400 Bad Request"name": [ "This field must be unique." ]
"object_class" is missing400 Bad Request"object_class": [ "This field is required." ]
"object_class" is null400 Bad Request"object_class": [ "This field may not be null." ]
"object_class" is not int400 Bad Request"object_class": [ "Incorrect type. Expected pk value, received {type}." ]
Class with "object_class" does not exist400 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 missing400 Bad Request"type": [ "This field is required." ]
"type" is null400 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 missing400 Bad Request"configuration": [ "This field is required." ]
"configuration" is null400 Bad Request"configuration": [ "This field may not be null." ]
Number of components > 100400 Bad Request"detail": ["Ensure this list has at most 100 items."]
custom_components.component missing400 Bad Request"custom_components": {"component": ["This field is required."]}
custom_components.component is empty400 Bad Request"custom_components": {"component": ["This field may not be blank."]}
custom_components.component is null400 Bad Request"custom_components": {"component": ["This field may not be null."]}
custom_components.component doesn't exists400 Bad Request"custom_components": {"component": ["Invalid pk "99900" - object does not exist."]}
custom_components.component is not enabled400 Bad Request"custom_components": ["Custom component 1 - object not enabled.",]
Max 100 forms per class exceeded400 Bad Request"detail": [ "Limit of 100 standalone forms for the class has been exceeded." ]
Insufficient permissions403 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_token

Response

KeyTypeNotes
limitint
offsetint
total_countintTotal number of forms visible to the user (based on permissions).
filtered_countintNumber of forms 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
uuiduuid
namestring
object_classint
typeenumValues: create, update, summary, list, etc. For now only create is supported.
is_enabledbool
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.labelsObject"object_class":
_meta.permissionsObjectDict describing permissions.

Response example

  • Status 200 OK
  • Body
json
{
  "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

ParameterExampleNotes
name{build}/api/object-class-forms/?ordering=nameAscending
name{build}/api/object-class-forms/?ordering=-nameDescending (-)
created_at{build}/api/object-class-forms/?ordering=created_atAscending
created_at{build}/api/object-class-forms/?ordering=-created_atDescending (-)
modified_at{build}/api/object-class-forms/?ordering=modified_atAscending
modified_at{build}/api/object-class-forms/?ordering=-modified_atDescending (-)

Filtering

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

ParameterPredicatesExample
uuid={build}/api/object-class-forms/?uuid=f02bfc83-4342-495d-b092-f1e082f33abb
namestandard string{build}/api/object-class-forms/?name__icontains=foobar
object_classstandard set{build}/api/object-class-forms/?object_class__in=3,33,333
typestandard enum{build}/api/object-class-forms/?type__in=create
is_enabledstandard Boolean{build}/api/object-class-forms/?is_enabled=true
created_atstandard datetime{build}/api/object-class-forms/?created_at__gte=2022-01-01
created_bystandard set{build}/api/object-class-forms/?created_by__in=123,234,345
modified_atstandard datetime{build}/api/object-class-forms/?modified_at__range=2022-01-01,2022-01-31
modified_bystandard set{build}/api/object-class-forms/?modified_by=123

Errors

ErrorResponse codeMessage
Wrong ordering value400 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

KeyTypeNotes
uuiduuid

Request example

  • Headers
Request Method: GET
Location: /api/object-class-forms/966ab882-0120-46bc-a8e0-fe901d298063/
Authorization: JWT access_token

Response

KeyTypeNotes
uuiduuid
namestring
object_classint
typeenum
is_enabledbool
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.labelsObject"object_class":
_meta.permissionsObjectDict describing permissions

Response example

  • Status 200 OK
  • Body
json
{
  "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

ErrorResponse codeMessage
Form with "uuid" does not exist404 Not Found"detail": "Not found."
Insufficient permissions403 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

KeyTypeNotes
namestringUnique (case insensitive) for the given Object Class. Max length = 100 (configurable)
is_enabledbool
configurationjson
custom_componentssetCustom 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
json
{
  "name": "Simple form - modified",
  "is_enabled": false,
  "custom_components": [1, 2, 3],
}

Response

KeyTypeNotes
uuiduuid
namestring
object_classint
typeenum
is_enabledbool
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.labelsObject"object_class":
_meta.permissionsObject"object_records":

Response example

  • Status 200 OK
  • Body
json
{
  "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

ErrorResponse codeMessage
Form with "uuid" does not exist404 Not Found"uuid": [ "Invalid pk "{value}" - form does not exist." ]
"name" is empty string400 Bad Request"name": [ "This field may not be blank." ]
"name" is null400 Bad Request"name": [ "This field may not be null." ]
"name" has > 100 chars400 Bad Request"name": [ "Ensure this field has no more than 100 characters." ]
"name" is not unique400 Bad Request"name": [ "This field must be unique." ]
"configuration" is null400 Bad Request"configuration": [ "This field may not be null." ]
Number of components > 100400 Bad Request"detail": ["Ensure this list has at most 100 items."]
custom_components.component missing400 Bad Request"custom_components": {"component": ["This field is required."]}
custom_components.component is empty400 Bad Request"custom_components": {"component": ["This field may not be blank."]}
custom_components.component is null400 Bad Request"custom_components": {"component": ["This field may not be null."]}
custom_components.component doesn't exists400 Bad Request"custom_components": {"component": ["Invalid pk "99900" - object does not exist."]}
custom_components.component is not enabled400 Bad Request"custom_components": ["Custom component 1 - object not enabled.",]
Insufficient permissions403 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_token

Response example

  • Status 204 No Content
  • Body

Errors

ErrorResponse codeMessage
Form with "uuid" does not exist404 Not Found"detail": "Not found."
Insufficient permissions403 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
json
{
  "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
  }
}