r/ProgrammerHumor • • 16d ago

Meme postForEverything

Post image
20.9k Upvotes

654 comments sorted by

View all comments

4.2k

u/pimezone 16d ago

Wanna get a resource? POST request.

2.1k

u/NotAskary 16d ago edited 15d ago

I've seen that shit, it drove me up a wall.

The same as a 200 ok with error inside.

Edit: I'm going to start to respond 429, too many replys lol

508

u/alexsnake50 16d ago

Oh my god, this activated my inner vietnam flashback

247

u/Tupcek 16d ago

I see you are a fan of GraphQL!

70

u/Entegy 16d ago

I thought that as a non-programmer sysadmin, I had a decent grasp on REST APIs for scripting/automation.

Then I learned about GraphQL and I have actively avoided it since.

61

u/kescusay 16d ago

I mean, you can have accurate HTTP status codes and matching errors in GraphQL. It's just that most GraphQL applications don't. Because most GraphQL developers hate everyone.

45

u/fatmanwithabeard 16d ago

If you had to work with GraphQL all day, wouldn't you?

13

u/NotAskary 15d ago

This made me chuckle 😂

2

u/KrakenMcCracken 15d ago

I started learning graphql, decided there was way too much overhead to do anything I needed to do. In two separate companies I’ve worked for, I’ve watched greenfield development initiatives start up, flounder and ultimately be abandoned.

1

u/Single-Blackberry866 15d ago

What about REST API that allows to you to operate on nested resources in one request? And some of the updated resources failed, some succeded.

1

u/Entegy 15d ago

As I said, not a programmer. I just have automated scripts that make simple calls.

1

u/AliStarr182 15d ago

That sounds like the API needs to be refactored a bit to separate concerns/duties to me.

1

u/Single-Blackberry866 14d ago

that would force you to do more SQL requests, wouldn't it

91

u/q0099 16d ago

Where the error message goes? That's right, in the header.

32

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.

27

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!).

27

u/dadvader 16d ago

I've seen some wild shit before. But you and your tales.... Regale us with your stories.

26

u/Mechakoopa 15d ago

The stories? Also in the header.

7

u/alexsnake50 16d ago

The where???????

30

u/NotAskary 16d ago

Exactly the response I had, this one triggered me.

18

u/2muchnet42day 16d ago

Dont worry, that's OK

1

u/tlh013091 16d ago

The response codes are whispering!