Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

get
post

GET vs.​ POST

Educative Answers Team

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Both the GET and POST methods are used to transfer data from a client to a server in HTTP protocol.

The Hypertext Transfer Protocol (HTTP) enables communications between clients and servers. It works as a request-response protocol between the client and the server for an exchange of data.

  • GET: The GET method requests data from a specified resource.
  • ​POST: The POST method submits the processed data to a specified resource.

Functional differences​

The POST method supplies additional data from the client (usually a web browser) to the server in the message body. A sample POST request has a message body that looks something like this:

POST /sample/my_form.php HTTP/1.1
Host: educative.io
param1=item1&param2=item2
svg viewer
A HTTP request using POST method.

In contrast, the GET method includes all the data required by the server in the URL. All of the data that​ is to be sent is appended to the URL as query string parameters. A sample GET request looks something like this:

educative.io/sample/my_form.php?name=form_name&number=form_number
svg viewer
A HTTP request using GET method.

The following table summarizes other differences between GET and POST:

GET POST
Bookmarked Can be bookmarked and cached. Can neither be bookmarked nor cached.
Data Length Data length is usually restricted ​to 2048 characters. No restrictions on the amount of data that can be sent.
Data type Only Ascii characters allowed. Binary data is also allowed.
Security GET is less secure than POST because sent data is part of the URL. POST is a little safer than GET because the parameters are stored neither in the browser history nor in the web server logs.

RELATED TAGS

get
post
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring