Which HTTP status code means “Not Ready Yet, Try Again Later”? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago. This post was edited and submitted for review 6 days ago and failed to reopen the post: Original close … Read more

Python Request Post with param data

This is the raw request for an API call: POST http://192.168.3.45:8080/api/v2/event/log?sessionKey=b299d17b896417a7b18f46544d40adb734240cc2&format=json HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: application/json Content-Length: 86 Host: 192.168.3.45:8080 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5) {“eventType”:”AAS_PORTAL_START”,”data”:{“uid”:”hfe3hf45huf33545″,”aid”:”1″,”vid”:”1″}}””” This request returns a success (2xx) response. Now I am trying to post this request using requests: >>> import requests >>> headers = {‘content-type’ : ‘application/json’} >>> data … Read more

What is the difference between HTTP status code 200 (cache) vs status code 304?

I’m using the Google “Page Speed” plug-in for Firefox to access my web site. Some of the components on my page is indicated as HTTP status: 200 200 (cache) 304 By Google’s “Page Speed”. What I’m confused about is the difference between 200 (cache) and 304. I’ve refreshed the page multiple times (but have not … Read more

How to specify HTTP error code using Express.js?

I have tried: app.get(“https://stackoverflow.com/”, function(req, res, next) { var e = new Error(‘error message’); e.status = 400; next(e); }); and: app.get(“https://stackoverflow.com/”, function(req, res, next) { res.statusCode = 400; var e = new Error(‘error message’); next(e); }); but always an error code of 500 is announced. 12 Answers 12

Returning http status code from Web Api controller

I’m trying to return a status code of 304 not modified for a GET method in a web api controller. The only way I succeeded was something like this: public class TryController : ApiController { public User GetUser(int userId, DateTime lastModifiedAtClient) { var user = new DataEntities().Users.First(p => p.Id == userId); if (user.LastModified <= lastModifiedAtClient) … Read more

JAX-RS — How to return JSON and HTTP status code together?

I’m writing a REST web app (NetBeans 6.9, JAX-RS, TopLink Essentials) and trying to return JSON and HTTP status code. I have code ready and working that returns JSON when the HTTP GET method is called from the client. Essentially: @Path(“get/id”) @GET @Produces(“application/json”) public M_機械 getMachineToUpdate(@PathParam(“id”) String id) { // some code to return JSON … Read more

What’s an appropriate HTTP status code to return by a REST API service for a validation failure?

I’m currently returning 401 Unauthorized whenever I encounter a validation failure in my Django/Piston based REST API application. Having had a look at the HTTP Status Code Registry I’m not convinced that this is an appropriate code for a validation failure, what do y’all recommend? 400 Bad Request 401 Unauthorized 403 Forbidden 405 Method Not … Read more

400 vs 422 response to POST of data

I’m trying to figure out what the correct status code to return on different scenarios with a “REST-like” API that I’m working on. Let’s say I have an end point that allows POST’ing purchases in JSON format. It looks like this: { “account_number”: 45645511, “upc”: “00490000486”, “price”: 1.00, “tax”: 0.08 } What should I return … Read more