3 ms·
Pleasently surprised. I was taken aback when I read the "by John Holdun" line and suspected shameless self-promoting, but the site is really well written and st
by knallfrosch 2y ago
Pleasently surprised. I was taken aback when I read the "by John Holdun" line and suspected shameless self-promoting, but the site is really well written and structured.
One thing though: I rarely see PATCH and that's because clients might send "identical data" as POST multiple times. You have to know what they want to do in business logic anyway and clients need to understand your response.
Sure you can give them "409" or "303" back, but who expects those? Which one do you choose? You have to document it anyway? Or do you return 400 { error: "Already exists" }?
This isn't well defined in the HTML spec so implementing PATCH feels useless. It's easier to accept that you'll receive invalid data on POST and you'll have to return custom error codes.
- tlarkworthy 2y agoGET and (sparse upserting) PATCH is all you need for a multiplayer API. Arguably GET is spurious as you could do an empty PATCH to do a read but you generally want a cache infront of GET that exploits etags
- Joker_vD 2y agoWhat format do you provide for in your Accept-Patch header that accepts empty inputs?
- tlarkworthy 2y agoAn empty JSON object for a JSON merge patch, not an empty body