Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

Adedeji Awodele
Adedeji Awodele
1,964 Points

How do you know the url from which JSON data can be gotten?

Hi guys!

I was going through the videos for the iOS course: Build a simple blog reader; and was wondering if there is a way to know the url from which the json data for each website can be obtained.

What I mean is, in the video, the teacher readily provided the url (blog.teamtreehouse.com/api/get_recent_summary) to download the json data from but what if I wanted to get the json data for some random website, how do I know the url to access?

Kindly help.

Cheers.

2 Answers

You don't :) you can sometimes guess though! For example, appending .json to a URL sometimes returns the JSON version of that document. So www.reddit.com/.json returns JSON. Sites that want you to use their JSON will usually tell you about it and where you can find it through their API documentation.

If a site doesn't want you using their JSON you should probably respect that wish, but you can also sniff around and see if there's an undocumented API somewhere.

Otto Wichmann
Otto Wichmann
4,827 Points

I was also wondering this, thank you for the reply.

Cheers.

Adedeji Awodele
Adedeji Awodele
1,964 Points

Ha, thanks a lot for the reply Aaron! :)

Cheers.

I had this question too, thank you.