Posts

A post represents content that a user shares with the community.

JSON Format

Posts are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
author_id integer true false The id of the author of the post. *Writable on create by Help Center managers -- see Create Post
closed boolean false false Whether further comments are allowed
comment_count integer true false The number of comments on the post
created_at string true false When the post was created. Writable on create by Help Center managers -- see Create Post
details string false false The details of the post
featured boolean false false Whether the post is featured
follower_count integer true false The number of followers of the post
html_url string true false The community url of the post
id integer true false Automatically assigned when the post is created
pinned boolean false false When true, pins the post to the top of its topic
status string false false The status of the post. Possible values: "planned", "not_planned" , "answered", or "completed"
title string false true The title of the post
topic_id integer false false The id of the topic that the post belongs to
updated_at string true false When the post was last updated
url string true false The API url of the post
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
Example
{
  "author_id": 3465,
  "featured": true,
  "id": 1635,
  "title": "The post"
}

List Posts

  • GET /api/v2/community/posts
  • GET /api/v2/community/topics/{topic_id}/posts
  • GET /api/v2/community/users/{user_id}/posts

Lists all posts, all posts in a given topic, or all posts by a specific user. When listing by specific user, the posts of the user making the request can be listed by specifying me as the id.

Allowed for
  • Agents
  • End users
  • Anonymous users
Filtering

You can filter the results with the filter_by query string parameter.

GET /api/v2/community/posts.json?filter_by=completed

The filter_by parameter can have one of the following values:

value description
planned list only posts with a status of 'Planned'
not_planned list only posts with a status of 'Not planned'
completed list only posts with a status of 'Completed'
answered list only posts with a status of 'Answered'
none list only posts with a status of 'None'
Sorting

You can sort the results with the sort_by query string parameter.

GET /api/v2/community/posts.json?sort_by=comments

The sort_by parameter can have one of the following values:

value description
created_at order by creation time. Default order
edited_at order by last edit time
updated_at order by last update time
recent_activity order by recent activity on the post
votes order by vote sum
comments order by comment count
Sideloads

You can sideload related records with the include query string parameter. The following sideloads are supported:

Name Will sideload
users authors
topics topics

See Sideloading related records in the Develop Help Center.

Parameters
Name Type In Required Description
filter_by string Query false Filter the results using the provided value. Allowed values are "planned", "not_planned", "completed", "answered" or "none".
sort_by string Query false Sorts the results using the provided value. Allowed values are "created_at", "edited_at", "updated_at", "recent_activity", "votes" or "comments".
Using curl
curl https://{subdomain}.zendesk.com/api/v2/community/users/{user_id}/posts.json \
  -v -u {email_address}:{password}
Example Response
Status 200 OK

{
  "posts": [
    {
      "id": 35467,
      "title": "How do I open the safe"
    }
  ]
}

Create Post

  • POST /api/v2/community/posts

Adds a post to the specified topic.

Allowed for
  • Agents
  • End users

Agents with the Help Center manager role can optionally supply an author_id as part of the post object. If it is provided, the post's author will be set to the value of the author_id key.

Agents with the Help Center manager role can optionally supply a created_at as part of the post object. If it is 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 post's topic from receiving a post creation email notification. This can be helpful when creating many posts at a time. Specify the property in the root of the JSON object, not in the "post" object.

Using curl
curl https://{subdomain}.zendesk.com/api/v2/community/posts.json \
  -d '{"post": {"title": "Help!", "details": "My printer is on fire!", "topic_id": 10046}, "notify_subscribers": false}' \
-v -u {email_address}:{password} -X POST -H "Content-Type: application/json"

# Setting the post's author:
curl https://{subdomain}.zendesk.com/api/v2/community/posts.json \
  -d '{"post": {"title": "Help!", "details": "My printer is on fire!", "author_id": 10056, "topic_id": 10046}}' \
  -v -u {email_address}:{password} -X POST -H "Content-Type: application/json"
Example Response
Status 201 Created

{
  "post": {
    "author_id": 888887,
    "featured": true,
    "id": 35467,
    "title": "Post title"
  }
}

Show Post

  • GET /api/v2/community/posts/{post_id}

Gets information about a given post.

Allowed for
  • Agents
  • End users
  • Anonymous users
Sideloads

The following sideloads are supported:

Name Will sideload
users authors
topics topics
Parameters
Name Type In Required Description
post_id integer Path true The unique ID of this Post
Using curl
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}.json \
  -v -u {email_address}:{password}
Example Response
Status 200 OK

{
  "post": {
    "author_id": 888887,
    "featured": true,
    "id": 35467,
    "title": "Post title"
  }
}

Update Post

  • PUT /api/v2/community/posts/{post_id}
Allowed for
  • Agents
  • The end user who created the post
Parameters
Name Type In Required Description
post_id integer Path true The unique ID of this Post
Using curl
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}.json \
  -d '{"post": {"title": "Help!", "details": "My printer is on fire!", "topic_id": 10046}}' \
  -v -u {email_address}:{password} -X PUT -H "Content-Type: application/json"
Example Response
Status 200 OK

{
  "post": {
    "author_id": 888887,
    "featured": true,
    "id": 35467,
    "title": "Post title"
  }
}

Delete Post

  • DELETE /api/v2/community/posts/{post_id}
Allowed for
  • Agents
  • The end user who created the post
Parameters
Name Type In Required Description
post_id integer Path true The unique ID of this Post
Using curl
curl https://{subdomain}.zendesk.com/api/v2/community/posts/{post_id}.json \
  -v -u {email_address}:{password} -X DELETE
Example Response
Status 204 No Content