📜  zammad ticket apis doc (1)

📅  最后修改于: 2023-12-03 15:21:22.957000             🧑  作者: Mango

Zammad Ticket APIs Doc

Welcome to the documentation for Zammad Ticket APIs! In this guide, we will cover everything you need to know to start interacting with the Zammad Ticket APIs, including authentication, endpoints, request bodies, and response formats.

Authentication

All Zammad Ticket API requests are authenticated using an API key. To obtain an API key, follow these steps:

  1. Log in to your Zammad instance.
  2. Click the gear icon in the top right corner of the screen.
  3. Click "APIs" in the left sidebar.
  4. Click the "Add Key" button.
  5. Give your API key a name and click "Add Key". Your API key will be displayed.

To authenticate your API requests, include your API key in the request headers:

GET /api/v1/tickets HTTP/1.1
Host: your.zammad.instance.com
Authorization: Token token=yourapikeyhere
Endpoints

Zammad Ticket APIs provide access to a variety of resources, including tickets, organizations, users, and more. Here are some examples of endpoints:

  • /api/v1/tickets: returns a list of tickets
  • /api/v1/tickets/:id: returns a specific ticket
  • /api/v1/organizations: returns a list of organizations
  • /api/v1/organizations/:id: returns a specific organization
  • /api/v1/users: returns a list of users
  • /api/v1/users/:id: returns a specific user

You can view the full list of endpoints in the Zammad Ticket API documentation.

Request Bodies

Depending on the endpoint, you may need to include a request body in your API requests. Here are some examples of request bodies:

Creating a ticket
POST /api/v1/tickets

{
  "title": "New ticket",
  "customer_id": 42,
  "group_id": 1,
  "state_id": 1,
  "article_attributes": {
    "subject": "Article subject",
    "body": "Article body",
    "type": "note",
    "internal": false
  }
}
Updating a ticket
PUT /api/v1/tickets/:id

{
  "state_id": 2
}
Response Formats

Zammad Ticket APIs return data in JSON format. Here is an example of a response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 1,
  "title": "Ticket title",
  "state_id": 1,
  "group_id": 1,
  "customer_id": 42,
  "created_at": "2021-01-01T00:00:00Z",
  "updated_at": "2021-01-01T00:00:00Z",
  "articles": [
    {
      "id": 1,
      "ticket_id": 1,
      "subject": "Article subject",
      "body": "Article body",
      "type": "note",
      "internal": false,
      "created_at": "2021-01-01T00:01:00Z",
      "updated_at": "2021-01-01T00:01:00Z"
    }
  ]
}

That's it for the Zammad Ticket APIs documentation! For more detailed information, please refer to the official Zammad Ticket API documentation.