3 ms·
One of the APIs I maintain is for user profiles. A user profile has all kinds of stuff, eg name, email, phone, timezone etc etc. Forcing callers to send a PUT
by bedobi 5y ago
One of the APIs I maintain is for user profiles. A user profile has all kinds of stuff, eg name, email, phone, timezone etc etc.
Forcing callers to send a PUT with the whole user profile object every time someone updates a single thing is pretty wasteful.
+ if a caller is a caller that listens to events like "user u wants to update their number to 555 555 555, please do that", they don't even have the whole user object, they'd have to make a GET first, then set the new number, then send that whole PUT. That in turn introduces race conditions where their PUT could overwrite some other change someone else made to eg the email address in the meantime.
So there's definitely a case for PATCH! It all depends on your use case. For many systems it might not be something that's an issue.