Article Comments

JSON Format

Article Comments are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
author_id integer false false The id of the author of this comment. Writable on create by Help Center managers — see Create Comment
body string false true The comment made by the author. See User content
created_at string false false The time the comment was created. Writable on create by Help Center managers — see Create Comment
html_url string true false The url at which the comment is presented in Help Center
id integer true false Automatically assigned when the comment is created
locale string false true The locale in which this comment was made
source_id integer true false The id of the item on which this comment was made
source_type string true false The type of the item on which this comment was made. Currently only supports 'Article'
updated_at string true false The time at which the comment was last updated
url string true false The API url of this comment
vote_count integer true false The total number of upvotes and downvotes
vote_sum integer true false The sum of upvotes (+1) and downvotes (-1), which may be positive or negative
User content

End users can add their own contents in the form of community posts, post comments, or article comments. Collectively, this is called user content. The format of user content is HTML-based.

Content may contain the following standard HTML tags:

  • Paragraphs and blocks: <p>, <div>, <span>, <br>
  • Text formatting: <b>, <i>, <u>, <strong>, <em>, <sub>, <sup>
  • Links and dividers: <a>, <hr>
  • Images: <img> (where the src attribute has to reference a user-uploaded image)
  • Headers: <h1>, <h2>, <h3>, <h4>, <h5>, <h6>
  • Bullet lists: <ul>, <ol>, <li>
  • Description lists: <dl>, <dt>, <dd>
  • Tables: <table>, <thead>, <tbody>, <tfoot>, <tr>, <th>, <td>, <colgroup>, <col>
  • Quotes and code snippets: <blockquote>, <pre>
  • Semantics: <abbr>, <acronym>, <cite>, <code>, <tt>, <samp>, <kbd>, <var>, <dfn>, <address>

In addition, the content may contain these non-standard HTML tags:

  • @mentions: <x-zendesk-user>, where the contents of the tag should be the user ID of the mentioned user. Example: <x-zendesk-user>1234</x-zendesk-user> to mention the user whose ID is 1234.

Even if the content is validated, the body that's output may not be identical to the request body. For example, adjustments may be made for security or standards-compliance reasons.

Example
{
  "author_id": 3465,
  "body": "Thanks for your help!",
  "created_at": "2012-04-04T09:14:57Z",
  "id": 1635,
  "locale": "en-us",
  "source_id": 65466,
  "source_type": "Article"
}

List Comments

  • GET /api/v2/help_center{/locale}/articles/{article_id}/comments
  • GET /api/v2/help_center/users/{user_id}/comments

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
Parameters
Name Type In Required Description
article_id integer Path true The unique ID of this Article
locale string Path false The locale that the category is displayed in
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/users/{user_id}/comments.json \
  -v -u {email_address}:{password}
Example Response
Status 200 OK

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

Create Comment

  • POST /api/v2/help_center{/locale}/articles/{article_id}/comments

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.

Parameters
Name Type In Required Description
article_id integer Path true The unique ID of this Article
locale string Path false The locale that the category is displayed in
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_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 200 OK

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

Show Comment

  • GET /api/v2/help_center{/locale}/articles/{article_id}/comments/{comment_id}

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
Parameters
Name Type In Required Description
article_id integer Path true The unique ID of this Article
comment_id integer Path true The unique ID of this Comment
locale string Path false The locale that the category is displayed in
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/{locale}/articles/{article_id}/comments/{comment_id}.json \
-v -u {email_address}:{password}
Example Response
Status 200 OK

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

Update Comment

  • PUT /api/v2/help_center{/locale}/articles/{article_id}/comments/{comment_id}
Allowed for
  • Agents
  • The end user who created the comment
Parameters
Name Type In Required Description
article_id integer Path true The unique ID of this Article
comment_id integer Path true The unique ID of this Comment
locale string Path false The locale that the category is displayed in
Using
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/comments/{comment_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": {
    "author_id": 89567,
    "body": "Good info!",
    "id": 35467,
    "locale": "en"
  }
}

Delete Comment

  • DELETE /api/v2/help_center{/locale}/articles/{article_id}/comments/{comment_id}
Allowed for
  • Agents
  • The end user who created the comment
Parameters
Name Type In Required Description
article_id integer Path true The unique ID of this Article
comment_id integer Path true The unique ID of this Comment
locale string Path false The locale that the category is displayed in
Using
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/comments/{comment_id}.json \
  -v -u {email_address}:{password} -X DELETE
Example Response
Status 204 No Content