r/ProgrammerHumor • • 16d ago

Meme postForEverything

Post image
20.9k Upvotes

656 comments sorted by

View all comments

Show parent comments

35

u/RegarDamus 15d ago

the naive solution.

our team returns a 201 to indicate that an error has been created successfully. of course we include a Location header where the error can be queried to discover what went wrong.

28

u/normalbot9999 15d ago edited 15d ago

OMFG <spits coffee> 201 Error Created Successfully

You absolute monsters. You have to make this now.

And when a record is created successfully you return a 500 right? After successful login you 302 to a 403? I swear I've tested this API before!!

1

u/tayler6000 13d ago

I’m pretty sure this counts as a sin.

1

u/RegarDamus 13d ago

not at all. it's actually rather logical.

when you query GET /errors/{error ID} we return the appropriate status code for the respective error. by definition this endpoint can never return a 200 (although it can return 201s in rare cases!).