- To use the Instagram API (and many other APIs)
- Knowledge about json
- Be able to analyze a json object
- Extract whatever you want from the json object via jQuery and Ajax
- From the curriculum: “interfaces for data exchange with the services of a third party”.
- Analyze a Json object – use this (or a similar) site.
- Instagram Developer.
- What is my user id on Instagram?
- Read the tutorial p. 383 in: “jQuery – the missing manual” (2008: 370 pp. “Json”, 395 pp. “Jsonp”, p. 398 “Adding Flickr images to your site”.)
How to use the Instagram API
The Instagram API is just one of manu APIs. They all work in a similar manner. When you know how to use one, the steps towards using another is not that difficult.
In the client manager (click on “Manage Clients) you can make one or more clients. You’ll receive:
- Client id
Now you’re ready. With these informations you can begin to use the Instagram API.
The endpoints are more or less working samples of API urls. Try to click these urls:
- This will give you an error: https://api.instagram.com/v1/media/popular (because there is no token.
- Try to add your token to the url, like this: https://api.instagram.com/v1/media/popular?access_token=261168726.f59def8.7f35880a94b141bb81072f6d0153fd20
The result of the last query is a json object. For a “quick and dirty” query this may be enough.
If you want a specific number of images you may use &count=21.
The API Console
For more advanced queries you need to format the url. Here you can use the API console. The API console will help to format a relevant url.
Tip: the iframe is annoying. Try to click view in full.
Apigee – opens to a world of APIs
Instagram’s API is just one among many APIs. If you try to click on providers you’ll see a long list all the API, that you can use via Apigee. But there are more APIs out there. Most of them will work in a manner similar to what you’ve seen here.
How to use Instagram’s API
Look at Apigee’s explanation here.
HTML5 and jQuery Sample
First get the data via jsonp. You can use jQuery in order to loop through and append data to tag ids.