Rest API Examples

REST[Representational State Transfer]: Click this link for REST API Basics

A RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data.

  1. A RESTful API — also referred to as a RESTful web service — is based on representational state transfer (REST) technology, an architectural style and approach to communications often used in web services development.
  2. A Rest API Works the same way normal Client Server Application Works.

Example 1 Facebook API:

  1. Access the Facebook API by accessing the url https://developers.facebook.com/tools/explorer/ in a browser.
  2. Fetch the Access Token by clicking on GetToken->Get User Token->Provide credentials of Facebook. Automatically the Access Token is updated in the text box.

Rest API Examples

  1. Provide the Query Params as mentioned below :

GET graph.facebook.com/me?fields=id,name,picture

Rest API Examples



  1.  Retrieve up to five albums created by someone, and the last five posts in their feed.

GET graph.facebook.com/me?fields=albums.limit(5),posts.limit(5)

  1. Retrieve the photos

GET graph.facebook.com/me/photos

Example 2 Google Maps API:

  1. Open Chrome Browser
  2. Provide the following url and verify the JSON[Java Script Object Notation]

http://maps.google.com/maps/api/geocode/json?address=newyork

Validating the JSON Response:

  1. Access jsonpath.com
  2. Provide the response and verify the content as mentioned below:

Rest API Examples

Accessing the Facebook API from Postman

  1. Download postman plugin in chrome.
  2. Launch Postman and update the following

    1. URL https://graph.facebook.com/me
    2. method type GET
    3. query params

      • access_token=<access_token from Example 1 Facebook API Step2 as mentioned above>
      • fields=id,name,picture

Rest API Examples

Accessing the Facebook API from WebBrower

  1. Open the browser
  2. Enter the following url
    https://graph.facebook.com/me?access_token=<access_token from Example 1 Facebook API Step2 as mentioned above>&fields=id,name,picture
    Rest API Examples

Leave a Reply

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