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.
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.