this post was submitted on 14 Sep 2025
793 points (99.4% liked)

Programmer Humor

26332 readers
1026 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] tempest@lemmy.ca 3 points 1 day ago (1 children)

The argument probably goes something like " if you adhere strictly to REST the error codes are all you need" and then metadata can be sent in response headers.

[–] Aatube@kbin.melroy.org 3 points 1 day ago (3 children)

how should a REST API respond to the client sending a URL the ends in a string instead of a numeric ID? like api.social/users/ceeforayteen instead of api.socail/users/11037

[–] locuester@lemmy.zip 8 points 1 day ago (1 children)

I would do a 400 (Bad Request). Then, with varying amounts of detail depending on the scale of the project and the framework capability, the response body would be something like: { “error”:true, “reason”: “validation”, “detail”: “user id should be numeric” }

[–] Aatube@kbin.melroy.org 2 points 1 day ago (1 children)

that's what i would do too—a JSON response. or is that not what "JSON API" means?

[–] locuester@lemmy.zip 3 points 20 hours ago* (last edited 19 hours ago) (2 children)

A RESTful service is (usually as of today) a JSON API. They aren’t mutually exclusive things.

There’s no black and white definition there.

However, when someone is creating a RESTful service, they’re stating that they’ll be paying mind to HTTP Verbs and status codes as a fundamental part of their design.

In the original image posted, that dev clearly wasn’t paying mind to the HTTP layer and as such a commenter called it just a “JSON API”, which is the catchall, ugly, Wild West, typical way of doing things (always return 200, errors are in the json).

Once again tho, it’s not black and white. Others can and will disagree and want to be pedantic. I’ve been a professional dev for 35 years, devs love to argue abt this shit.

[–] luciferofastora@feddit.org 1 points 6 hours ago

devs love to argue abt this shit

Devs and standards have a contentious relationship.

If I develop something, I obviously know what works best for me, so I don't want to be constrained by some dumb standard. If someone else doesn't follow them and it makes things harder for me, they're a clueless fuckwit that shouldn't be allowed near a computer ever again.

Yes, that's a double standard: I don't even have a standard when it comes to handling standards.

[–] 0x0@lemmy.zip 2 points 14 hours ago

devs love to argue abt this shit.

Tabs vs spaces comes to mind.

[–] tempest@lemmy.ca 3 points 1 day ago

Depends on the verb and the application. If the string is valid 200, if it isn't 400, 404.

It’s still just another type of ID so you can do lookups on it. Nothing would change. UUIDs are used all the time.