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

Digital Literacy

Anthony c
Anthony c
20,907 Points

What is an API (in plain english)?

From what I can tell, an API is (almost always) just a set of pre-built methods that are provided (usually) by a company (or some organization that maintains data or code offering specific functionality). In some (or many) cases, these pre-built methods are used to (1) tap into a company's database (Facebook API) or (2) use the company's codebase for some niche functionality (stream.io / algolia search / jquery).

The other case would be using these pre-built methods to push your data to a company's platform (e.g. intercom.io's API or MailChimp API, etc.)

Yes, I know API stands for application program interface. Yes, I've read tons of SO/Quora questions full of programmers using jargon and 100 different synonyms for the same word. But when you cut away all the jargon, is this generally what an API is?

3 Answers

Ferdinand Pretorius
Ferdinand Pretorius
18,705 Points

Hi Anthony,

I think you understand the concept better than you think :)

However this article might clear things up for, it sure did for me.

http://www.poynter.org/news/media-innovation/138211/beginners-guide-for-journalists-who-want-to-understand-api-documentation/

Hope it helps!

Kevin Korte
Kevin Korte
28,148 Points

You've got it! An API is just a way that we, the developers can talk to another site or services. What the API can do is dependent on what the company or site that hosts it has built it for.

Sometimes it's a simple as getting the weather forecast from a weather API.

It could be a bit more complicated like auto-publishing a blog post to your Facebook or Twitter account.

It could be saving data to the companies database via their API - like in the event someone signed up for a service, you could save that user's data to a database you don't own via their API.

API's can also update your site, usually via webhooks. For instance stripe, the card payment processor does this. Say if someone signs up at your site, you save that user in your stripe account via the API. Stripe manages their subscription service. When something happens, like the client is invoiced, Stripe uses their API to send a webhook to your site to let you know what changed and when. This makes it easy for your site to stay in sync with Stripe.

Anthony,

Yes, it sounds like you have a pretty solid working knowledge of an API. Like many concepts in programming, I never fully understood what and API was until I needed to use one. Put simply, an API allows you to access data and functions from a third party application. They can be very sophisticated or fairly simple. Here's an example: If you wanted to create an online resume that showcases your new skills in programming, you could copy and paste your scores from teamtreehouse.com. This would work fine until you took a new course, then you would need to updated the information -- that's tedious and it's not that fun. The alternative would be to write a program that updates the information about how many points you have directly from your treehouse API every time your webpage loads:

Your API: https://teamtreehouse.com/anthonycomito.json

APIs are everywhere, and they make coding much easier. If you are interested in gaining some applied knowledge about APIs, you could check out the code academy api section.

Hope this helps!