DEV Community

technonotes-hacker
technonotes-hacker

Posted on

Promotion - API - 1

  • Why we need this interface ? To communicate between two different Language.
  • API means HTTP.
  • API is of REST & HTTP.
  • Fast API Tool --> its a framework in Python.
  • Its just a medium.
  • No validation takes place here.

Protocols

  • Set of rules or conditions.
  • Rules ? Based on the rules , the protocol will be defined.
  • We are going to communicate using HTTP Protocol only.
  • why we need follow ? If you follow , you will get the desired standard.

Methods

  • Hitting a GET request URL for testing purpose and you will get an output like below:

  • These outputs are maintained in the table structure.
  • If you are developing an API , if you can some standard via REST then it will be best in industry.
  • API as many categories like SOAP , REST , GRPC.
  • All these going to transfer only in HTTP Protocol.
  • Console Window --> Control + Shift + C
  • Cookie --> will have the details of the user.

  • Why not state-full ? It will be like residing in the same machine ,if you use stateless then it can go to any server , because the service may be hosted in many servers. It won't be in a single server.

  • State-full --> In the same machine.
  • State-less --> if the request goes to another server , this is useful.

  • There should be some COMMON format --> Data format --> On top of protocol only the data format will be sent. Eg., xml , json

https://www.tutorialspoint.com/xml/index.htm

  • Json format is equal to Dictionary in Python. ( nest dictionary & nested list )

Tools

  • bruno --> its a open source tool. ( Its a API client Tool )
  • Postman
  • How to install bruno ?
sudo apt update
sudo apt install bruno
Enter fullscreen mode Exit fullscreen mode

Examples

  • Amazon --> ordered in first page and now its went to CART , if the cart doesn't know means , what will happen ? Here comes the HERO is STATELESSNESS ( making no relation between one API to another API is called STATELESSNESS ).

Notes

Commands

  • env ( in linux )

Top comments (0)