Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reddit Endpoint for comments for a particular article

I am trying to get all of the reddit comments for a particular article.

On the Reddit API page, it seems to suggest that:

www.reddit.com/r/subreddit/comments/ARTICLE

will get me these results (article being a variable), however if I go to an endpoint with the article appended after comments, all I get is a 404 error.

How do you get comments from a specific article via the Reddit API?

I'm doing this in Javascript, but this is obviously a language agnostic question.

like image 267
Steven Matthews Avatar asked Oct 29 '25 05:10

Steven Matthews


1 Answers

reddit's generated API documentation for the comments endpoint appears to be incorrect. The correct URL to use to retrieve comments for a post is:

https://www.reddit.com/r/{subreddit}/comments/{article ID}/irrelevant_string.json

Or for a specific comment:

https://www.reddit.com/r/{subreddit}/comments/{article ID}/irrelevant_string/{comment ID}.json

The "irrelevant string" can be just an underscore, it doesn't matter - on the website itself, it's a form of the title, but the API doesn't care about the title of the post.

like image 158
kemitche Avatar answered Nov 01 '25 12:11

kemitche



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!