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

General Discussion

How do API work?

I was looking for more information on APIs. Can someone help explain how they work?

Are you trying to something in specific?

5 Answers

You're basically making "calls" to api specific address,and api specific terms or data request, and in return their server responds with the data you requested. You can than use that data to display it on your application.

For instance I used weather.com's weather API for test site. It sent it a request for the weather information I was looking for and the location of that weather, and their API sent back that up-to-date weather info as json, which I used PHP to parse, and than i had the ability to use php to provide that weather information in a way that matched my site.

Thanks Kevin Korte. I appreciate the response. James Barnett I was curious on how to create an API.

To do what exactly?

In addition to Kevin Korte's answer, if you want to read up more about what APIs are you can check out Make Use Of's article What Is An API & What Are They Good For?

Zapier also did a really good free course called "API Zero to Superhero". https://zapier.com/blog/free-api-course/