#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
4 min read
•Question 3 of 28easy

What is the difference between GET and POST?

Understanding GET vs POST HTTP methods.

What You'll Learn

  • GET method characteristics
  • POST method characteristics
  • When to use each

GET vs POST Comparison

FeatureGETPOST
PurposeRetrieve dataSubmit data
Data locationURL query stringRequest body
CacheableYesNo
IdempotentYesNo
BookmarkableYesNo
Data limit~2KB (URL limit)No limit

GET Request

code.jsJavaScript
// Fetch users with query params
GET /api/users?page=1&limit=10

// In JavaScript
fetch('/api/users?page=1&limit=10')
  .then(res => res.json());

POST Request

code.jsJavaScript
// Create new user
POST /api/users
Content-Type: application/json

{ "name": "John", "email": "john@example.com" }

// In JavaScript
fetch('/api/users', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'John', email: 'john@example.com' })
});

When to Use

  • GET: Fetching data, search queries, filtering
  • POST: Creating resources, form submissions, sensitive data