API v.2


The difference between API v.2 and API v.1 is: 
- Added the ability to create applications, as well as work with them (performing actions on applications). 
- Changed authentication method 
- Changed request / response format


Authorization
To work with the API, you need to have a token that is generated in the administration panel and can have an expiration date. Authentication method: JWT . You can use token both as a request body token parameter and in Header Authorization: Bearer <token>.


Format of requests and responses
For all requests the POST method is used. Request format: Content-Type: multipart / form-data; In all answers format: json. In case of an error, the following are necessarily returned: message, status_code.


Additional parameter sudo
As the presence of the included attribute sudo, in the token settings, when prompted, it is possible to specify the id of the user from whom the action is taken with the request. In this case, all rights to the applications are taken exclusively from the settings of the application form id of the user specified in sudo. If the sudo parameter is turned off or absent, then by default all actions will be performed from the user specified in the settings of the specific token.



Objects


1. Users: 

1.1 Creation

1.2 Search

1.3 View


2. Applications:

2.1 Viewing possible attributes for creating an application

2.2 View a list of possible groups (to whom)

2.3 View a list of possible users (to whom)

2.4 View a list of possible SLA

2.5 View a list of possible additional fields

2.6 Creating Application

2.7 View the list of incoming applications

2.8 View the list of outgoing applications

2.9 View a list of archived requests

2.10 Adding an Observing User to the Application

2.11 Deleting an Observing User to the Application

2.12 Application Forwarding

2.13 Locking / Unlocking an Application

2.14 Execution / cancellation of an application

2.15 Merging Application

2.16 Confirmation / cancellation of verification of an application after its completion

2.17 Commenting the application



1.1 Creating a user


Endpoint: user / create

Request parameters:

name (required) First Name Last Name

email (required) User email

password (required) User password

groups_user (optional) List of id groups, comma separated in which the user has a user role

groups_super (optional) List of id groups, separated by a comma in which the user with the role super user

notify: true / false (optional) Notify user of the creation of his account

lang: ru, en, uk (optional) User Interface Language

conf_params: user, group (optional) Application form creation parameters

ticket_form_id (optional) ID of the application form

group_conf_id (optional) group ID from which to take the application creation form

role: 'admin', 'user', 'client' (optional) User role in the system

Sample answer:

[

  {

    "id": 9,

    "name": "admin@zen.comreer",

    "email": "admin@zen.com",

    "last_login": null,

    "created_at": "2019-04-23 11:13:11",

    "updated_at": "2019-04-23 11:13:11",

    "deleted_at": null,

    "active": "true"

  }

]


1.2 Search user


Endpoint: user / find

Request parameters:

q (required) First name Last name / email

Sample answer:

[

  {

    "id": 9,

    "name": "admin@zen.comreer",

    "email": "admin@zen.com",

    "last_login": null,

    "created_at": "2019-04-23 11:13:11",

    "updated_at": "2019-04-23 11:13:11",

    "deleted_at": null,

    "active": "true"

  }

]


1.3 Viewing user


Endpoint: user

Request parameters:

user_id (required) user ID

Sample answer:

