speaker Multimusen

Creative Advertizer F14 Day 2 (API)

August 19th, 2014 by

Learning objectives

  • 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”.

Practical Resources

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.

Before you can use the API in a production you’ll need authorization codes. Typically your app will have som client_id, there may be a secret and often there is a token for convenience when you work from a JavaScript or similar.

Instagram Developer - here you register.

Instagram Developer – here you register.

 

Manage Clients

In the client manager (click on “Manage Clients) you can make one or more clients. You’ll receive:

  • Client id
  • Secret
  • Token
Here are the clients.

Here are the clients.

Now you’re ready. With these informations you can begin to use the Instagram API.

The Endpoints

The endpoints are more or less working samples of API urls. Try to click these urls:

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.

The API Console.

The API Console.

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.