<commit_before>Ticket
******

List
====

Required permission:

* ticket.agent (access to all ticket in allocated groups)
* ticket.customer (access to all ticket with customer_id ** current_user.id || organization_id ** current_user.organization_id)

Request::

 GET /api/v1/tickets

Response::

 Status: 200 Ok

 [
  {
    "id": 123,
    "title": "Help me!",
    "group_id": 1,
    "state_id": 1,
    "priority_id": 2,
    "customer_id": 2,
    ...
    "note": "some note",
    "updated_at": "2016-08-16T07:55:42.119Z",
    "created_at": "2016-08-16T07:55:42.119Z"
  },
  {
    "id": 124,
    "title": "Just want to ask for support",
    "state_id": 2,
    "priority_id": 2,
    "customer_id": 2,
    ...
    "note": "some note",
    "updated_at": "2016-08-16T07:55:42.119Z",
    "created_at": "2016-08-16T07:55:42.119Z"
  },
 ]

Search
======

Required permission:

* ticket.agent (access to all ticket in allocated groups)
* ticket.customer (access to all ticket with customer_id ** current_user.id || organization_id ** current_user.organization_id)

Request::

 GET /api/v1/tickets/search?query=what&limit=10

Response::

 Status: 200 Ok

 [
  {
    "id": 123,
    "title": "Help me!",
    "group_id": 1,
    "state_id": 1,
    "priority_id": 2,
    "customer_id": 2,
    ...
    "note": "some note",
    "updated_at": "2016-08-16T07:55:42.119Z",
    "created_at": "2016-08-16T07:55:42.119Z"
  },
  {
    "id": 124,
    "title": "Just want to ask for support",
    "state_id": 2,
    "priority_id": 2,
    "customer_id": 2,
    ...
    "note": "some note",
    "updated_at": "2016-08-16T07:55:42.119Z",
    "created_at": "2016-08-16T07:55:42.119Z"<commit_msg>Added params for search sort by and order by.<commit_after>Ticket
******

List
====

Required permission:

* ticket.agent (access to all ticket in allocated groups)
* ticket.customer (access to all ticket with customer_id ** current_user.id || organization_id ** current_user.organization_id)

Request::

 GET /api/v1/tickets

Response::

 Status: 200 Ok

 [
  {
    "id": 123,
    "title": "Help me!",
    "group_id": 1,
    "state_id": 1,
    "priority_id": 2,
    "customer_id": 2,
    ...
    "note": "some note",
    "updated_at": "2016-08-16T07:55:42.119Z",
    "created_at": "2016-08-16T07:55:42.119Z"
  },
  {
    "id": 124,
    "title": "Just want to ask for support",
    "state_id": 2,
    "priority_id": 2,
    "customer_id": 2,
    ...
    "note": "some note",
    "updated_at": "2016-08-16T07:55:42.119Z",
    "created_at": "2016-08-16T07:55:42.119Z"
  },
 ]

Search
======

Required permission:

* ticket.agent (access to all ticket in allocated groups)
* ticket.customer (access to all ticket with customer_id ** current_user.id || organization_id ** current_user.organization_id)

Request::

 GET /api/v1/tickets/search?query=what&limit=10

Note: As of Zammad 2.6 parameters (sort_by=some_row and order_by=asc or desc) can also be used for sorting.

Response::

 Status: 200 Ok

 [
  {
    "id": 123,
    "title": "Help me!",
    "group_id": 1,
    "state_id": 1,
    "priority_id": 2,
    "customer_id": 2,
    ...
    "note": "some note",
    "updated_at": "2016-08-16T07:55:42.119Z",
    "created_at": "2016-08-16T07:55:42.119Z"
  },
  {
    "id": 124,
    "title": "Just want to ask for support",
    "state_id": 2,
    "priority_id": 2,
    "customer_id": 2,
    ...
    "note": "some note",
    "updated_at": "2016-08-16T07:55:42.119Z",
    "created_at": "2016-08-16T07:55:42.119Z"
{'fraction_non_alphanumeric': 0.1782520911450822, 'fraction_numerical': 0.09979809633689068, 'mean_word_length': 3.109004739336493, 'pattern_counts': {'":': 68, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '710944', 'n_tokens_mistral': 1578, 'n_tokens_neox': 1330, 'n_words': 306}