• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 124
  • Last Modified:

generic Error Messages and HTTP Status Code

hi,

i was reading as below

Throw generic Error Messages − A web service method should use HTTP error messages like 403 to show access forbidden etc.

What HTTP Status Code 201 states?
It means, CREATED, when a resource is successful created using POST or PUT request. Return link to newly created resource using location header.

What HTTP Status Code 204 states?
It means, NO CONTENT, when response body is empty for example, a DELETE request.
i see 200 UNKNOWN No body returned for response




What HTTP Status Code 304 states?
It means, NOT MODIFIED, used to reduce network bandwidth usage in case of conditional GET requests. Response body should be empty. Headers should have date, location etc.



What HTTP Status Code 400 states?
It means, BAD REQUEST, states that invalid input is provided e.g. validation error, missing data


What HTTP Status Code 401 states?
It means, FORBIDDEN, states that user is not having access to method being used for example, delete access without admin rights.



What HTTP Status Code 409 states?
It means, CONFLICT, states conflict situation while executing the method for example, adding duplicate entry.




any good example to test above http status codes?

using post when i tried to create a resourece i got 200 though not 201.

i searched in code for 200 or 201 to change but never found them?
where these numbers are coming from if not from code?
0
gudii9
Asked:
gudii9
  • 3
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
The HTTP codes are in the 'response headers' returned from the server, not in the page code.  If you have a program that will read the headers, you will be able to see them.
0
 
gudii9Author Commented:
The HTTP codes are in the 'response headers' returned from the server, not in the page code.  If you have a program that will read the headers, you will be able to see them

every server like tomcat, weblogic, websphere etc may have their own codes returned right?

where i can see list of what server returns what code in what scenario?
please advise
0
 
gudii9Author Commented:
No.  Basic HTTP codes are the same everywhere.  

basisc HTTP codes has a range right say 201-209 same thing?
so timcat may choose to use 201
weblogic 208 etc right which could cause confusion?
0
 
Dave BaldwinFixer of ProblemsCommented:
No.  You need to read the articles.  Each code has a different meaning.  Applications should always use the standard responses for the situation.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now