Monday, May 15, 2023

Basics of Web API- HTTP

Hyer-Text Transfer Protocol(HTTP)

  • HTTP(Hyer-Text Transfer Protocol) is a communication protocol on the web that is used to transmit data.
  • Extensible using Headers to send/receive extra information
  • Stateless, doesn’t maintain state unless using HTTP cookies to maintain the communication session or state.

HTTPS

S stands for secure, which means communication between client and server will happen via a secure channel using SSL\TLS encryption protocol.

TLS is the successor of SSL. TLS v1.3 is the latest version. The minimum recommended version of TLS is TLS v1.2, which the website should use to maintain a secure website.

HTTP Request Methods

  1. GET-Used to retrieve data. We can pass the parameter via query string to retrieve data based on the parameter.
  2. POST-Used to submit data within request body. This is usually used to pass personal or confidential data.
  3. PUT-Used to edit record to resource server without creating new record.
  4. DELETE-Used to delete a record in resource server.

Other methods are PATCH, OPTIONS, HEAD, TUNNEL, TRACE.

Content Types

  1. Plain-Data will be sent ‘as-is’ in plain text without any encryption, serialization or encoding.
  2. json-Data will be serialize in JSON format when sent from POST or PUT request body.
  3. form-url-encoded-This is represented as key-value pair of request parameter that are sent as request body.
  4. form-data-Used when uploading form fields that includes file upload. It uploads data in multiple parts. Use it when sending binary or large payload.
^ Scroll to Top