Comments and Comment Threads

comments#index - Fetch all comments filtered for a post and a user

Parameters

Name Description
older Cursor-based pagination: Only works with ID. Get records older than the provided id. Note: Sort_by is ignored and applied afterwards.
newer Cursor-based pagination: Only works with ID. Get records newer than the provided id. Note: Sort_by is ignored and applied afterwards.
page Offset-based pagination: Get content of given page, starts at 1
per_page Any kind of pagination: define the amount of records sent per call (max 50)
sort_by Sort api response: Valid options: id, created_at, updated_at
order Sort api response: valid parameters are desc and asc
search[user_id] The id of a user you want to filter for. If you pass this id the user won't be nested.
search[post_id] The id of a post you want to filter for. If you pass this id the post won't be nested.
search[ama_event_id] The id of a post you want to filter for. If you pass this id the ama_event won't be nested.

Request

Route

GET /v1/comments?search[post_id]=20&search[user_id]=255

Headers

Accept: application/json
Content-Type: application/json
Authorization: Bearer your_access_token
Host: api.producthunt.com

Response

Status

200 OK

Headers

X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Rate-Limit-Limit: 900
X-Rate-Limit-Remaining: 900
X-Rate-Limit-Reset: 900
ETag: "ba99b4534af9580c994af0318836a74d"
Content-Type: application/json; charset=utf-8
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 347

Body

{
  "comments" : [
    {
      "id" : 13,
      "body" : "This is like the 43th best comment ever",
      "created_at" : "2017-09-14T06:02:34.787-07:00",
      "parent_comment_id" : null,
      "user_id" : 255,
      "subject_id" : 20,
      "child_comments_count" : 2,
      "url" : "http://www.producthunt.com/posts/awesome-idea-114#comment-13",
      "post_id" : 20,
      "subject_type" : "Post",
      "sticky" : false,
      "votes" : 0,
      "post" : {},
      "user" : {}
    }
  ]
}