API 101: Terminology You Should Know

API KEY

An API key is a unique identification number provided to each user who wants to make an API calls. It can be free of cost or providers can charge for the key. It’s basically a secret token that is used to identify the root of a request.

API key
API KEY

Suppose, you want your users to sign-in to your website using their Facebook profile. In that case, you will need facebook API.
API keys are a form of authentication to keep track of the users and their activities. Let’s see an example of how API key looks

HTTP Methods

HTTP has eight different kinds of methods. The eight HTTP methods are – GET, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT and HEAD.

  • GET – Retrieves the content of an existing resource.
  • POST – Submits a request to an existing resource. It can update the resource.
  • PUT – Creates a new resource at the specified URI.
  • DELETE – Removes the resource defined at the specified URI.
  • HEAD – Returns just the HTTP response headers as if a GET request had been submitted to the specified URI.
  • TRACE – Echoes back the supplied request to see what modifications may have been made to the request by intermediaries in-flight.
  • OPTIONS – Returns what options and features the web server supports. 
  • CONNECT – Used to establish TCP connections to a server.  Used to support SSL secure communications.

    credit: quora

Request and Response

Whatever you do with an API surrounds making calls to that API. These calls can be request for getting data and then the response is what the API is bringing back to that call.

Request and Response Cycle
Request and Response Cycle

REST API

REST or REpresentational State Transfer is an architectural style for exposing your program using existing protocols. . It is a recommended style to follow. It uses HTTP requests such as GET, PUT, POST and DELETE methods on data. In REST architecture everything is considered as resource. It helps users to connect and interact with cloud services efficiently.

REST API

JSON

JSON is a text-based, human-readable data interchange format used for representing simple data structures and objects in web browser-based code.

Dipak Narola

JSON stands for JavaScript Object Notation.  It’s a lightweight data-interchange format. It’s very easy to understand and also independent. JSON is a collection of name and value pairs

Sending Data in JSON format

var myObj = {name: "John", age: 31, city: "New York"};
var myJSON = JSON.stringify(myObj);
window.location = "demo_json.php?x=" + myJSON;

Receiving Data

var myJSON = '{"name":"John", "age":31, "city":"New York"}';
var myObj = JSON.parse(myJSON);
document.getElementById("demo").innerHTML = myObj.name;

Leave a Reply

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