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.

1525 questions
161
votes
6 answers

System.Net.WebException HTTP status code

Is there an easy way to get the HTTP status code from a System.Net.WebException?
Gilsham
  • 2,136
  • 2
  • 12
  • 14
154
votes
2 answers

Difference between HTTP redirect codes

The differences between the various HTTP 3XX redirect codes are not clear to me. Yes, I've read the spec, but there seems to be some discrepancy between the standard and actual practice here. The 301 redirect code seems clear enough: This means the…
Channel72
  • 22,459
  • 30
  • 97
  • 168
149
votes
12 answers

How to get HTTP response code for a URL in Java?

Please tell me the steps or code to get the response code of a particlular URL.
Ajit
  • 1,499
  • 2
  • 9
  • 3
146
votes
7 answers

Create request with POST, which response codes 200 or 201 and content

Suppose I write a REST service whose intent is to add a new data item to a system. I plan to POST to http://myhost/serviceX/someResources Suppose that works, what response code should I use? And what content might I return. I'm looking at the…
djna
  • 52,574
  • 11
  • 70
  • 109
145
votes
3 answers

What is correct HTTP status code when redirecting to a login page?

When a user is not logged in and tries to access a page that requires login, what is the correct HTTP status code for a redirect to the login page? I am asking because none of the 3xx response codes set out by the W3C seem to fit the…
Vidar Vestnes
  • 41,116
  • 28
  • 81
  • 97
142
votes
21 answers

Why is AJAX returning HTTP status code 0?

For some reason, while using AJAX (with my dashcode developed application) the browser just stops uploading and returns status codes of 0. Why does this happen?
tarnfeld
  • 23,722
  • 39
  • 106
  • 145
130
votes
7 answers

What's the most appropriate HTTP status code for an "item not found" error page

I'm curious what's the most appropriate HTTP status code for an "item does not exist" page. If the page itself doesn't exist, I'll obviously use 404. However, one of my pages has a userid argument (it's an "edit user" page) and in case no user with…
ThiefMaster
  • 285,213
  • 77
  • 557
  • 610
126
votes
4 answers

HTTP status code for a partial successful request

I have an application that sends messages to users. In a post request a XML string is transferred that consists of all the users that should receive that particular message. If any of the users in the list do not exist I give the list of missing…
Norbert Hartl
  • 9,675
  • 5
  • 33
  • 45
123
votes
4 answers

In Python, how do I use urllib to see if a website is 404 or 200?

How to get the code of the headers through urllib?
TIMEX
  • 217,272
  • 324
  • 727
  • 1,038
121
votes
7 answers

What is the appropriate HTTP status code response for a general unsuccessful request (not an error)?

I'm creating a RESTful API that will process a number of user interactions, including placing orders using stored credit cards. In the case of a successful order, I'm returning a 200 OK, and in the case where the order request is malformed or…
Raelshark
  • 2,698
  • 3
  • 25
  • 36
110
votes
5 answers

How do I resolve a HTTP 414 "Request URI too long" error?

I have developed a PHP web app. I am giving an option to the user to update multiple issues on one go. In doing so, sometimes the user is encountering this error. Is there any way to increase the lenght of URL in apache?
JPro
  • 5,696
  • 12
  • 53
  • 79
102
votes
4 answers

What's the appropriate HTTP status code to return if a user tries logging in with an incorrect username / password, but correct format?

A similar question is posted here: What's an appropriate HTTP status code to return by a REST API service for a validation failure? The answer in the thread above states that "For instance if the URI is supposed to have an ISO-8601 date and you find…
96
votes
11 answers

HTTP status code 0 - Error Domain=NSURLErrorDomain?

I am working on an iOS project. In this application, I am downloading images from the server. Problem: While downloading images I am getting Request Timeout. According to documentation HTTP status code of request timeout is 408. But in my…
Irfan DANISH
  • 7,467
  • 10
  • 35
  • 63
94
votes
6 answers

Set Response Status Code

I have an API call for which I need to be able to run some checks and potentially return various status codes. I don't need custom views or anything, I just need to return the proper code. If the user hasn't passed proper credentials, I need to…
Rob Wilkerson
  • 37,910
  • 41
  • 130
  • 185
92
votes
4 answers

Is it wrong to return 202 "Accepted" in response to HTTP GET?

I have a set of resources whose representations are lazily created. The computation to construct these representations can take anywhere from a few milliseconds to a few hours, depending on server load, the specific resource, and the phase of the…
user359996
  • 5,307
  • 4
  • 29
  • 24