Tuesday, February 4, 2020

HTTP Status Codes

 

Are you confused and frustrated?  Is your answer, "Yes".  I suspect you were using the web, and you thought you used the correct name of the site you were seeking.  However, instead of the site you were seeking a box popped up and told you, "404 Page not found." 

Let me explain the problem.  What you received was an explanation of what happened.  The "404" was an HTTP code.  When you enter an incorrect site name, you automatically receive a status code from the server.  A code number informs you every time you make a request of the server.  If there wasn't a problem, you would receive the number "HTTP 200," which means everything is O.K. 

  1. The 1xx Requests: Informational
  2. The 2xx Requests: Successful
  3. The 3xx Group: Redirects
  4. The 4xx Group: Client or Your Errors
  5. The 5xx Group: Server Errors

When the server sends you an informational response, it is telling you your request is not only received but also understood.  Because the processing of your request still must continue, this response to your request is considered provisional.  You are being notified that you must wait for a final response to your request. 
  • 100 Status Code – Continue: A 100-status code tells you a part of your request was received.  Since there were no problems, you should now send the rest of your request.
  • 101 Status Code – Protocols Switching: Written as HTTP 1.1, this status code is a type of protocol used to transfer data on the web.  A 101-status code tells you the server is changing the protocol that is in the “Upgrade” header.  After the protocol is changed, the server will return it to you, the client.


  • 200 Status Code – Everything is OK: This status code is the most common status code you will get from the server.  The message sent to you from the server is that the server has received and understood your request and it is being processed.
  • 201 Status Code – Created Resource: This status code tells you that your request was successful.  Therefore, the server is creating a resource or new page.
  • 202 Status Code – Accepted and Processing: This status code tells you the not only has the server received and understood your request, but it will also process it.  However, the server may not immediately process it.
  • 203 Status Code – Information from Third Party: The server is telling you that your request was received and understood, but the information sent to you wasn’t from the original server.  Instead, it is from a third party.
  • 204 Status Code – No Content Needed: This status code is telling you that your request was both received and understood.  However, to send you any data is not necessary since there isn’t any need.

  • 300 to 303 Status Codes Resource Moved: These status codes tell you that the resource you requested has been moved to a new location either temporarily or permanently.  If you received a 300-status code, you will receive a list of possible locations. The server tells you the new URL that you should use when seeking this resource again.

  • 400 Status Code – Bad Syntax: This status code tells you the server couldn’t understand your request.
  • 401 Status Code – Lack of Authorization: This status quote informs you that before you can access this resource, the server must authorize you.
  • 404 Status Code – Not Found: This status code tells you the server didn’t find your resource at the URL you requested.  This status code is well known by most people who use the web.


  • 500 to 505 Status Codes – Server Error: This status code tells you it couldn’t complete your request because it stumbled upon something it didn’t expect.

Conclusion:  You may not agree with me at this point, but I do believe the HTTP status codes do make your use of the web easier. 
If your request is granted by the server, you were correct in your actions.  The status codes in the 200s automatically inform you that what you did was “successful”.

However, there are times the server receives your request and understands it but isn’t able to grant your request due to the resource moving.  A status code in the 300s tells you this is the case.

If you’re the problem because you made an error with your request, you’ll receive a status code in the 400s.  You may not believe it, but there are times the server blunders, and you would receive a status code in the 500s.
You now know the "why" of almost every HTTP status code.  Don't you feel like a genius?! 
              

No comments:

Post a Comment