Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #544 - Add API endpoints for checklist #548

Merged
merged 3 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions api/checklist.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Checklist Endpoints
===================

Zammad has different checklist endpoints:

.. toctree::
:maxdepth: 1
:glob:

/api/checklist/checklists
/api/checklist/checklist-items
/api/checklist/checklist-templates

.. note:: *Checklist templates* include their items whereas the *standard
checklist* has a separate item endpoint.
115 changes: 115 additions & 0 deletions api/checklist/checklist-items.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
Checklist Items
===============

Show
----

Required permission: ``ticket.agent``

``GET``-Request sent: ``/api/v1/checklist_items/{checklist item id}``

Response:

.. code-block:: json
:force:

# HTTP-Code 200 OK

{
"text": "Hand over the goods to the shipping company",
"checked": false,
"updated_by_id": 3,
"ticket_id": null,
"created_by_id": 3,
"checklist_id": 6,
"id": 20,
"created_at": "2024-10-15T08:48:14.216Z",
"updated_at": "2024-10-15T08:49:10.467Z"
}

Create
------

Required permission: ``ticket.agent``

``POST``-Request sent: ``/api/v1/checklist_items``

Request:

.. code-block:: json
:force:

{
"text": "New Item via API!",
"checklist_id": 12,
"checked": false
}

Response:

.. code-block:: json
:force:

# HTTP-Code 200 OK

{
"id": 35,
"text": "New Item via API!",
"checked": false,
"checklist_id": 12,
"created_by_id": 3,
"updated_by_id": 3,
"created_at": "2024-10-16T08:00:35.347Z",
"updated_at": "2024-10-16T08:00:35.347Z",
"ticket_id": null
}

Update
------

Required permission: ``ticket.agent``

``PATCH``-Request sent: ``/api/v1/checklist_items/{checklist item id}``

Request:

.. code-block:: json
:force:

{
"text": "Changed checklist item",
"checked": true
}

Response:

.. code-block:: json
:force:

# HTTP-Code 200 OK

{
"text": "Changed checklist item",
"checked": true,
"updated_by_id": 3,
"ticket_id": null,
"created_by_id": 3,
"checklist_id": 6,
"id": 20,
"created_at": "2024-10-15T08:48:14.216Z",
"updated_at": "2024-10-15T12:19:35.235Z"
}

Delete
------

Required permission: ``ticket.agent``

``DELETE``-Request sent: ``/api/v1/checklist_items/{checklist item id}``

Response:

.. code-block:: json
:force:

# HTTP-Code 200 OK
151 changes: 151 additions & 0 deletions api/checklist/checklist-templates.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
Checklist Templates
===================

Show
----

Required permission: ``admin.checklists`` or ``ticket.agent``

``GET``-Request sent: ``/api/v1/checklist_templates/{checklist template id}``

Response:

.. code-block:: json
:force:

# HTTP-Code 200 OK

{
"name": "Return order",
"active": true,
"updated_by_id": 3,
"created_by_id": 3,
"id": 28,
"sorted_item_ids": [
"18",
"19",
"20",
"21"
],
"created_at": "2024-10-15T12:43:14.642Z",
"updated_at": "2024-10-15T12:43:34.242Z",
"item_ids": [
18,
19,
20,
21
]
}

Create
------

Required permission: ``admin.checklists``

``POST``-Request sent: ``/api/v1/checklist_templates``

Request:

.. code-block:: json
:force:

{
"name": "My checklist template",
"active": true,
"items": [
"Item 1",
"Item 2",
"Item 3"
]
}

Response:

.. code-block:: json
:force:

# HTTP-Code 200 OK

{
"id": 30,
"name": "Test API II",
"active": true,
"sorted_item_ids": [
"22",
"23",
"24"
],
"created_by_id": 3,
"updated_by_id": 3,
"created_at": "2024-10-15T12:46:31.927Z",
"updated_at": "2024-10-15T12:46:31.982Z",
"item_ids": [
22,
23,
24
]
}


Update
------

Required permission: ``admin.checklists``

``PATCH``-Request sent: ``/api/v1/checklist_templates/{checklist template id}``

Request:

.. code-block:: json
:force:

{
"name": "My changed checklist template name",
"active": true,
"items": [
"Item 7",
"Item 8",
"Item 9"
]
}

Response:

.. code-block:: json
:force:

# HTTP-Code 200 OK

{
"name": "My changed checklist template name",
"active": true,
"updated_by_id": 3,
"created_by_id": 3,
"id": 30,
"sorted_item_ids": [
"25",
"26",
"27"
],
"created_at": "2024-10-15T12:46:31.927Z",
"updated_at": "2024-10-15T12:51:22.245Z",
"item_ids": [
25,
26,
27
]
}

Delete
------

Required permission: ``admin.checklists``

``DELETE``-Request sent: ``/api/v1/checklist_templates/{checklist template id}``

Response:

.. code-block:: json
:force:

# HTTP-Code 200 OK
Loading
Loading