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
0 answers

How to replace ALL django "Status Code Exception" templates

Any Status Code exceptions like 404, 403, 405, 500, CSRF and more return their own "Django" specific templates, a few are HTML. handler403, handler404, and handler500 exist and can be easily overridden, but there are a lot of these "hidden" Django…
Ray C
  • 547
  • 2
  • 7
  • 24
0
votes
1 answer

Would a 404 be acceptable for a DELETE method being called on a non-existent URL?

I am pretty new to the RESTful world, and at the moment I'm debating whether when calling a delete method on a URL that doesn't exist, whether a 404 Resource Not Found should be returned. At the moment, the code returns a 200 OK code, but this…
Kye
  • 3
  • 1
  • 3
0
votes
1 answer

Django: HTTP status 400 response rolls back model save?

I have an API endpoint to trigger a payment request to a third party. The endpoint is called with some data in a POST request and goes something like the code below. Somehow when the payment request failed (payment.is_successful = False), no data…
Laurent S
  • 4,106
  • 3
  • 26
  • 50
0
votes
1 answer

StatusCode for GetResponse() is OK but url Redirect

When executing the following lines of code: string link =…
Yuval Levy
  • 2,397
  • 10
  • 44
  • 73
0
votes
3 answers

Correct HTTP status code for possible absent entity: 200 or 204 or 404

I've searched a lot about this and have found different answers, also, my case is a little different. The context: I have a document A with a possible sender S Server X (so not a browser) requests the sender from document A on Server Y, but the…
Thomas Stubbe
  • 1,945
  • 5
  • 26
  • 40
0
votes
1 answer

How to return 404 in case of action argument's type mismatch in web api?

I have a web api application and I have an http post action taking dto as following : public class Account { public string Name { get; set; } public string Email { get; set; } public int Age { get; set; } } But using Postman I can…
Simple Code
  • 2,354
  • 2
  • 27
  • 56
0
votes
1 answer

Namespaced "error pages" in Rails

I have the following routing rules that would catch the HTTP status for some 'errors' and redirect the user to the error page: %w[403 404 422 500 503].each do |code| match code, to: 'errors#show', code: code, via: :all end I also have the root…
RafaelTSCS
  • 1,234
  • 2
  • 15
  • 36
0
votes
1 answer

QNetworkAccessManager doesn't handle HTTP Status Code 308

I'm testing my code for compatibility with HTTP 3xx status codes (redirects). I'm interested in codes 301, 302, 303, 307 and 308. All of those work fine with my code, except 308. My client testcase is Qt/C++ based, and my testing server is…
Stefan Monov
  • 11,332
  • 10
  • 63
  • 120
0
votes
1 answer

NSMutableURLRequest get -1012 http status code instead of 401

I have to pass Authorization token in NSMutableURLRequest , My query is Whenever I have to pass Correct token than I am getting good response with https Status (200.. etc). but whenever I have to pass wrong Authorization token Than I am getting…
Arjun Patel
  • 1,394
  • 14
  • 23
0
votes
1 answer

REST API: When should we use different HTTP status code other than popular ones?

We have API that returns back customer details i.e. /api/customers/{customerid}/. We have following scenario: If passed customerid is non-integer OR <=0 OR greater than Maximum(customerid) in our database, we send back BadRequest i.e. HTTP status…
Sahil Sharma
  • 3,847
  • 6
  • 48
  • 98
0
votes
1 answer

REST HTTP Response status code to indicate client input is non-verified?

We have POST API that gives particular user's contact details in response. But as this is confidential data, to access this detail, anyone accessing it needs to put verified mobile number. The request looks like: POST /api/userdetails { "userid":…
Sahil Sharma
  • 3,847
  • 6
  • 48
  • 98
0
votes
0 answers

Google places API returning failed to open stream: HTTP request failed error

I am hoping for some direction on this error. I have a loop that connects with the google places API. Every few times I test it I get an HTTP request failed error. But when I take the API call from the error it works in a browser or in postman. Any…
0
votes
1 answer

What HTTP status codes can a WebAPI controller return?

I know that my methods can return: 200 OK - if all goes well; 401 Unauthorized - if unauthorized; 422 Unprocessable Entity - because I explicitly return it in some of the actions; 500 Internal Server Error - in case there's an unexpected exception…
user622505
  • 743
  • 6
  • 23
0
votes
1 answer

Why is HTTP status code 451 cacheable by default?

I understand that some HTTP status codes are cacheable by default. From RFC 7231: 6.1. Overview of Status Codes Responses with status codes that are defined as cacheable by default (e.g., 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, and 501…
ShivanKaul
  • 687
  • 1
  • 8
  • 21
0
votes
0 answers

HTTP status code for when a POST request is being denied

I'm building an API for a url shortening service of sorts, and check when a POST request is made (to shorten a url) that the url is not a shortened url from my domain. If this is the case, I don't want to shorten it and want to send back the…
Andre C
  • 457
  • 1
  • 9
  • 26