{

  "user": {

    "id": 1,

    "name": "System Account",

    "email": "admin @ local",

    "last_login": "2019-05-17 15:38:10",

    "created_at": "2019-04-05 07:48:01",

    "updated_at": "2019-05-17 15:38:10",

    "deleted_at": null,

    "active": "true"

  },

  "profile": {

    "user_id": 1,

    "user_img": null,

    "user_cover": null,

    "lang": "ru",

    "full_name": "System Account",

    "user_urlhash": "dQbM7AkSgr8m2PmQUM6CuHxCx",

    "sms": null,

    "pb": null,

    "telephone": null,

    "skype": null,

    "address": null,

    "position": "$ request-> profile ['email']",

    "birthdayDay": 1,

    "birthdayMonth": 1,

    "birthdayYear": 1950,

    "email": "admin @ local",

    "facebook": null,

    "twitter": null,

    "website": null,

    "about": null,

    "skills": "",

    "created_at": "2019-04-05 07:48:01",

    "updated_at": "2019-05-06 14:24:03"

  },

  "role": {

    "id": 1,

    "created_at": "2019-04-05 07:48:01",

    "updated_at": "2019-04-05 07:48:01",

    "user_id": 1,

    "role": "admin"

  },

  "group_admin": [

    {

      "id": 1,

      "name": "Default group",

      "description": "Default group",

      "cover": null,

      "icon": null,

      "status": "public",

      "description_full": null,

      "slogan": null,

      "address": null,

      "tags": null,

      "facebook": null,

      "twitter": null,

      "group_urlhash": "def_group",

      "created_at": "2019-04-08 09:17:06",

      "updated_at": "2019-04-08 09:17:06",

      "pivot": {

        "user_id": 1,

        "group_id": 1,

        "created_at": "2019-04-12 12:43:24",

        "updated_at": "2019-04-12 12:43:24",

        "status": "success",

        "priviliges": "admin"

      }

    }

  ],

  "group_user": [

    {

      "id": 1,

      "name": "Default group",

      "description": "Default group",

      "cover": null,

      "icon": null,

      "status": "public",

      "description_full": null,

      "slogan": null,

      "address": null,

      "tags": null,

      "facebook": null,

      "twitter": null,

      "group_urlhash": "def_group",

      "created_at": "2019-04-08 09:17:06",

      "updated_at": "2019-04-08 09:17:06",

      "pivot": {

        "user_id": 1,

        "group_id": 1,

        "created_at": "2019-04-12 12:43:24",

        "updated_at": "2019-04-12 12:43:24",

        "status": "success",

        "priviliges": "user"

      }

    }

  ],

  "contacts": [

    {

      "id": 10,

      "user_id": 1,

      "type": "email",

      "primary": "true",

      "value": "admin3@zenlix.com",

      "created_at": "2019-04-15 08:11:47",

      "updated_at": "2019-04-15 08:11:47"

    },

    {

      "id": 11,

      "user_id": 1,

      "type": "email",

      "primary": "false",

      "value": "admin2@zenlix.com",

      "created_at": "2019-04-15 08:11:47",

      "updated_at": "2019-04-15 08:11:47"

    }

  ],

  "ticket_conf": {

    "id": 1,

    "created_at": "2019-04-05 07:48:01",

    "updated_at": "2019-04-05 07:48:01",

    "user_id": 1,

    "ticket_form_id": 1,

    "conf_params": "user",

    "group_conf_id": null

  },

  "fields": [

    {

      "id": 1,

      "created_at": "2019-04-12 13:11:27",

      "updated_at": "2019-04-15 08:11:47",

      "user_field_id": 1,

      "user_id": 1,

      "field_data": "$ profileReq ['profile'] to"

    },

    {

      "id": 2,

      "created_at": "2019-04-12 13:20:31",

      "updated_at": "2019-04-15 08:11:47",

      "user_field_id": 2,

      "user_id": 1,

      "field_data": ""

    }

  ]

}




2.1 Viewing possible attributes for creating an application

Endpoint: ticket / precreate

Request parameters:

-

Sample answer:

{

  "prio": "true", Ability to set the priority of the application

  "files": {

    "active": "true", ability to upload files

    "types": "jpeg, png", valid file formats

    "count": 3, Allowed number of files

    "size": 1024 Maximum size of each file

  },

  "deadline": "true", Ability to set an application deadline

  "watching": "true", the ability to install watching the application

  "individual_ok": "true", Individual execution of the application

  "check_after": "true"; Ability to accept a request after its execution

  "create_user": "true", Ability to create user 

  "target_group": {

    "1": "Default group" ID of the group in which it is possible to create a request

  },

  "target_users": {

    "1": "System Account" user IDs that are allowed to create an application

  },

  "fields": [List of additional order fields

    {

      "id": 1,

      "created_at": "2019-04-08 11:22:32",

      "updated_at": "2019-04-08 11:22:32",

      "name": "IP Address", Field Name

      "f_type": "text", field type

      "required": "true", Required field

      "field_name": "IP address",

      "field_value": null,

      "field_placeholder": "IP address",

      "field_hash": "E3IQzkECnRqOQEZ9roKdg4ymRiImcuvYzruyti53"

    }

  ],

  "sla": {

    "1": "Main" List of valid SLA plans

  },

  "subj": true; Ability to set the topic of the request

  "msg": true, Ability to set the message

  "tags": true Ability to set tags to the application

}



