What’s an API. What can I use it for?

What’s an API? What is it good for?

First, let’s get it out the way, API means Application Programming Interface.
If I let this sits here and go, you’ll gonna hate me. So let’s dive in.

Remote control Twitter

When you’re using an online service as Twitter let’s say, you create Tweets, make likes, follow people, make lists, and so on.
All these actions that you performed are all perfectly stored at Mr. Twitter’s.
Imagine that you want to get all the tweets back from your feed to make a nice little summary.
How are you gonna ask Mr. Twitter to send all your data to you?
Well, Mr. Twitter in its wisdom allows you to remote control Twitter.
What you wanna do is send this command: « Please Twitter, send me all my tweets from today. And by the way, I’m Ernest Hemingway and this is the proof »
You just used the Twitter API.
Did you notice that you told Twitter who you are? When using an API, most of the time you must identify yourself, and provide a proof —usually it’s a « token ».
You can find this « token » in your account admin.

These « remote controls » are not only for « reading » or retrieving data from a service. You can also find commands which allow you to « write » or perform an action inside the online service you’re using.
Let’s use again this good Twitter guy. You are able to launch a command towards Twitter which says: « please, write a tweet coming from my account @Hemingway_theRealOne which will be “I’ve got a new weapon. It’s called API, yay”. By the way, it’s me, Ernst, got my token ? »

Play Lego with the web services

Here comes the fun. We’re gonna play Legooo :))
If I can retrieve data from an online service and write it onto another one, it opens a whole new world of possibilities where I can automate processes.

It would be very convenient if I could automatically subscribe to my mailing list the attendees to an event I host on Eventbrite.
Yes, you can :)
Eventbrite lets me use its API to retrieve a registered attendee and Mailchimp —for example— lets me create a new contact into one of my lists.

And the beauty of it is that you can find services which help you use APIs even if you are not a developer.
We live in a wonderful world.
There are at least 2 popular services at the moment which give you this. IFTTT and Zapier. The example I just gave above has been drawn from Zapier. Check it here

I already hear you say « Come on, how does Zapier knows that I want to retrieve the contact of the person who just registered to my event ? »
Without going too far into technical details, let’s imagine that Mr. Zapier « listen » what goes on your Eventbrite account. As soon as somebody registers to your event, Eventbrite fired up a signal: « Dring dring Mr. Zapier! Thelonious Monk just registered for the Christmas Eve session arranged by Miles Davis »
This will wake up Mr. Zapier, who will retrieve the data sent by Mr. Eventbrite and will send to Ms. Mailchimp (yes Mailchimp is a gal) the following command: « please, subscribe Mr. Monk to Mr. Davis” mailing list. By the way here is the proof that I can do it »

Wanna use API? You’ve got resources

In fact, hundreds of web services « expose » their API. Take a look here.
Not every API can be used through IFTTT or Zapier, though. But there’s enough in there to let you get a hang of it.
Go hang out on their page. And do not forget to come back and tell me what you’ve tried.
In any case you would want to build some elaborate Lego thing and don’t know how to do it, just ask.
Have fun :)