Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP status code for "client software update required" - what to use?

Which HTTP status code I need to return to indicate "client software update required"? For example, the server changed the format of the data it used to serve, and older clients won't be able to work with this, so the client must upgrade to use the new data.

I don't want to use 404 or 410, because I want to indicate it's still a valid path. 415? Not sure.

like image 721
antonio Avatar asked Apr 22 '12 16:04

antonio


People also ask

What is 426 upgrade required?

The HTTP 426 Upgrade Required client error response code indicates that the server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. The server sends an Upgrade header with this response to indicate the required protocol(s).

What is the difference between HTTP status code 200 and 201?

A 200-level response means that everything is working exactly as it should. 200: “Everything is OK.” This is the code that is delivered when a web page or resource acts exactly the way it's expected to. 201: “Created.” The server has fulfilled the browser's request, and as a result, has created a new resource.

What is status code 200 in API?

The HTTP 200 OK success status response code indicates that the request has succeeded. A 200 response is cacheable by default. The meaning of a success depends on the HTTP request method: GET : The resource has been fetched and is transmitted in the message body.

What is HTTP status code update?

UPDATE. An update can be implemented with an HTTP PUT or PATCH method. The difference lies in the amount of data the client has to send to the backend. 200 OK - This is the most appropriate code for most use-cases.


2 Answers

The majority of commenters are concerned that you're breaking old clients while using the same URI, which is a reasonable concern. That's why many APIs are versioned in the URIs themselves.

That said, why not just 400? The request came from an old client, so it's a bad request.

like image 118
Dan Halperin Avatar answered Sep 20 '22 02:09

Dan Halperin


why not just include the minimum supported client version as meta data in the api response? Then the client can check and prompt the user to upgrade as needed. No need to use a particular status code, just check the meta data on any response.

like image 27
zack Avatar answered Sep 21 '22 02:09

zack