Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Java Tutorial
  • Java Spring
  • Spring Interview Questions
  • Java SpringBoot
  • Spring Boot Interview Questions
  • Spring MVC
  • Spring MVC Interview Questions
  • Java Hibernate
  • Hibernate Interview Questions
  • Advance Java Projects
  • Java Interview Questions
Open In App
Next Article:
HTTP headers | Set-Cookie
Next article icon

JSP - HTTP Status Codes

Last Updated : 17 Mar, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

When the Client makes any requests to the server, the Status Codes are issued by the server as a response to the client's request. So, in an application, we have the client and the server architecture. The server is the part that holds the particular web service or an API. The client is the actor who sends that HTTP request to the server. So, whenever the client sends the HTTP request, the server processes that request and it sends back the HTTP response.

The HTTP request contains the HTTP Status Code, body, as well as the headers. Out of these HTTP Status Code is a three-digit number. This three-digit number has a meaning associated with it and all the clients who invoke the HTTP request or receive the HTTP response are very well aware of the meaning of the HTTP Status Code. So, by reading the Status Code, they will understand what the response to that request is, and depending on whether it is a success or it is an error response, they can take the next steps for processing.

In this article, we are going to explore HTTP Status Codes, the different categories of these Status Codes, commonly used Codes, and finally, we will see the HTTP Status Code received in response by sending a few requests via Postman.

HTTP Status Code

Note: HTTP Code are universally recognized by all the HTTP applications. It is irrespective of the technology.

HTTP Status Code Categories

The status code has been divided into total five groups. Which means the number of status codes we had has been divided into five groups. Within each group, there are different values that will have different meanings, which we will explore here. Five group is 1xx, 2xx, 3xx, 4xx and 5xx. Here x means that any value can come here. We also use x in ethical hacking that any matter can go there.

  • 1xx (Informational Codes): This category is used whenever the request is received by the server and is continuing the process.
  • 2xx (Success Codes): This category is used whenever the request is processed successfully by the server.
  • 3xx (Redirection Codes): This category is used whenever you want to redirect the client to some different URL.
  • 4xx (Client Error Codes): This category defines the error codes which are caused due to the issue in the input request which is sent by the client, it could be issue with the payload or authorization header.
  • 5xx (Server Error Codes): This category defines the error codes because of the issue that has happened on the server side while processing that request.

Commonly Used HTTP Status Codes

Here are some commonly used HTTP Status Codes in all of these categories:

2xx (Success):

  • 200 (OK): It is frequently used in GET request.
  • 201 (Created): It indicates that the resource is successfully created by the Server
  • 202 (Accepted):
  • 206 (Partial Content): It indicates that the request is processed successfully but it is kind of a partial success not entirely that request is successful.

3xx (Redirection):

  • 301 (Moved Permanently): It indicates that this particular api has been moved to some different URI.

4xx (Client Error):

  • 400 (Bad Request): It indicates that the request itself has some syntax error or it is missing mandatory parameters.
  • 401 (Unauthorized): It indicates that the client is not able to successfully authenticate himself.
  • 403 (Forbidden): It is also on the same lines of 401 but the only difference is the authentication is successful. The resource also exists on the server side but the user does not have access for that particular resource.
  • 404 (Not Found): In case the resource is not found or even if you enter any invalid URL.
  • 405 (Method Not Allowed): The particular API supports only GET method and if you are trying to use post or delete in that case you might get these errors.

5xx (Server Error):

  • 500(Internal Server Error): It indicates that there were some issues with processing of that request.
  • 501(Not Implemented): It indicates that the URI that we are trying to implement or the method that we are trying to implement itself is not implemented on the server side.
  • 503(Service Unavailable): It indicates that the request could not process either because the server was not available, or it was down due to some reasons.
  • 504(Gateway Timeout): This error occurs for e.g. if the server is acting as a proxy, then it receives the timeout from the upstream servers.

Output of HTTP Status Codes in Postman

Below are few examples of HTTP Status Code in a few of the requests that you might encounter in Postman.

200 OK:

Output for 200 OK

201 Created:

Output for 201 Created

400 Bad Request:

Output for 400 Bad Request

404 Not Found:

Output for 404 Not Found

406 Not Acceptable:

Output for 406 Not Acceptable

500 Internal Server Error:

Output for 500 Internal Server Error

Next Article
HTTP headers | Set-Cookie

J

jagrutigoswami402
Improve
Article Tags :
  • Advance Java
  • Dev Scripter
  • Java-JSP
  • Dev Scripter 2024

Similar Reads

  • Servlet - HTTP Status Codes
    For each HTTP request and HTTP response, we have messages. The format of the HTTP request and HTTP response messages are similar and will have the following structure − An initial status line + CRLFCRLF =  ( Carriage Return + Line Feed i.e. New Line )Zero or more header lines + CRLFA blank line, i.e
    5 min read
  • HTTP 201 status code
    What is HTTP ? HTTP stands for Hyper Text Transfer Protocol. Using this protocols, the clients communicate with server and vice versa. This concept is the core of internet, since it was created in 1990. HTTP is basic yet powerful file transfer protocol. Features of HTTP: HTTP is connectionless: This
    3 min read
  • What are HTTP Status Codes ?
    HTTP Protocol is used everywhere from the server page to each service communication, deploying service to monitoring service. HTTP codes give an extension of HTTP protocol to debug network problems using curl, telnet able to check server availability, service responses HTTP status code is used for s
    8 min read
  • Can you console all HTTP status code in Node.js ?
    NodeJS is a runtime environment built to run Javascript outside the browser. It is widely used to build servers at the backend, which interact with the frontend such as websites, mobile applications, and many more. In this article, We will check whether we can console all HTTP status codes in NodeJS
    3 min read
  • HTTP headers | Set-Cookie
    The HTTP header Set-Cookie is a response header and used to send cookies from the server to the user agent. So the user agent can send them back to the server later so the server can detect the user. Syntax: Set-Cookie: <cookie-name>=<cookie-value> | Expires=<date> | Max-Age=<no
    2 min read
  • HTTP headers | Set-Cookie2
    The HTTP Set-cookie2 is response type header and it is obsoleted. It is a provider of the mechanism to serve and retrieve state information from the client to the server. The usage of this command is usually replaced by the set cookie instead of the set cookie2. The usage of this command cookie2 is
    2 min read
  • HTTP headers | Accept-Patch
    The Patch is used for making partial changes to an existing resource. The Accept-Patch HTTP header is a response HTTP header that specifies the patch document is supported or not and also the media type that the server is able to understand. The presence of a specific patch document format in this h
    1 min read
  • HTTP headers | Tk
    The HTTP Tk header is a response-type header it is used to indicates the tracking status that applied to the corresponding request. Syntax: Tk: ! (under construction) Tk: N (not tracking) Tk: T (tracking) Tk: C (tracking with consent) Tk: P (potential consent) Tk: D (disregarding DNT) Tk: U (updated
    2 min read
  • Node.js Exit Codes
    Node.js is a cross-platform, open-source back-end JavaScript runtime environment that uses the V8 engine to execute JavaScript code outside of a web browser. Node.js allows developers to utilize JavaScript to create command-line tools and server-side scripting, which involves running scripts on the
    3 min read
  • What is HTTP ?
    HTTP (Hypertext Transfer Protocol) is a fundamental protocol of the Internet, enabling the transfer of data between a client and a server. It is the foundation of data communication for the World Wide Web. HTTP provides a standard between a web browser and a web server to establish communication. It
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences