Skip to content

Object Class Owners

This documentation describes API for Object Class Owners.

Object Class Owners API

POST /api/object-classes/class_id/owners/

Creates Object Class Owner relations.

Permissions

Requires authentication and any of

  1. object_classes.edit_owners permission
  2. Object Class Ownership

URL parameters

KeyNotes
class_idObject Class id

Request example

  • Headers
Request Method: POST
Content-Type: application/json
Authorization: JWT access_token

Body

KeyTypeRequiredNotes
-listTrueOwner ids list

Validations

  • Maximum number of Owners per specific Object Class: 100.
  • Maximum number of Owners in batch: 100.
  • User is validated by account type, one_time_completion account cannot be owner.

Sample request body

POST /api/object-classes/1/owners/

json

[25]

Response

KeyTypeNotes
idintAutomatically generated by the backend.
namestring
useruser
created_atdatetime
created_byuser
  • Response user and created_by object
KeyTypeNotes
idintAutomatically generated by the backend.
usernamestring
first_namestring
last_namestring
account_typestring
company_namestring
is_deletedbool
  • Successful status 201 Created
  • Response body schema
json
{
  "id": 876,
  "user":
  {
    "id": 25,
    "first_name": "John",
    "last_name": "Smith",
    "username": "john.smith@autologyx.com",
    "company_name": "",
    "is_deleted": false,
    "account_type": "super_admin"
  },
  "created_at": "2023-07-17T12:56:54.161206+02:00",
  "created_by":
  {
    "id": 655,
    "first_name": "Ann",
    "last_name": "Jackson",
    "username": "ann.jackson@autologyx.com",
    "company_name": "",
    "is_deleted": false,
    "account_type": "super_admin"
  }
}

Errors

CauseResponse codeMessage
class_id is invalid404 Not Found
list contains item of wrong type400 Bad Request"detail": ["Incorrect type. Expected pk value, received str."]
list in body is empty400 Bad Request"detail": ["This list may not be empty."]
owner has wrong type400 Bad Request"detail": ["1 Time Completion account cannot be owner."]
batch size is above the limit400 Bad Request"detail": ["Up to 100 items allowed."]
object record owners is above the limit400 Bad Request"detail": ["Limit of 100 Object Record Owners has been exceeded."]
Request user does not have "users.list" permission for some users passed in the payload400 Bad Request“detail”: ["You do not have permission to assign user "{user_id}" as an owner of class "{class_id}"."]
insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."

GET /api/object-classes/class_id/owners/

Returns list of Object Class Owners.

Permissions

Requires any of permissions

  1. object_classes.view permission (for individual Object Class)
  2. Object Class Ownership

URL parameters

KeyNotes
class_idObject Class id

Request example

  • Headers
Request Method: GET
Content-Type: application/json
Authorization: JWT access_token

Response

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

Response results array

KeyTypeNotes
idintAutomatically generated by the backend.
userobject
created_atdatetime
created_byuser
  • Successful status 200 OK
  • Response body schema
json
{
  "limit":50,
  "offset":0,
  "filtered_count":1,
  "total_count":1,
  "next":null,
  "previous":null,
  "results":[
    {
      "id":22,
      "created_at":"2023-07-10T09:28:27.679165+02:00",
      "created_by": 
        {
         "id":42,
          "first_name":"John",
          "last_name":"Smith",
          "username":"john.smith@example.test",
          "company_name":"autologyx",
          "is_deleted":false
        },
      "user":
        {
          "id":641,
          "first_name":"sample first name",
          "last_name":"sample last name",
          "username":"test.autologyx@example.test",
          "company_name":"autologyx",
          "is_deleted":false
        }
    }]}

Errors

CauseResponse codeMessage
class_id is invalid404 Not Found
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."

GET /api/object-classes/class_id/owners/owner_id/

Returns a single Object Class Owner.

Permissions

Requires any of permissions

  1. object_classes.view permission (for individual Object Class)
  2. Object Class Ownership

URL parameters

KeyNotes
class_idObject Class id
owner_idObject Owner id

Request example

  • Headers
Request Method: GET
Content-Type: application/json
Authorization: JWT access_token

Response

KeyTypeNotes
idintAutomatically generated by the backend.
userobject
created_atdatetime
created_byuser
  • Successful status 200 OK
  • Response body schema
json
{
  "id": 22,
  "created_at": "2023-07-10T09:28:27.679165+02:00",
  "created_by": {
    "id": 42,
    "first_name": "John",
    "last_name": "Smith",
    "username": "john.smith@example.test",
    "company_name": "autologyx",
    "is_deleted": false
  },
  "user": {
    "id": 641,
    "first_name": "sample first name",
    "last_name": "sample last name",
    "username": "test.autologyx@example.test",
    "company_name": "autologyx",
    "is_deleted": false
  }
}

Errors

CauseResponse codeMessage
class_id is invalid404 Not Found
owner_id is invalid404 Not Found
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."

DELETE /api/object-classes/class_id/owners/onwer_id/

Delete a single Object Class Owner.

Permissions

Requires any of permissions

  1. object_classes.edit_owners permission
  2. Object Class Ownership

URL parameters

KeyNotes
class_idObject Class id
owner_idObject Owner id

Request example

  • Headers
Request Method: DELETE
Content-Type: application/json
Authorization: JWT access_token

Response

  • Successful status 204 No Content

Errors

CauseResponse codeMessage
class_id is invalid404 Not Found
owner_id is invalid404 Not Found
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."

OPTIONS /api/object-classes/class_id/owners/

Permissions

Requires authentication only.

URL parameters

KeyNotes
class_idObject Class id

Request example

  • Headers
Request Method: DELETE
Content-Type: application/json
Authorization: JWT access_token

Response example

  • Status 200 OK
  • Body
json
{
    "list": {
        "columns": [
            {
                "alias": "id",
                "type": "int",
                "predicates": [],
                "sort_ok": false
            },
            {
                "alias": "user",
                "type": "user",
                "predicates": [],
                "sort_ok": false
            },
            {
                "alias": "created_at",
                "type": "datetime",
                "predicates": [],
                "sort_ok": false
            },
            {
                "alias": "created_by",
                "type": "user",
                "predicates": [],
                "sort_ok": false
            }
        ]
    },
    "batch": {
        "type": "set",
        "required": true,
        "autocomplete": "/api/users/autocomplete/?account_type!=one_time_completion&text__icontains="
    },
    "restrictions": {
        "limit_items": 100,
        "limit_items_in_batch": 100
    }
}