2.2 View a list of possible groups (to whom)

Endpoint: ticket / groups / list

Request parameters:

-

Sample answer:

{

  "1": "Default group"

}



2.3 View a list of possible users (to whom)

Endpoint: ticket / users / list

Request parameters:

-

Sample answer:

{

  "1": "System Account"

}



2.4 View a list of possible SLA

Endpoint: ticket / sla / list

Request parameters:

-

Sample answer:

{

  "1": "Main"

}



2.5 View a list of possible additional fields

Endpoint: ticket / custom_fields / list

Request parameters:

-

Sample answer:

[

  {

    "id": 1,

    "created_at": "2019-04-08 11:22:32",

    "updated_at": "2019-04-08 11:22:32",

    "name": "IP address",

    "f_type": "text",

    "required": "true",

    "field_name": "IP address",

    "field_value": null,

    "field_placeholder": "IP address",

    "field_hash": "E3IQzkECnRqOQEZ9roKdg4ymRiImcuvYzruyti53"

  }

]



2.6 Creating Application

Endpoint: ticket / create

Request parameters:

deadline: true (optional) Activate the application deadline

deadlineYear year deadline

deadlineMonth deadline month

deadlineDay deadline day

deadlineTime deadline time 

msg (required) Message 

subj (required) Subject of the application

prio: low, normal, high order priority

tags: semicolon tags as delimiters

sla: SLA id

target_group (required) ID of the group for which the application was created

target_users User IDs with a comma as the separator character to which the application is assigned

Client IDs of users with a comma as a separator, clients

check_after true / false Check request after its execution

individual_ok true / false Individual execution of each application

notify_client true / false Notify the client about the creation of the application

watching_users User IDs with a comma as a separator character that will see the request

fields [*] where * is the id of the additional field

files [*] where * is the sequence number or another attribute of the file to be downloaded

Sample answer:

{

  "id": 16,

  "author_id": 1,

  "code": "PS4X",

  "client_id": null,

  "prio": "normal",

  "text": "test",

  "subject": "test",

  "tags": "api_v2",

  "urlhash": "7AC5eA2Knv",

  "sla_id": null,

  "target_group_id": null,

  "deadline_time": null,

  "inspect_after_ok": "false",

  "individual_ok": "false",

  "overtime": "false",

  "planner_flag": "false",

  "merge_flag": "false",

  "deleted_at": null,

  "status": "free",

  "created_at": "2019-05-15 15:12:44",

  "updated_at": "2019-05-17 16:30:16"

}



2.7 View the list of incoming applications

Endpoint: ticket / list / in

Request parameters:

order_column is the name of the field by which you want to sort

order_sort asc / desc sort

limit number of records issued

offset starting element

Sample answer:

