Requests

Listing Comments

Pagination

  • Cursor pagination (recommended)
  • Offset pagination

See Pagination.

Sorting

By default, comments are sorted by creation date in ascending order.

When using cursor pagination, use the following parameter to change the sort order:

NameTypeRequiredComments
sortstringnoPossible values are "created_at" (ascending order) or "-created_at" (descending order)

When using offset pagination, use the following parameters to change the sort order:

NameTypeRequiredComments
sort_bystringnoOne of created_at, updated_at
sort_orderstringnoOne of asc, desc

Allowed For

  • End Users
get/api/v2/requests/{request_id}/comments

Query parameters

page[before]string

A pagination cursor that tells the endpoint which page to start on. It should be a meta.before_cursor value from a previous request. Note: page[before] and page[after] can't be used together in the same request.

page[after]string

A pagination cursor that tells the endpoint which page to start on. It should be a meta.after_cursor value from a previous request. Note: page[before] and page[after] can't be used together in the same request.

page[size]integer

Specifies how many records should be returned in the response. You can specify up to 100 records per page.

sort'created_at' | '-created_at'

Specifies how to sort the comments. Possible values are "created_at" (ascending order) or "-created_at" (descending order)

sincestring

Filters the comments from the given datetime

rolestring

One of "agent", "end_user". If not specified it does not filter

Response

Success response

Example response

{
  "comments": [
    {
      "attachments": [
        {
          "content_type": "text/plain",
          "content_url": "https://company.zendesk.com/attachments/crash.log",
          "file_name": "crash.log",
          "id": 498483,
          "size": 2532,
          "thumbnails": []
        }
      ],
      "author_id": 123123,
      "body": "Thanks for your help!",
      "created_at": "2009-07-20T22:55:29Z",
      "id": 1274,
      "metadata": {
        "system": {
          "client": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
          "ip_address": "1.1.1.1",
          "latitude": -37.000000000001,
          "location": "Melbourne, 07, Australia",
          "longitude": 144.0000000000002
        },
        "via": {
          "channel": "web",
          "source": {
            "from": {},
            "rel": "web_widget",
            "to": {}
          }
        }
      },
      "public": true,
      "type": "Comment"
    }
  ]
}

Changes