REST API: Entries (forum topics)

"Entries" is the common URL location for forum topics.

Show

GET /entries/#{id}.xml

Returns a single entry.

Response

Status: 200 OK
<entry>
  <id>12</id>
  <forum-id>6</forum-id>  
  <title>This is the title of the topic</title>  
  <created-at>2007-01-03T00:10:08Z</created-at>
  <updated-at>2007-05-28T19:33:08Z</updated-at>    
  <hits>3</hits>  
  <last-post-id>17</last-post-id>
  <posts-count>2</posts-count>
  <is-locked>false</is-locked>  
  <is-pinned>true</is-pinned>
  <is-public>false</is-public>
  <submitter-id>3</submitter-id>
  <posts>
    <post>
      <user-id>3</author-id>
      <created-at>2007-06-03T20:15:45Z</created-at>
      <updated-at>2007-06-03T20:15:45Z</created-at>        
      <body>This is the first post</body>
      <body-html><p>This is the first post</p></body-html>        
    </post>
    <post>
      <user-id>5</author-id>
      <created-at>2007-06-04T10:07:02Z</created-at>
      <created-at>2007-06-11T11:17:43Z</created-at>        
      <body>This is the second post</body>
      <body-html><p>This is the second post</p></body-html>  
    </post>      
  </posts>  
</entry>

List

GET /forums/#{forum_id}/entries.xml

Returns all entries (topics) for a given forum. The list is paginated using offsets. If 25 elements are returned (the page limit), use ?page=25 to check for the next 25 and so on.

Response

Status: 200 OK

<entries count="87">
  <entry>
    ...
  </entry>
  <entry>
    ...
  </entry>
</entries>

List pinned entries (notices)

GET /entries.xml

Returns all pinned entries across all forums. The list is paginated using offsets. If 5 elements are returned (the page limit), use ?page=5 to check for the next 5 and so on.

Response

Status: 200 OK

<entries count="23">
  <entry>
    ...
  </entry>
  <entry>
    ...
  </entry>
</entries>

Create

POST /entries.xml

Creates a new entry.

Request

<entry>	
  <forum-id>6</forum-id>  	
  <title>This is the title of the entry</title>  
  <body>This is the text of the first post for the entry</body>  
  <current-tags>printer ink</current-tags>
  <is-locked>false</is-locked>    
  <is-pinned>true</is-pinned>
</entry>

Submitter of the entry is set to the authenticated user

Response

Status: 201 Created
Location: http://account.zendesk.com/entries/#{new-entry-id}.xml

Update

PUT /entries/#{id}.xml

Updates an existing entry with new details from the submitted XML.

Request

<entry>
  <is-pinned>false</is-pinned>
  <additional-tags>printing</additional-tags>   
</entry>

Response

Status: 200 OK

Entry set not to be pinned and "printing" tag added. You can remove tags with remove-tags and set tags with set-tags.

Destroy

DELETE /entries/#{id}.xml

Destroys the entry with the referenced ID. All related posts are destroyed as well.

Response

Status: 200 OK

Add post

POST /posts

Add a post to an existing entry.

Request

<entry-id>43</entry-id>
<post>
  <body>This is a comment to an entry</body>
</post>    

Response

Status: 200 OK

Update post

PUT /posts/#{post_id}

Edits an existing post.

Request

<post>
  <body>This is a edited comment to an entry</body>
</post>    

Response

Status: 200 OK

Destroy post

DELETE /posts/#{id}.xml

Destroys the post with the referenced ID.

Response

Status: 200 OK