Re:Ask HN: What are the not-so obvious things to consider wh...
by ben_jones on Saturday November 18, 2017 @04:52PM
(#15730913)
Does the API return a 200 status code and empty response body for all calls to a given endpoint(even failed ones)? Hi Salesforce, great dreamforce event you threw last week!
[ Parent
| on HN ]
Re:Ask HN: What are the not-so obvious things to consider wh...
by bastijn on Saturday November 18, 2017 @05:01PM
(#15730941)
Last year worked with a variant of this. Status 200 always with in the message body the actual status code and message. Whyyy.
Re:Ask HN: What are the not-so obvious things to consider wh...
by pavel_lishin on Saturday November 18, 2017 @08:04PM
(#15731661)
Successful response? 200 and a JSON payload.
Error response? 200 and a human-readable string describing the error.
Re:Ask HN: What are the not-so obvious things to consider wh...
by bastijn on Sunday November 19, 2017 @05:42PM
(#15736362)
Yes, the idea is indeed a signal that the request was received and the message the actual response. Problem is, if you are going to send me the actual HTTP status code in the 200 response with no additional information, you might as well send directly. Works better with all the libraries as well. Now we had to write a layer of abstraction to pull the actual message and code an forward that into our applications and third party libs. Personally, I prefer APIs that adhere to the HTTP status codes as defined in the standard.
Re:Ask HN: What are the not-so obvious things to consider wh...
by abraae on Saturday November 18, 2017 @06:53PM
(#15731391)
From memory Facebook popularized this approach way back when.
Re:Ask HN: What are the not-so obvious things to consider wh...
by dehrmann on Saturday November 18, 2017 @07:27PM
(#15731520)
This can make sense when you're doing batch requests and allow partial failures. I wish there were a standardized way of making batch requests--maybe even HTTP-level support. (It isn't such a big deal with HTTP2)
Re:Ask HN: What are the not-so obvious things to consider wh...
by rhizome on Saturday November 18, 2017 @09:24PM
(#15731891)
This can make sense when you're doing batch requests and allow partial failures.
Wouldn't that be a 206?
Re:Ask HN: What are the not-so obvious things to consider wh...
by detaro on Sunday November 19, 2017 @08:18AM
(#15733779)
No, 206 is only used with Range requests, when you try to get only some of the bytes of a larger resource.
There is 207, I think created by WebDAV, where you give back an XML document detailing the status of sub-requests. I feel like that'd be confusing in many contexts as well, and a clearly defined custom response is probably easier to handle for the user.