Reply and Comment Threading API

For all the developers out there, we recently made some updates to our API to allow threading of replies and comments and comment posting.  In the Get Satisfaction data model, there’s a distinction between “replies” and “comments”.  Replies are the main interaction type that happen underneath topics.  Comments are the interaction that are nested underneath individual replies.  So the hierarchy is: Topics -> Replies -> Comments.

Here’s an example of this type of threading in our web application:

It’s important that we enable the same level of functionality in our API that our web application has to allow developers to create and customize great experiences, so we added the ability to distinguish between these two data types.  This change will allow developers to leverage the difference in how replies and comments are displayed.  In addition, it will allow users of the API to post new comments on replies.

Reply API call to filter out comments

Our current reply API endpoints return all replies and comments in chronological order with no distinction between the two data types.  The conversation is obviously lost here because there is no nesting or threading of comments underneath replies — they all appear as the same thing.  This default behavior on the reply API call can be overridden with a new flag called include_comments.  An example request might be the following:

GET  /topics/[TOPIC ID]/replies?include_comments=false

By including this flag, we will not include comments in the reply response.  In addition to excluding comments, we will now include two additional attributes on the reply object to allow you to easily drill down into the comments nested underneath an individual reply.  These are called comment_count and comments_url.  Here’s an example excerpt:

{ ...

"comments_url": "http://api.getsatisfaction.com/replies/[REPLY ID]/comments",

"comment_count": 2

... }

The above JSON excerpt allows you to see that there are two comments on this reply and it includes a reference to access those comments via another API call.

Comment API call

We added a new API endpoint to allow you to query for comments on a particular reply.  This is a simple called nested under the replies API path.  So, an example call might be the following:

GET /replies/[REPLY ID]/comments

This returns the comments that are nested underneath the given reply.

Posting a new Comment via the API

Given that you can now distinguish between comments and reply in the API, we also added the ability for you to post new comments on specific replies.  This endpoint is similarly nested underneath the replies path.  So, an example would be to do the following:

POST /replies/[REPLY ID]/comments

A simple payload for this POST could be the following:

{"comment":{"company_id":"[COMPANY ID]","content":"This is my new comment."}}

Have questions?

Please be sure to reference our API developer documentation to learn more about how to use the API.  And as always, if you have any questions, please jump into our Developer Community and ask it there.

Posted in General, Product Updates

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Request a Demo
Your Awesome Hosts

David Rowley
CTO

Steven Pal
Dir of Consumer Products

Ramya Krishnamurthy
Dir of Business, Data Products

Udit Batra
Platform Product Manager

Categories
Join us on Facebook