Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

What does an API (documentation) mean when it says, "will return JSON only" How does that limit my options?

If the documentation for an API states "will return JSON only" and "does not currently support JSONP" does that mean I can't build a website application? Does it mean the API is only meant for mobile apps?

1 Answer

You can still use that api for web apps, however you need a webserver, and a back-end app to make it work. This is because you can't make a request from a browser directly to an api, as it is a security issue. So to use that api, your app would need to:

Make a request to your server > your server to the api > api response back to your server > your server responds to the browser.

The webserver stuff is what is circumvented if the API supports JSONP, but since the one you mention doesn't, you still need a server.

Hope that helps!

-Andrew

Awesome thank you, that clears things up for me.