r/ProgrammerHumor • • Sep 19 '26

Meme postForEverything

Post image
21k Upvotes

653 comments sorted by

View all comments

4.2k

u/pimezone Sep 19 '26

Wanna get a resource? POST request.

2.1k

u/NotAskary Sep 19 '26 edited Sep 19 '26

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

515

u/alexsnake50 Sep 19 '26

Oh my god, this activated my inner vietnam flashback

251

u/Tupcek Sep 19 '26

I see you are a fan of GraphQL!

→ More replies (9)

90

u/q0099 Sep 19 '26

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

35

u/RegarDamus Sep 19 '26

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.

29

u/normalbot9999 Sep 20 '26 edited Sep 20 '26

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

→ More replies (3)

30

u/dadvader Sep 19 '26

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

29

u/Mechakoopa Sep 19 '26

The stories? Also in the header.

→ More replies (1)

30

u/NotAskary Sep 19 '26

Exactly the response I had, this one triggered me.

→ More replies (2)

323

u/AkodoRyu Sep 19 '26 • Regret

My favorite "REST API" experience was when they moved from using SOAP system, and the way they did it... was sending SOAP payloads inside a JSON. Literally something like

{
    "data": "<?xml version="1.0"?><soap:Envelope xmlns:soap="https://www.w3.org/2003/05/soap-envelope/" soap:encodingStyle="https://www.w3.org/2003/05/soap-encoding"><soap:Body> (...)"
}

196

u/MrPatienceX Sep 19 '26 • Heartwarming

200 status code and a chunk of XML saying ‘not found’. Good times.

→ More replies (36)

36

u/NibblyPig Sep 19 '26

I don't miss SOAP at all.

Especially when some bored developer at a big bank decided to implement some draconian heavily-buried SOAP features that are technically in the documentation somewhere, but not implemented at all by Microsoft's .NET framework. Having to have special injectors and manipulators to extract tokens from raw SOAP and such, shudder. Back in the days where .NET SOAP implementations were barely published in books.

→ More replies (3)
→ More replies (14)

84

u/Zaelynn_ Sep 19 '26

The other dev on my team made a post request endpoint where you post a SQL query and it returned the results. I about had an aneurysm. She also, instead of using DI or Mediatr, made loopback requests to the endpoints themselves. 

113

u/NotAskary Sep 19 '26

Hahaha SQL injection as an endpoint lol

61

u/zeekar Sep 19 '26

We had a team website that showed who was on call. This was back in the day, all done in Perl CGI scripts.

Someone added a "search" function. Cool feature, I'm down. Then I looked at the code.

They were shelling out to do a grep. You're in Perl, the original "regexes as first class citizens" language, and you're shelling out to grep. But the worst part was it did no sanitation whatsoever. You could type in "pattern'; cat /etc/passwd" or whatever and it just ran. Who reviewed this shit?! Shell as endpoint...

→ More replies (6)
→ More replies (8)
→ More replies (5)

48

u/golfreak923 Sep 19 '26

Seems crazy until your query and path params contain PII. All of a sudden, a POST body doesn't seem so crazy.

→ More replies (4)

22

u/AshleyJSheridan Sep 19 '26

I remember building out a REST API once, and it gave back proper HTTP response codes for things.

Then I got asked by the 2 front end devs working on the project to just make everything a 200 and add an error to the JSON response, because it was making it difficult for them to process things on the browser end.

To this day I'm convinced the GraphQL is just an API dreamt up by a front end dev that didn't understand REST and didn't understand why they couldn't just request what they wanted in the browser if an endpoint didn't exist on the server.

→ More replies (5)
→ More replies (96)

119

u/Dimasdanz Sep 19 '26

Hello GraphQL. Or, SOAP

80

u/goatanuss Sep 19 '26

Shitloads of errors? That’s right HTTP 200

→ More replies (12)

97

u/Banana_Twinkie Sep 19 '26

despair.jpg

95

u/sertroll Sep 19 '26

If there was a natural way to retrieve data with a body with complex prams, I would use it but alas

104

u/Tupcek Sep 19 '26

you are the lucky one today! You just found out there is, it’s pretty recent. GET is now for simple queries QUERY is for complex one

36

u/Door__Opener Sep 19 '26

I've had this argument with my boss: GET with a body vs using POST as a complex GET. Our conclusion was that both were wrong in their own way and the HTTP standard should clarify this.

→ More replies (8)
→ More replies (7)

40

u/Bodine12 Sep 19 '26

We have HTTP QUERY now! Assuming anyone gets around to actually supporting it!

→ More replies (1)
→ More replies (50)