Skip to content

TODO Describe a {%feature%} here ...

TODO

  • replace all placeholders {%placeholder%} with appropriate values.
  • {text} is not a placeholder (single brackets).
  • Do not remove `` chars if placeholder is between them, like {%placeholder%}.
  • Extend descriptions if needed.
  • Remove this (and others) TODO block - it's just a guide.

Permissions

TODO please describe permissions, including from what they come, like some permission sets, etc.

PermissionManageable via RolesManageable viaDescription

Permissions for {%feature%} can be checked by:

ContextEndpointLocationAvailable perms
Global scopeGET /api/users/permissions/{%resource%}{%perm%}, {%perm%}
SpecificGET /{%endpoint%}/_meta.permissions.{%resource%}{%perm%}, {%perm%}

References

POST /{%endpoint%}/

Creates {%object_name%}.

Permissions

Requires authentication and {%resource%}.{%perm%} permission.

Request

  • URL parameters
KeyTypeNotes
uuiduuid
  • Body parameters
KeyTypeNotes
  • Headers
Content-Type: application/json
Authorization: JWT access_token
  • Schema

POST /{%endpoint%}/

json

{
  "{%attribute%}": "{%str_value%}",
  "{%attribute%}": {%int_bool_value%}
}

Validations

    • Max length: 100 (TODO it's a sample, remove if not relevant)
    • {%validation%}:

Restrictions

  • TODO please describe limits enforced by the endpoint.

Response

TODO in table below there is uuid. Probably all new endpoints will use it instead of integer id.

TODO please remove non-matching attributes.

KeyTypeNotes
uuiduuidAutomatically generated by the backend.
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.labelsObjectObject containing labels for attributes.
_meta.permissionsObjectObject describing permissions.
  • Successful status 201 Created
  • Response body schema
json
{
  "uuid": <uuid>,
  "{%attribute%}": {%type%},
  ...
  "created_at": <datetime>,
  "created_by": <user>,
  "modified_at": <datetime>,
  "modified_by": <user>,
  "_meta": {
    "labels": {
      "{%attribute%}": <string>,
      ...
    },
    "permissions": {
      "{%perm%}": <bool>,
      ...
    }
  }
}

Errors

CauseResponse codeMessage
"{%attribute%}" is missing400 Bad Request"name": ["This field is required."]
"{%attribute%}" is empty string400 Bad Request"name": ["This field may not be blank."]
"{%attribute%}" is null400 Bad Request"name": ["This field may not be null."]
"{%attribute%}" has > {%limit%} chars400 Bad Request"name": ["Ensure this field has no more than {%limit%} characters."]
"{%attribute%}" is not unique400 Bad Request"name": ["This field must be unique."]
"{%attribute%}" is not int400 Bad Request"object_class": ["Incorrect type. Expected pk value, received {type}."]
{%object%} with "{%attribute%}" does not exist400 Bad Request"object_class": ["Invalid pk \"{value}\" - {%object%} does not exist."]
"{value}" for {%attribute%} is out of choices400 Bad Request"type": ["\"{value}\" is not a valid choice."]
Max {%limit%} {%object_name%} per {%parent_object_name%} exceeded400 Bad Request"detail": ["Limit of {%limit%} {%object_name%} for the {%parent_object_name%} has been exceeded."]
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."

GET /{%endpoint%}/

Returns list of {%object_name%}.

Permissions

Requires authentication and {%resource%}.{%perm%} permission.

TODO below sentence is not relevant to each resource. Please remove if it's redundant.

Response contains only the {%object_name%} for which the caller has {%resource%}.{%perm%} permission for the associated {%parent_object_name%}.

Request

  • Headers
Content-Type: application/json
Authorization: JWT access_token
  • Schema

GET /{%endpoint%}/

json

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
uuiduuid
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.labelsObjectObject containing labels for attributes.
_meta.permissionsObjectObject describing permissions.
  • Successful status 200 OK
  • Response body schema
json
{
  "limit": <int>,
  "offset": <int>,
  "filtered_count": <int>,
  "total_count": <int>,
  "next": <str | null>,
  "previous": <str | null>,
  "results": [
    {
      "uuid": <uuid>,
      "{%attribute%}": {%type%},
      ...
      "created_at": <datetime>,
      "created_by": <user>,
      "modified_at": <datetime>,
      "modified_by": <user>,
      "_meta": {
        "labels": {
          "{%attribute%}": <string>
        },
        "permissions": {
            "{%perm%}": <bool>,
            ...
        }
      }
    }
  ]
}

Sorting

ParameterExampleNotes
/{%endpoint%}/?ordering=Ascending
/{%endpoint%}/?ordering=-Descending (-)
created_at/{%endpoint%}/?ordering=created_atAscending
created_at/{%endpoint%}/?ordering=-created_atDescending (-)
modified_at/{%endpoint%}/?ordering=modified_atAscending
modified_at/{%endpoint%}/?ordering=-modified_atDescending (-)

Filtering

Please check ALX API standards for predicates available per type.

ParameterType
uuiduuid
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser

Errors

ErrorResponse codeMessage
Wrong ordering value400 Bad Request"ordering": ["Select a valid choice. {value} is not one of the available choices."]

GET /{%endpoint%}/uuid/

Returns single {%object_name%} by uuid.

Permissions

Requires authentication and {%resource%}.{%perm%} permission.

Request

  • URL parameters
KeyTypeNotes
uuiduuid
  • Headers
Content-Type: application/json
Authorization: JWT access_token
  • Schema

GET /{%endpoint%}/uuid/

json

Response

KeyTypeNotes
uuiduuid
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.labelsObjectObject containing labels for attributes.
_meta.permissionsObjectObject describing permissions.
  • Successful status 200 OK
  • Response body schema:
json
{
  "uuid": <uuid>,
  "{%attribute%}": {%type%},
  "created_at": <datetime>,
  "created_by": <user>,
  "modified_at": <datetime>,
  "modified_by": <user>,
  "_meta": {
    "labels": {
      "{%attribute%}": <string>
    },
    "permissions": {
      "{%perm%}": <bool>,
      ...
    }
  }
}

Errors

ErrorResponse codeMessage
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."
{%object_name%} with "uuid" does not exist404 Not Found"detail": "Not found."

PATCH /{%endpoint%}/uuid/

Updates single {%object_name%}.

Permissions

Requires authentication and {%resource%}.{%perm%} permission.

Request

  • URL parameters
KeyTypeNotes
uuiduuid
  • Body parameters
KeyTypeNotes
  • Headers
Content-Type: application/json
Authorization: JWT access_token
  • Schema

PATCH /{%endpoint%}/uuid/

json

{
  "{%attribute%}": "{%str_value%}",
  "{%attribute%}": {%int_bool_value%}
  ...
}

Response

KeyTypeNotes
uuiduuid
created_atdatetime
created_byuser
modified_atdatetime
modified_byuser
_meta.labelsObjectObject containing labels for attributes.
_meta.permissionsObjectObject describing permissions.
  • Successful status 200 OK
  • Response body schema:
json
{
  "uuid": <uuid>,
  "{%attribute%}": {%type%},
  "created_at": <datetime>,
  "created_by": <user>,
  "modified_at": <datetime>,
  "modified_by": <user>,
  "_meta": {
    "labels": {
      "{%attribute%}": <string>
    },
    "permissions": {
      "{%perm%}": <bool>,
      ...
    }
  }

Errors

ErrorResponse codeMessage
{%object_name%} with "uuid" does not exist400 Bad Request"detail": "You do not have permission to perform this action."
"{%attribute%}" is empty string400 Bad Request"name": ["This field may not be blank."]
"{%attribute%}" is null400 Bad Request"name": ["This field may not be null."]
"{%attribute%}" has > {%limit%} chars400 Bad Request"name": ["Ensure this field has no more than {%limit%} characters."]
"{%attribute%}" is not unique400 Bad Request"name": ["This field must be unique."]
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."

DELETE /{%endpoint%}/uuid/

Deletes single {%object_name%}.

Permissions

Requires authentication and {%resource%}.{%perm%} permission.

Request

  • URL parameters
KeyTypeNotes
uuiduuid
  • Headers
Content-Type: application/json
Authorization: JWT access_token
  • Schema

DELETE /{%endpoint%}/uuid/

json

Response

  • Successful status 204 No Content

Errors

ErrorResponse codeMessage
Insufficient permissions403 Forbidden"detail": "You do not have permission to perform this action."
{%object_name%} with "uuid" does not exist404 Not Found"detail": "Not found."

OPTIONS /{%endpoint%}/

Permissions

Requires authentication only.

Request

  • Headers
Content-Type: application/json
Authorization: JWT access_token
  • Schema

OPTIONS /{%endpoint%}/

json

Response

  • Successful status 200 OK
  • Response body:
json
{
  "list": {
    "columns": [
      {
        "alias": "uuid",
        "type": "uuid",
        "predicates": [
          "exact"
        ],
        "sort_ok": false
      },     
      {
        "alias": "{%attribute%}",
        "type": "{%type%}",
        "predicates": [
          "{%predicate%}",
          ...
        ],
        "sort_ok": {%bool_value%}
      },
      ...
      {
        "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": "{%attribute%}",
        "type": "{%type%}",
        "required": {%bool_value%},
        "validators": [
          {
            "type": "{%slug_name_for_validator%}",
            "length": {%value%}
          }
        ]
      },
      ...
    ]
  },
  "restrictions": {
    "{%restriction_slug%}": {%value%}
  }
}