Questions tagged [http-status-codes]

HTTP status codes are a set of standardized codes returned in an HTTP web response. Questions about why a service is (unexpectedly) returning a status code should not use this tag.

For a full list of the status codes see the HTTP 1.1 specification, WebDAV specification, RFC 6585, and the IANA list of status codes.

HTTP status codes have specific meanings which are outlined in the specification that they were created in. They can be used in contexts outside of what the specification states, but must adhere to any conditions that have been established in the specification.

1693 questions
0
votes
2 answers

RESTful API design: Validity of username

I am designing a RESTful API which should return the validity of a username for registration. The invalid cases include: duplicate username too short or too long invalid characters My current design is: GET /valid_username/{username} returns 204…
lz96
  • 2,816
  • 2
  • 28
  • 46
0
votes
1 answer

REST response code for backend invalid data

I just want to clarify regarding the status code in case if there is invalid data in the database. E.g. If something changed in the data base which cause error when call the GET end point. For instance lets assume in the database there is column to…
Shabar
  • 2,617
  • 11
  • 57
  • 98
0
votes
2 answers

HTTP status code for noncritical server errors

Which HTTP status code shall I return, in my API, in case of non-critical server errors? For example, SomeMethod is called, but fails, because of null passing, or maybe some errors while trying to access database, whatever. I thought about 500…
Yurii N.
  • 5,455
  • 12
  • 42
  • 66
0
votes
1 answer

REST HTTP status code for error with side effects

I've got an HTTP POST method that has numerous validations. Some mean the request is flat out invalid, and we return a 400 Bad Request. However, for some of them, even in the case of the request being invalid, we need to create a resource and…
GoatInTheMachine
  • 3,583
  • 3
  • 25
  • 35
0
votes
2 answers

Fetch HTTP status code in C#

I apologise if this is an obvious, stupid or previously answered question... but I've been searching around for an answer for hours now and haven't found anything to help me. I'm writing a simple application which generates a random string of…
Whiskers
  • 1
  • 1
0
votes
1 answer

htaccess send status error if FireFox and redirect

Is there a way of redirecting all Firefox users IN CURRENT DIRECTORY, to a root error page ("/error.php"), and possibly displaying the status code of 417 Here is my code so far: RewriteCond %{HTTP_USER_AGENT} ^.*Firefox.*$ RewriteRule .* -…
0
votes
2 answers

Return HttpStatusCode.BadRequest from Initialize method

I want to return BadRequest status code from Initialize method. I understand, how can I do it from any Action ( return new HttpStatusCodeResult(HttpStatusCode.BadRequest) ), but how to do it from Initialize? I try the…
Oleg Sh
  • 8,496
  • 17
  • 89
  • 159
0
votes
1 answer

What to do if a RESTful api is only partly successful

In our design we have something of a paradox. We have a database of projects. Each project has a status. We have a REST api to change a project from “Ready” status to “Cleanup” status. Two things must happen. update the status in the database send…
John Henckel
  • 10,274
  • 3
  • 79
  • 79
0
votes
2 answers

Return HTTP status code using REST API

How do we return a HTTP status code with the object returned in REST API using VB.NET Framework 4.0? I have Googled this and found some solutions like throwing the error before returning the object as below: Public Function InfoAndTerms(ByVal Lang…
Mlle 116
  • 1,149
  • 4
  • 20
  • 53
0
votes
1 answer

Which http statuscodes to use for external APIs in a REST service?

I have a REST webservice that encapsulates multiple external APIs. Let's assume my customers can input a BookingId to my REST webservice. I then pass that id to the external api and return the booking, if possible. Now, if the bookingid does not…
membersound
  • 81,582
  • 193
  • 585
  • 1,120
0
votes
1 answer

API Status Page Response Codes

(This is sort of an abstract philosophical question. But I believe it has objective concrete answers.) I'm writing an API, my API has a "status" page (like, https://status.github.com/). If whatever logic I have in place to determine the status says…
lostphilosopher
  • 4,361
  • 4
  • 28
  • 39
0
votes
1 answer

API: Custom 404 not found error response structure

Considering this url: http://example.com/users/1/post/2/likes. How can I correctly define structure of my 404 response, showing which item is not found? user, post or likes?
hpaknia
  • 2,769
  • 4
  • 34
  • 63
0
votes
0 answers

RestTemplate - How to get all status code when exception occuring

sorry to asking this kind of question. I am attempting to handle exception when calling rest services. I have to throw back to web application if time out error or other rest client exceptions in my rest web service while connecting / throwing…
deadend
  • 1,286
  • 6
  • 31
  • 52
0
votes
1 answer

What error to handle first on a rest resource?

I'm developing a REST API and when developing the user resource I ended up having a doubt. I want the users in my application to view other user profiles without being authenticated. But, obviously, a user needs to be authenticated to edit or delete…
Elias Garcia
  • 6,772
  • 11
  • 34
  • 62
0
votes
0 answers

how to get http status value?

first of all i asked something before and i got another question please take a look this one first I send some values to another url and about that i made a question and got an answer, and finally i have another question if like i said that above…