How to use an API

A short and (hopefully) friendly introduction to APIs - what they are and how they work.

This tutorial uses the content I usually deliver in face-to-face training sessions. The idea of this is to demystify APIs, for people who haven't worked with them much before. At the end of this you'll have looked at the structure of a typical API call - what each bit is and what it's for - and you should have a better idea of what APIs are, what they do, and how they work.

What is an API, anyway?

Wikipedia has a fairly detailed technical definition:

"In computer programming, an application programming interface (API) is a set of subroutine definitions, protocols, and tools for building software and applications. A good API makes it easier to develop a program by providing all the building blocks, which are then put together by the programmer."

There are also some good tutorials you can follow, like this one:

"An API provides you with data its programmers have made available to outside users.
They publish a portion of the language they've used to build their program.
Endpoints return text that's meant for computers to read."

But we can boil it down to something even more basic:

"The developers wrote some extra code into their server, so you can get data from it if you ask the question in the right way."