Intro to API

Intro to API

API 101

As a prerequisite, you must question yourself how a small-sized application, can do such big operations, and brings the data on demand specific for you, among large databases.

If You Look Around, APIs are everywhere

API acronym comes from Application Programming Interface. In the context of APIs, the word Application refers to any software with a distinct function. Interface can be thought of as a contract of service between two applications. This contract defines how the two communicate with each other using requests and responses.

APIs help two applications talk to each other, in terms of request(API client) and response. There are many kinds of requests that can be sent over the internet :

  • GET - used to fetch data from the server or API gateway.

  • POST - used to upload data to the server

  • PUT - used to edit the pre-existing data on the server

  • PATCH - used to edit like PUT, but for smaller changes

  • DELETE - used to delete data from the server

In response, we get our data in request data format like JSON and status code. Ranges of Status Code are:

  • 1xx - Informational Response (denotes that the request has been received )

  • 2xx - Success Response (denotes that the request has been received and have been accepted)

  • 3xx -Redirect (denotes that some actions need to be taken in order to complete the request)

  • 4xx - Client Errors (denotes that the syntax is not as per the expectations or something is wrong)

  • 5xx - Server Error ( denotes that the server is not able to process the request as of now)

ย