Playing around with REST APIs

Based on the following video:

Just try the following:
You get JSON back, which contains like the number of likes

Now use parameters:
Only id, name and likes are returned

Now let’s call Google maps to get back the longitude and latitide geo location:
Server is:
Resources are: maps, api, geocode, json
JSON resource is added because GoogleMaps can return data in a number of different formats

Now let’s add parameters again:
Here is the result:

Now let’s use this geo location to get pictures from instagram related to Chicago.
Go to:
In the menu on the left hand side, select API Console or type:
If we click on link “See it in full screen” we get to apigee:
Actually we can use the API dropdown to select from a bunch of public APIs.


For now we use the media search api from instagram:
We can select the the request URL for the GET call via the dockable menu on the left hand side:


Now click query to enter the parameters. In this case longitude, latitude and distance (eg 20 metres).

Click send and you will get a response:
Now if you look at the response, you will see a HTTP/1.1 200 OK
If you scroll down you see the body of the response.
Per Instagram picture there’s a URL you can copy to your browser to see the actual picture.

To find all APIs that are available, check out:

Finally. Instead of a GET request, you can also write data using a POST request. Normally with a POST you send dat
in the body of the request, something you can’t do in a browser. Download the Postman REST client.

Using Postman, you can add a body, but also one or more headers, like the OAuth or OAuth2 authorization header. OAuth is basically a username/password combination translated to an access token.
As an example let’s send an tweet out over the Twitter API:

After clicking Send, you can go to your Twitter page and see the post.

Leave a Reply

Your email address will not be published. Required fields are marked *