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
object_classes.edit_ownerspermission- Object Class Ownership
URL parameters
| Key | Notes |
|---|---|
| class_id | Object Class id |
Request example
- Headers
Request Method: POST
Content-Type: application/json
Authorization: JWT access_tokenBody
| Key | Type | Required | Notes |
|---|---|---|---|
| - | list | True | Owner 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_completionaccount cannot be owner.
Sample request body
POST /api/object-classes/1/owners/
json
[25]Response
| Key | Type | Notes |
|---|---|---|
| id | int | Automatically generated by the backend. |
| name | string | |
| user | user | |
| created_at | datetime | |
| created_by | user |
- Response
userandcreated_byobject
| Key | Type | Notes |
|---|---|---|
| id | int | Automatically generated by the backend. |
| username | string | |
| first_name | string | |
| last_name | string | |
| account_type | string | |
| company_name | string | |
| is_deleted | bool |
- 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
| Cause | Response code | Message |
|---|---|---|
| class_id is invalid | 404 Not Found | |
| list contains item of wrong type | 400 Bad Request | "detail": ["Incorrect type. Expected pk value, received str."] |
| list in body is empty | 400 Bad Request | "detail": ["This list may not be empty."] |
| owner has wrong type | 400 Bad Request | "detail": ["1 Time Completion account cannot be owner."] |
| batch size is above the limit | 400 Bad Request | "detail": ["Up to 100 items allowed."] |
| object record owners is above the limit | 400 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 payload | 400 Bad Request | “detail”: ["You do not have permission to assign user "{user_id}" as an owner of class "{class_id}"."] |
| insufficient permissions | 403 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
object_classes.viewpermission (for individual Object Class)- Object Class Ownership
URL parameters
| Key | Notes |
|---|---|
| class_id | Object Class id |
Request example
- Headers
Request Method: GET
Content-Type: application/json
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 |
|---|---|---|
| id | int | Automatically generated by the backend. |
| user | object | |
| created_at | datetime | |
| created_by | user |
- 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
| Cause | Response code | Message |
|---|---|---|
| class_id is invalid | 404 Not Found | |
| Insufficient permissions | 403 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
object_classes.viewpermission (for individual Object Class)- Object Class Ownership
URL parameters
| Key | Notes |
|---|---|
| class_id | Object Class id |
| owner_id | Object Owner id |
Request example
- Headers
Request Method: GET
Content-Type: application/json
Authorization: JWT access_tokenResponse
| Key | Type | Notes |
|---|---|---|
| id | int | Automatically generated by the backend. |
| user | object | |
| created_at | datetime | |
| created_by | user |
- 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
| Cause | Response code | Message |
|---|---|---|
| class_id is invalid | 404 Not Found | |
| owner_id is invalid | 404 Not Found | |
| Insufficient permissions | 403 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
object_classes.edit_ownerspermission- Object Class Ownership
URL parameters
| Key | Notes |
|---|---|
| class_id | Object Class id |
| owner_id | Object Owner id |
Request example
- Headers
Request Method: DELETE
Content-Type: application/json
Authorization: JWT access_tokenResponse
- Successful status
204 No Content
Errors
| Cause | Response code | Message |
|---|---|---|
| class_id is invalid | 404 Not Found | |
| owner_id is invalid | 404 Not Found | |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
OPTIONS /api/object-classes/class_id/owners/
Permissions
Requires authentication only.
URL parameters
| Key | Notes |
|---|---|
| class_id | Object Class id |
Request example
- Headers
Request Method: DELETE
Content-Type: application/json
Authorization: JWT access_tokenResponse 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
}
}