API V1 is deprecated, Check out new API V2 here

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.

Request

Route

GET /v1/comments?search[post_id]=1523&search[user_id]=10213

Headers

Accept: application/json
Content-Type: application/json
Authorization: Bearer your_access_token-Bjpr2HnPK3TraVTF6HJld1qZj7y9HT02X5GM
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: W/"d0aeb9b81d78965364943bd88eba7a70"
Last-Modified: Wed, 05 May 2021 11:39:18 GMT
Content-Type: application/json; charset=utf-8
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 355

Body

{
  "comments": [
    {
      "id": 667,
      "body": "This is like the 43th best comment ever",
      "created_at": "2021-05-05T04:39:18.781-07:00",
      "parent_comment_id": null,
      "user_id": 10213,
      "subject_id": 1523,
      "child_comments_count": 2,
      "url": "http://www.producthunt.com/posts/awesome-idea-114#comment-667",
      "post_id": 1523,
      "subject_type": "Post",
      "sticky": false,
      "votes": 0,
      "post": {},
      "user": {}
    }
  ]
}