A great way to start learning about a topic is to watch a video on YouTube. This video is called REST API concepts and examples. This post uses some examples from that video.
We have a previous post that briefly discusses HTTP methods (verbs) in REST.
REST allows one piece of software to talk to another. You can make a request to a server for data by using a REST API. For example, in your browser, you can type graph.facebook.com/youtube instead of www.facebook.com/youtube. Here you have made a request to Facebook’s graph API. If you have logged in to facebook previously made the above request, you get back text in JSON format. JSON has structured data in the format of key/value pairs. In my case I got back an error message as follows
"message": "An access token is required to request this resource.",
In order to actually get back data for this site, you will need to get a developer’s account. YouTube describes this process on their page.
We can use parameters on our API request to filter the data we get back for only the data items we need. For example we could filter for ID, name and likes. Likes will return the number of likes this page has. To add paramters all we need to do is change our request to this: graph.facebook.com/youtube?fields=i,name,likes.
Here is the URL we would use to get back a response that has information about the city of Chicago: maps.googleapis.com/maps/api/geocode/json?address=chicago&sensor=false. This time we didn’t need an account.
Instagram’s Media Search
Go over to Instagram API Platform to access the media search endpoint.
JSONPlaceholder is a free online REST service that you can use whenever you need some fake data. It’s great for tutorials, faking a server, sharing code examples.