Article Comments

JSON Format

Comments have the following keys:

Name Type Read-only Mandatory Comment
id integer yes no Automatically assigned when the comment is created
url string yes no The API url of this comment
body string no yes The comment made by the author
author_id integer yes* no The id of the author of this comment. *Writable on create by Help Center managers -- see Create Comment
source_id integer yes no The id of the item on which this comment was made
source_type string yes no The type of the item on which this comment was made. Currently only supports 'Article'
locale string no yes The locale in which this comment was made
html_url string yes no The url at which the comment is presented in Help Center
created_at timestamp yes* no The time at which the comment was created. *Writable on create by Help Center managers -- see Create Comment
updated_at timestamp yes no The time at which the comment was last updated
vote_sum integer yes no The sum of upvotes (+1) and downvotes (-1), which may be positive or negative
vote_count integer yes no The total number of upvotes and downvotes
Example
{
  "id":          1635,
  "body":        "Thanks for your help!",
  "author_id":   3465,
  "source_id":   65466,
  "source_type": "Article",
  "locale":      "en-us",
  "created_at":  "2012-04-04T09:14:57Z",
  ...
}

List Comments

  1. GET /api/v2/help_center/users/{id}/comments.json
  2. GET /api/v2/help_center/{locale}/articles/{id}/comments.json

Lists the comments created by a specific user, or all comments made by all users on a specific article.

The {locale} for the article comments is required only for end users. Admins and agents can omit it.

Allowed for
  • Agents
  • End-users

End-users can only list their own comments. If listing comments by user, they must specify me as the id.

Sideloads

The following sideloads are supported:

Name Will sideload
users authors
articles articles
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/users/{id}/comments.json \
  -v -u {email_address}:{password}
Example Response
Status: 200 OK

{
  "comments": [
    {
      "id":        35467,
      "author_id": 89567,
      "body":      "My printer is on fire",
      ...
    },
    {
      "id":        36221,
      "author_id": 89589,
      "body":      "My printer is on fire too!",
      ...
    },
    ...
  ]
}

Show Comment

GET /api/v2/help_center/{locale}/articles/{article_id}/comments/{id}.json

Shows the properties of the specified comment.

The {locale} is required only for end users and anomynous users. Admins and agents can omit it.

Allowed for
  • Agents
  • End-users
  • Anonymous users
Sideloads

The following sideloads are supported:

Name Will sideload
users authors
articles articles
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/{locale}/articles/{article_id}/comments/{id}.json \
  -v -u {email_address}:{password}
Example Response
Status: 200 OK

{
  "comment": {
    "id":        35467,
    "author_id": 89567,
    "body":      "My printer is on fire",
    ...
  }
}

Create Comment

POST /api/v2/help_center/articles/{id}/comments.json

Adds a comment to the specified article. Because comments are associated with a specific article translation, or locale, you must specify a locale.

Allowed for
  • End users

Agents with the Help Center manager role can optionally supply a created_at as part of the comment object. If not provided, created_at is set to the current time.

Supplying a notify_subscribers property with a value of false will prevent subscribers to the comment's article from receiving a comment creation email notification. This can be helpful when creating many comments at a time. Specify the property in the root of the JSON object, not in the "comment" object.

Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{id}/comments.json \
  -d '{"comment": {"body": "Good info!", "locale": "en-us"}, "notify_subscribers": false}'
  -v -u {email_address}:{password} -X POST -H "Content-Type: application/json"
Example Response
Status: 201 Created
Location: https://{subdomain}.zendesk.com/api/v2/help_center/comments/{id}.json

{
  "comment": {
    "id":        35467,
    "author_id": 89567,
    "body":      "Good info!",
    ...
  }
}

Update Comment

PUT /api/v2/help_center/articles/{article_id}/comments/{id}.json

Allowed for
  • Agents
  • The end user who created the comment
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/comments/{id}.json \
  -d '{"comment": {"body": "Did not work"}}' \
  -v -u {email_address}:{password} -X PUT -H "Content-Type: application/json"
Example Response
Status: 200 OK

{
  "comment": {
    "id":        35467,
    "author_id": 89567,
    "body":      "Didn't work",
    ...
  }
}

Delete Comment

DELETE /api/v2/help_center/articles/{id}/comments/{id}.json

Allowed for
  • Agents
  • The end user who created the comment
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{id}/comments/{id}.json \
  -v -u {email_address}:{password} -X DELETE
Example Response
Status: 204 No Content