r/redditdev•
Apie

What are the downsides to simply using the .JSON urls and parsing the response vs making calls to the Reddit API?

I want to play around with creating some metadata for posts as a side-project to flex my coding muscles. Are there downsides to just downloading the JSON for a post by appending .json? What do you lose?

My understanding is that the Reddit API allows you to interact with reddit on behalf of the user. I don't have any aspirations like that. I am happy to work with whatever is publicly available to a non-logged in user. Are there any other downsides?

Thanks in advance!

Posted Sep 27, 2019, 1:13 PM UTC

39
[deleted]•

[deleted]

5
ApieOP•

Thank you very much!

Do you happen to know a library that does that, rather than wrap the API? I will do this myself, but it will be handy to have a reference library to work from. The JSON is pretty dense at first sight.

1
[deleted]•

[deleted]

1
ApieOP•

Thanks, that's a very useful insight! Off to github!

1
Aidgigiprofanitycounter Developer•

I’ve been using praw for a while and it’s really easy to work with. You can use it just to analyze posts and take user actions like replying or upvoting. It’s really a great library for python and the models are really simple to grasp.

1
Nuit013•

Aren’t there limits to how many posts you can request in one page, and how many pages back you can go?

1
kemitcheReddit Admin•

If you're accessing the API without creating and using OAuth app credentials, you would be breaking the rules for API access.

It's not the biggest problem, but it would put you in the bucket of "people using the API without following the rules," which could affect how your requests are perceived. For example, if there are problems with how you're accessing the API, Reddit may default to blocking your requests instead of reaching out to you to try and resolve the issue.

Strictly speaking, please use app-only authentication with an OAuth client ID & secret, but for small projects or ad-hoc poking around at the API, it's ok to just fetch the .json.


Separately, if you're new to Reddit's API, I definitely recommend using one of the existing 3rd party API wrappers to access it. They generally simplify the process of making requests with legitimate OAuth tokens and provide a nicer interface into Reddit's data and methods.

5
ApieOP•

Thanks, I appreciate the comment. It's helpful to get a reddit admin that responds. I'm kind of keen to play with the json api but if this little project makes it past simply toying around I'll switch to the app-only OAuth.

Appreciate the nudge in the right direction. 🙌

1
kemitcheReddit Admin•

Sounds like a great plan!

1
haykam821•

If you're accessing the API without creating and using OAuth app credentials, you would be breaking the rules for API access.

Does this mean I'm not allowed to append .json to URLs for quick access?

1
kemitcheReddit Admin•

Quick access is fine! Sorry if I sounded too scary.

1