Monday, July 1, 2019

API Testing 05: Client Server Architecture and HTTP Protocol

Client - Server Model:

In client-server architecture the machine that requests for some data or the machine that consumes the data is called as a Client and the machine the accepts the client's requests and provides the required data as response is called  as a Server.

The client and server connected with each other with Internet (world wide web), and they uses common medium and common language to communicate with each other.

The medium they use is HTTP Protocol and the language use JSON or XML data formats.

Which means the client will be sending HTTP Request to server in JSON or XML format, server understands the request and sends HTTP Response in JSON or XML format.

Below is the sample image showing the client server architecture.



HTTP Protocol:

Hyper Text Transfer Protocol is mostly used for transferring the files (HTML files, Images, Videos and etc.) over the internet. REST APIs or RESTful Web Services makes use of the basic features of HTTP protocol like connection less, media independent and stateless and became powerful web services.

The request sent from client to server using HTTP Protocol is called HTTP Request and the response that a server sends to a client is called HTTP Response.

HTTP Methods:

HTTP has different methods to perform different operations on the REST APIs, the mostly used HTTP methods are called CRUD operations which stands for Create, Read, Update and Delete operations.
  • Create - POST Request : This is used for creating a new resource on the server side.
  • Read - GET Request: This is used for reading the resources on server side.
  • Update - UPDATE Request: This is used for updating the resources on the server side.
  • Delete - DELETE Request: To delete the resources from server

HTTP Request Structure:

HTTP Request is a packet of information that a client machine sends to server machine for required data. HTTP Request consists of:
  1. Request Line
  2. Zero or more headers
  3. An empty line
  4. An optional body
1. Request Line: It consists of request method (GET/POST/PUT), request URI and HTTP Protocol version. Example:

Get http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1

2. Headers: Headers can be zero or more. Used for language specification, content-type, proxy specification, authorization specification and etc. Example:

Accept-Language: en-us
Content-Type: application/JSON

3. Empty line: Indicating end of header fields

4. Optional Body: Used for sending additional information to server in the form JSON or XML.

HTTP Response Structure:

HTTP Response is result or response from the server machine to client machine for the request it sent. It consists of:
  1. Status Line
  2. Zero or more headers
  3. Empty Line
  4. Option body
1. Status Line: It consists of HTTP Version, Status Code and Reason Phrase

2. Header: It contains, Content-Type, Server and etc specifications. Example:

Server: Apache/2.2.14 (Win32)
Last-Modified: Wed, 08 Feb 2019 16:47:36 IST
Content-Length: 88
Content-Type: text/html

HTTP Status Codes: Some of the HTTP Status codes and their description below
  • 200 - OK
  • 201 - Created
  • 202 - Accepted
  • 204 - No content
  • 400 - Bad Request
  • 401 - Unauthorized
  • 404 - Not Found
  • 500 - Internal Server Error
  • 501 - Not Implemented
Thanks for reading. Hope this post gave you basic understanding of client-server architecture and HTTP Protocol.

#HappyLearning #HappyTesting

7 comments:

  1. On this page you can read my interests, write something special. קבלן בונה

    ReplyDelete
  2. MAXON Computer GmbH built up the application in Germany.Here

    ReplyDelete
  3. It's difficult to state precisely how their business tolerating the coins will influence them, yet it is critical to mull over the way that their customers to a great extent incorporate PC specialists and other learned individuals. As it were, it's difficult to turn out badly with tolerating Bitcoin as an innovation organization. bitcoin mixer

    ReplyDelete
  4. All architects have some expertise in something, private structures that accentuate energy proficiency, clinics, schools, contemporary plan, etc. All architects are bad at all things, so steer away from the architect who is attempting to be everything to all clients. online architect plans

    ReplyDelete
  5. Construction projects are major endeavors that involve a lot of equipment - those heavy machinery used to transport and move large materials, and a lot people - the construction workers. The larger the construction project, the greater the number of equipment and people is needed. reformas pisos zaragoza

    ReplyDelete
  6. Nice Information thanks for sharing with us With the evolving online strategies, all the professional SEO services thus help these varieties of businesses to grasp and to stay up with the market trends and also the program rules. It’s very necessary that you just choose an SEO Agency in Wellington of Ocean Digital. For more information regarding company SEO services reach to its website.

    ReplyDelete

DevOps 01: What is DevOps and How it benefits organizations?

DevOps is a culture in an organization, where the development team and operations team help each other by sharing information, process and t...