3 ms·
To toot my own horn, I did an April Fool’s status code RFC: 397 Tolerating, for when a client sends a flawed request, but you’re going to tolerate it because yo
by SilasX 5y ago
To toot my own horn, I did an April Fool’s status code RFC: 397 Tolerating, for when a client sends a flawed request, but you’re going to tolerate it because you know what they really meant:
https://pastebin.com/TPj9RwuZ https://pastebin.com/TPj9RwuZ
- xwdv 5y agoThis is a good idea for APIs that allow you to update an object by sending a partial JSON object with the keys you want to update, when technically you’re supposed to send the entire updated object representation unless JSON Patch is being used.
- munk-a 5y agoAlternatively there actually is a HTTP PATCH verb that you can use for this - I think that tolerating is more appropriate for common misspellinks - i.e. accepting a request like an HTTP POST {"days": 12, "horus": 13 "minutes": 27}
- jfrunyon 5y agoApril Fools RFCs are part of the "Independent Stream", which mean the top left would say "Independent Submission", not IETF. Also, Informational, not Standards Track. Just FYI :)
- eyelidlessness 5y agoIs this basically "I'm doing the robustness principle but also communicating that I'm judging you"?
- SilasX 5y agolol Pretty much! It cites the Robustness Principle.
- eyelidlessness 5y agoThat’s what I get for responding while eating dinner and not reading thoroughly lol
- hakfoo 5y agoI love the concept. At the firm I work at, one of my "10% time" projects was to build out a "warnings" field in the API response. There are often times that you want to say "this is not inherently wrong, but likely represents wrong assumptions upstream" or "you're asking for something that's obsolete and is now being silently ignored". For example, if someone passes a currency field with the wrong number of decimal places. You might actually want to say your product costs $1.62346, but it's more likely you're not sanitizing your data and relying on non-guaranteed rounding behaviour to make it right. The problem we have is that the most of the API fields are opt-in-- the people who could most use the warnings are unlikely to go in and activate them.
- eyelidlessness 5y agoTo be honest I think the robustness principle isn’t very well supported. We shouldn’t be this accommodating in what we accept. We’re very likely harming users by ignoring errors.
- eyelidlessness 5y agoThat said we should be much more accommodating in our user interfaces to help prevent this kind of crap data.