Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

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?
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

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.
Avatar of gudii9

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

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?
No.  You need to read the articles.  Each code has a different meaning.  Applications should always use the standard responses for the situation.