{

  "tickets": [

    {

      "code": "QS92",

      "prio": "normal",

      "subject": "test",

      "author": {

        "full_name": "System Account",

        "user_urlhash": "dQbM7AkSgr8m2PmQUM6CuHxCx"

      },

      "created_at": {

        "date": "2019-05-17 16: 05: 25.000000",

        "timezone_type": 3,

        "timezone": "Europe / Kiev"

      },

      "clients": [

        {

          "full_name": "System Account",

          "user_urlhash": "dQbM7AkSgr8m2PmQUM6CuHxCx",

          "id": 1

        }

      ],

      "targets": {

        "group": null,

        "users": [

          {

            "full_name": "System Account",

            "user_urlhash": "dQbM7AkSgr8m2PmQUM6CuHxCx",

            "id": 1

          }

        ]

      },

      "ticket_status": "free",

      "text": "test",

      "tags": "api_v2",

      "urlhash": "wT7V0b4J8B",

      "overtime": "false",

      "planner_flag": "false"

    },

...



2.8 View the list of outgoing applications

Endpoint: ticket / list / out

Request parameters:

order_column is the name of the field by which you want to sort

order_sort asc / desc sort

limit number of records issued

offset starting element

Sample answer:

{

  "tickets": [

    {

      "code": "QS92",

      "prio": "normal",

      "subject": "test",

      "author": {

        "full_name": "System Account",

        "user_urlhash": "dQbM7AkSgr8m2PmQUM6CuHxCx"

      },

      "created_at": {

        "date": "2019-05-17 16: 05: 25.000000",

        "timezone_type": 3,

        "timezone": "Europe / Kiev"

      },

      "clients": [

        {

          "full_name": "System Account",

          "user_urlhash": "dQbM7AkSgr8m2PmQUM6CuHxCx",

          "id": 1

        }

      ],

      "targets": {

        "group": null,

        "users": [

          {

            "full_name": "System Account",

            "user_urlhash": "dQbM7AkSgr8m2PmQUM6CuHxCx",

            "id": 1

          }

        ]

      },

      "ticket_status": "free",

      "text": "test",

      "tags": "api_v2",

      "urlhash": "wT7V0b4J8B",

      "overtime": "false",

      "planner_flag": "false"

    },

...




2.9 View a list of archived requests

Endpoint: ticket / list / arch

Request parameters:

order_column is the name of the field by which you want to sort

order_sort asc / desc sort

limit number of records issued

offset starting element

Sample answer:

{

  "tickets": [

    {

      "code": "QS92",

      "prio": "normal",

      "subject": "test",

      "author": {

        "full_name": "System Account",

        "user_urlhash": "dQbM7AkSgr8m2PmQUM6CuHxCx"

      },

      "created_at": {

        "date": "2019-05-17 16: 05: 25.000000",

        "timezone_type": 3,

        "timezone": "Europe / Kiev"

      },

      "clients": [

        {

          "full_name": "System Account",

          "user_urlhash": "dQbM7AkSgr8m2PmQUM6CuHxCx",

          "id": 1

        }

      ],

      "targets": {

        "group": null,

        "users": [

          {

            "full_name": "System Account",

            "user_urlhash": "dQbM7AkSgr8m2PmQUM6CuHxCx",

            "id": 1

          }

        ]

      },

      "ticket_status": "free",

      "text": "test",

      "tags": "api_v2",

      "urlhash": "wT7V0b4J8B",

      "overtime": "false",

      "planner_flag": "false"

    },

...




2.10 Adding an Observing User to the Application

Endpoint: ticket / watching / add

Request parameters:

code Application code

watching_users User IDs with a comma as a separator character, which will look after the application

Sample answer:

[

  one,

  2,

  3

]



2.11 Deleting an Observing User to the Application

Endpoint: ticket / watching / remove

Request parameters:

code Application code

watching_users User IDs with a comma as a separator, which are excluded from the list of observers

Sample answer:

[

  one,

  2,

  3

]



2.12 Application Forwarding

Endpoint: ticket / refer

Request parameters:

target_group (required) ID of the group to which the request will be forwarded

target_users User IDs with a comma as a separator, on which to send an application

msg (required) message 

Sample answer:

{

  "id": 16,

  "author_id": 1,

  "code": "PS4X",

  "client_id": null,

  "prio": "normal",

  "text": "test",

  "subject": "test",

  "tags": "api_v2",

  "urlhash": "7AC5eA2Knv",

  "sla_id": null,

  "target_group_id": null,

  "deadline_time": null,

  "inspect_after_ok": "false",

  "individual_ok": "false",

  "overtime": "false",

  "planner_flag": "false",

  "merge_flag": "false",

  "deleted_at": null,

  "status": "free",

  "created_at": "2019-05-15 15:12:44",

  "updated_at": "2019-05-17 16:30:16"

}



2.13 Locking / Unlocking an Application

Endpoint: ticket / toggle / work

Request parameters:

code (required) Application code

Sample answer:

{

  "id": 16,

  "author_id": 1,

  "code": "PS4X",

  "client_id": null,

  "prio": "normal",

  "text": "test",

  "subject": "test",

  "tags": "api_v2",

  "urlhash": "7AC5eA2Knv",

  "sla_id": null,

  "target_group_id": null,

  "deadline_time": null,

  "inspect_after_ok": "false",

  "individual_ok": "false",

  "overtime": "false",

  "planner_flag": "false",

  "merge_flag": "false",

  "deleted_at": null,

  "status": "free",

  "created_at": "2019-05-15 15:12:44",

  "updated_at": "2019-05-17 16:30:16"

}



2.14 Execution / cancellation of an application

Endpoint: ticket / toggle / success

Request parameters:

code (required) Application code

Sample answer:

{

  "id": 16,

  "author_id": 1,

  "code": "PS4X",

  "client_id": null,

  "prio": "normal",

  "text": "test",

  "subject": "test",

  "tags": "api_v2",

  "urlhash": "7AC5eA2Knv",

  "sla_id": null,

  "target_group_id": null,

  "deadline_time": null,

  "inspect_after_ok": "false",

  "individual_ok": "false",

  "overtime": "false",

  "planner_flag": "false",

  "merge_flag": "false",

  "deleted_at": null,

  "status": "free",

  "created_at": "2019-05-15 15:12:44",

  "updated_at": "2019-05-17 16:30:16"

}




2.15 Merging Application

Endpoint: ticket / merge

Request parameters:

code (required) Main application code

child_code (mandatory) Application code to be linked to the main

Sample answer:

{

  "id": 16,

  "author_id": 1,

  "code": "PS4X",

  "client_id": null,

  "prio": "normal",

  "text": "test",

  "subject": "test",

  "tags": "api_v2",

  "urlhash": "7AC5eA2Knv",

  "sla_id": null,

  "target_group_id": null,

  "deadline_time": null,

  "inspect_after_ok": "false",

  "individual_ok": "false",

  "overtime": "false",

  "planner_flag": "false",

  "merge_flag": "false",

  "deleted_at": null,

  "status": "free",

  "created_at": "2019-05-15 15:12:44",

  "updated_at": "2019-05-17 16:30:16"

}



2.16 Confirmation / cancellation of verification of an application after its completion

Endpoint: ticket / approve

Request parameters:

code (required) Application code

status: true / false (mandatory) Order confirmation status

rate (0-5) application fulfillment rating

Sample answer:

{

  "id": 16,

  "author_id": 1,

  "code": "PS4X",

  "client_id": null,

  "prio": "normal",

  "text": "test",

  "subject": "test",

  "tags": "api_v2",

  "urlhash": "7AC5eA2Knv",

  "sla_id": null,

  "target_group_id": null,

  "deadline_time": null,

  "inspect_after_ok": "false",

  "individual_ok": "false",

  "overtime": "false",

  "planner_flag": "false",

  "merge_flag": "false",

  "deleted_at": null,

  "status": "free",

  "created_at": "2019-05-15 15:12:44",

  "updated_at": "2019-05-17 16:30:16"

}



2.17 Commenting the application

Endpoint: ticket / comment

Request parameters:

code (required) Application code

msg (required) comment text

files [*] file array

visible_client true / false (mandatory) comment visibility for users with client rights

Sample answer:

{

  "text": "test",

  "author_id": 1,

  "ticket_id": 16,

  "visible_client": "true",

  "urlhash": "aKzZmyae2h",

  "updated_at": "2019-05-17 22:13:36",

  "created_at": "2019-05-17 22:13:36",

  "id": 2

}