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 #299 - Added timeaccounting API and small fixes #326

Merged
merged 2 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 6 additions & 5 deletions api/ticket.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
Ticket endpoints
ralf401 marked this conversation as resolved.
Show resolved Hide resolved
================

Zammad comes with many ticket related endpoints.
For better overview the grouped those up:
Zammad comes with many ticket related endpoints.
For better overview, they are splitted in different sections:
ralf401 marked this conversation as resolved.
Show resolved Hide resolved

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

/api/ticket/index
/api/ticket/articles
/api/ticket/links
/api/ticket/mentions
/api/ticket/priorities
/api/ticket/states
/api/ticket/tags
/api/ticket/links
/api/ticket/mentions
/api/ticket/index
/api/ticket/timeaccounting
30 changes: 15 additions & 15 deletions api/ticket/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Tickets

.. warning::

Ticket endpoints depend on on group permissions if the user you're
Ticket endpoints depend on group permissions if the user you're
using is an agent. Because of this tickets may or may not be available.

List
Expand All @@ -17,7 +17,7 @@ Response:

.. code-block:: json
:force:

# HTTP-Code 200 Ok

[
Expand Down Expand Up @@ -118,7 +118,7 @@ Response:
:force:

# HTTP-Code 200 Ok

{
"tickets": [
9,
Expand Down Expand Up @@ -1165,7 +1165,7 @@ Response:
:force:

# HTTP-Code 200 Ok

{
"id": 3,
"group_id": 1,
Expand Down Expand Up @@ -1211,26 +1211,26 @@ Create

Required permission: ``ticket.agent`` **or** ``ticket.customer``

.. tip::
.. tip::

**🐱‍👤 On behalf of users**

If you want to create tickets on behalf other users, use
the ``customer_id`` attribute. ``ticket.agent`` is mandatory for this.
Use ``guess:{email address}`` to save an API call if you don't know the
If you want to create tickets on behalf other users, use
the ``customer_id`` attribute. ``ticket.agent`` is mandatory for this.
Use ``guess:{email address}`` to save an API call if you don't know the
users ID or want to create the user in question.

**📣 Add mention subscription right away**

Add the ``mentions`` attribute to your ticket payload and provide
an array of user ids to directly subscribe them during ticket creation.
Add the ``mentions`` attribute to your ticket payload and provide
an array of user ids to directly subscribe them during ticket creation.

*E.g.:* ``"mentions": [1, 5, 7, 8],``

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

.. code-block:: json

{
"title": "Help me!",
"group": "2nd Level",
Expand All @@ -1249,7 +1249,7 @@ Response:
:force:

# HTTP-Code 201 Created

{
"id": 19,
"group_id": 2,
Expand Down Expand Up @@ -1307,7 +1307,7 @@ Required permission: ``ticket.agent`` **or** ``ticket.customer``

.. code-block:: json
:force:

{
"title": "No help for you",
"group": "Sales",
Expand All @@ -1331,7 +1331,7 @@ Response:
:force:

# HTTP-Code 200 Ok

{
"id": 19,
"group_id": 1,
Expand Down Expand Up @@ -1379,7 +1379,7 @@ Response:

.. tip:: **Adding attachments**

Attachment payloads are identical to the ``POST`` method, just use ``PUT``
Attachment payloads are identical to the ``POST`` method, just use ``PUT``
instead.

Delete
Expand Down
157 changes: 157 additions & 0 deletions api/ticket/timeaccounting.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
Timeaccounting
ralf401 marked this conversation as resolved.
Show resolved Hide resolved
**************

List
====

Required permission: ``ticket.agent`` **or** ``admin.time_accounting``

``GET``-Request sent: ``/api/v1/tickets/{ticket id}/time_accountings``

Sample response:

.. code-block:: json
:force:

# HTTP-Code 200 OK

[
{
"id": 6,
"ticket_id": 50,
"ticket_article_id": 87,
"time_unit": "15.0",
"type_id": 3,
"created_by_id": 3,
"created_at": "2023-08-16T08:11:49.315Z",
"updated_at": "2023-08-16T08:11:49.315Z"
},
{
"id": 7,
"ticket_id": 50,
"ticket_article_id": 88,
"time_unit": "30.0",
"type_id": 2,
"created_by_id": 3,
"created_at": "2023-08-16T08:12:02.249Z",
"updated_at": "2023-08-16T08:12:02.249Z"
},
{
"id": 8,
"ticket_id": 50,
"ticket_article_id": 89,
"time_unit": "35.0",
"type_id": 4,
"created_by_id": 3,
"created_at": "2023-08-16T08:12:29.910Z",
"updated_at": "2023-08-16T08:12:29.910Z"
}
]


Show
====

Required permission: ``ticket.agent`` **or** ``admin.time_accounting``

``GET``-Request sent: ``/api/v1/tickets/{ticket id}/time_accountings/{timeaccounting id}``

Sample response:

.. code-block:: json
:force:

# HTTP-Code 200 OK

{
"id": 7,
"ticket_id": 50,
"ticket_article_id": 88,
"time_unit": "30.0",
"type_id": 2,
"created_by_id": 3,
"created_at": "2023-08-16T08:12:02.249Z",
"updated_at": "2023-08-16T08:12:02.249Z"
}

Create
======

Required permission: ``ticket.agent`` **or** ``admin.time_accounting``

``POST``-Request sent: ``/api/v1/tickets/{ticket id}/time_accountings``

.. code-block:: json
:force:

{
"time_unit": "60.0",
"type_id": 4
}

Response:

.. code-block:: json
:force:

# HTTP-Code 201 Created

{
"id": 9,
"ticket_id": 50,
"ticket_article_id": null,
"time_unit": "60.0",
"type_id": 4,
"created_by_id": 3,
"created_at": "2023-08-16T08:30:36.138Z",
"updated_at": "2023-08-16T08:30:36.138Z"
}

Update
======

Required permission: ``admin.time_accounting``

``PUT``-Request sent: ``/api/v1/tickets/{ticket id}/time_accounting/{timeaccounting id}``


.. code-block:: json
:force:

{
"id": 7,
"time_unit": "15.0",
"type_id": 4
}

Response:

.. code-block:: json
:force:

# HTTP-Code 200 OK

{
"ticket_id": 50,
"time_unit": "15.0",
"type_id": 4,
"id": 7,
"ticket_article_id": 88,
"created_by_id": 3,
"created_at": "2023-08-16T08:12:02.249Z",
"updated_at": "2023-08-16T08:24:00.788Z"
}

Remove
======

Required permission: ``admin.time_accounting``

``DELETE``-Request sent: ``/api/v1/tickets/{ticket id}/time_accountings/{timeaccounting id}``

Response:

.. code-block:: json
:force:

# HTTP-Code 200 OK