My favourite part about REST is that you can still work with solutions that fuck it up. "What do you mean I can't do a GET to /api/<resource>?" Dev: "oh no you have to do a POST to /api/<resource>/GetData"
Standard or smallest common denominator. You decide.
I don't even know if the average developer there does at any time really consider options. It's there, it works, and most devs only need to worry about it when it breaks.
I did my MSc on SOAP. Back in my day REST lacked the necessary structure to support tools. But my pet peeve is that people name any RPC REST which is totally incorrect!
I've actually been reading a bunch about HTMX/hypermedia systems/HATEOAS lately, which is sort of a return to form of Web 1.0. I have a project that it would be pretty well-suited for and I'm interested to try it.
EDIT: Although I guess HATEOAS is part of the original "RESTful" definition, and there's no reason I couldn't use JSON provided I adhere to the central idea of the server responses providing hypermedia links that let the front-end be dumber. So it's actually more like a lot of modern architectures kind of "cheat" full RESTfulness a little bit, and this architecture is trying to go back to the OG Roy Fielding paper and be even more RESTful... I'll just use HTMX rather than JSON though lol
It is a beautifully rich standard but unnecessarily complex. In the wild, I have seen very few well written WSDL and XSD packages to APIs that actually conforms to them.
ReST is beautifully simple, leveraging HTTP methods and response codes, and URL patterns, to describe CRUD operations. The Open API spec is pretty good, and overall a decent substitute for WSDL. There are still plenty of badly designed ReST APIs in the world but it's easier to implement and maintain and most of them do a half decent job.
The one thing that SOAP has over ReST, at least in practice, is schema enforcement. I have rarely dealt with a ReSTful JSON API that had legit JSON schema files instead of just JSON examples in their spec.
I really liked the wsdl convention. In my completely anecdotal experience handing someone a wsdl to write to generates fewer questions than sending somebody a link to swagger.
I know XML is a sub-optional over the wire data transfer format and I think there's some issues with SOAP and ESBs but i have nostalgia.
“Noooo, you can’t use something everyone in the industry understands by default! You need to use this hyper-specific bullshit that provides a 1% increase in efficiency!”
sure, but id argue that 95% of integrations have a data transfer level that does not justify the added complexity of protobuf. if all im doing is setting up a diagnostics endpoint, an on off endpoint and a config upload endpoint, why would i use something kore complex than REST
If you don't need the performance, picking something other than JSON over REST is premature optimization. Almost nothing needs it. Why sink the time into setting up the additional build tooling when you're probably going to get way more bang for your buck fixing shoddy database queries or shrinking bundle sizes.
JSON over RPC is good enough for almost everything. Its a sane default, and its pragmatic to always use sane default technologies unless they're ruled out by requirements.
I feel gRPC is better for server to server communication. Having apps and webclients use it is a recipe for massive headaches disproportional to the performance benefits.
I have severe trauma from this. Is there an RFC for CSV? Of course there is! Is Microsoft Excel able to parse an RFC-compliant CSV file by default? Depending on your locale, the answer is either "no" or "only if it's ASCII".
Whoever invented the UTF-8 ""BOM"" (a nonsensical term, given that UTF-8 specifies only a single valid byte order, making its marking hypothetically unnecessary) should be punished for their crimes. And whoever thought file parsing should be locale-dependent deserves the same fate.
Just imagine someone giving you a wsdl on a Teams call and asking you to "just call the endpoint" while you're sharing your screen.
"Don't you have SoapUI installed? It's in the wiki! No, not Confluence. No, not ADO. The other one. To hell with it, just generate the client with wsdl.exe. What do you mean you don't know where that is? This isn't hard."
I worked as freelance programmer for some excentric guy as my first "real programming job" making a jobsite and later a piece of recruitment SaaS. I had to talk to governmental SOAP APIs for posting and retrieving jobs from EU databases, as well as getting candidate CV and resume data from their "jobnet" accounts - The WSDL was horrible, it was some kind of EU standard and on top of that a danish specification, so everything was super contrieved - I recall having to wrap every job posting in like three different "envelope" tags and all sorts of strange stuff. Didnt help that I had to use PHP.
I ask myself the same question. I don't like REST. My pet peeve is that GET calls should allow me to pass parameters in a payload, I hate the entire idea behind URL parameters. If you look closer you realise REST not an API at all, it's a database transaction interface. But an API can be a lot more than that obviously.
But here is the other problem: REST is like the M-16 of the internet. Everyone knows it, it gets the job done and any improvement is so minimal, it does not justify a refactor. So why change? This is backend development and infrastructure. We don't have time here for the antics of the gazillion frameworks that plague the front end world. Anything here needs to be stable and simple.
TBF, REST/JSON is actually a good fit for most things. Simple to interface with, works with everything, easy to comprehend.
Alternatives like the various RPC, and webservices are really complicated, and have a tendency to expose the inner complexities of the underlying systems.
An API is an interface. Just like a user interface (GUI, CLI), it should hide the underlying complexity where possible, and be easy to work with.
I don’t find it painful, maybe because of being used to it, anyways some usages are better with xml. Its slower at parsing and gives bigger payloads, but you can use XML schemas to validate your input and combine standards, it’s more structured and can contain raw document data easily. In banking, XML is still a strong format, many applications will not switch to JSON anytime soon.
Thats because you never had to use someones elses XML. I had to integrate with governmental SOAP services and I still have PTSD, Some of the governmental SOAP interfaces are absolutely rediculous, contribed clusterfucks of envelope wrappers and WTFs. Just mentioning SOAP gives me PTSD, gray hair and anxiety.
I remember the last time I saw someone memeing and hating on REST and JSON there was this guy in the comments making multiple comments of paragraphs about rpc and how that's the one and proper way to do it.
For efficiency, some of these formats are COU hungry on very fast NVME drives. Saturating them basically requires dumping structs to disk without doing any fancy schema stuff, and I did my testing in Rust. Avro needed 4 threads IIRC to get to only 2x the time of the dump structs to disk method.
I've gone my entire career never encountering SOAP. Was it widespread in the past? I only ever hear very old engineers discussing it. I've tried learning it because they make it seem like it is a viable option when designing something, but it has never made any sense to me and I don't see why it would ever be chosen when REST is so obvious.
Well what else? gRPC is for internal, and graphql is too complex for a simple request. Soap is obselete, websocket cant scale due to the need of persistant open connection. By process of elimination rest is the default
Everyone using one standard way to do the same things is somehow bad now. Would you rather learn a new technology every time you wanted to communicate with a new service?
I love QUERY! Had an issue with exposed PII in a GET lately in work that it would have perfect for, but it's not supported by our backend rest client.... so POST it is!
POST and GET are widely supported mostly because POST is required to keep data secret (not really, but I'm not getting into it) and GET is the age-old standard. The other verbs are typically not allowed because of some issues with server configurations in the early days where people were able to use the other verbs to upload, change, or delete files on the server. So now many companies have security policies that haven't been reviewed that restrict verb usage to GET and POST. There's probably no other reason for its lack of support.
Technically your server almost certainly supports it already (it’s just a different verb on the header line of an HTTP message), but parsing it might be easy or might be a PITA depending on what you’re using.
But you can send QUERY requests in JS today. You can really send anything you want as the verb and JS will happily send it.
Why don't you just use it? You can use UNICORN and the http server doesn't care. I started using QUERY a few years ago and it just works. Sometimes you have to configure the whatever backend to not throw on unknown verbs, but that's it.
So, Whats the HTTP method to send new info? that's right, POST And the method to obtain data? that's right, POST And the method to delete data? that's right, POST And the method to update data? that's right, POST
This is the second reason I don’t like graphql. The first one is that in practice it always resulted in much more code and complexity in the end than a simple straightforward rest api.
There's an internal API at work that is called "GetSomethingSomethingDoesntMatter" and it's a fucking post, get the hell outta here who made this garbage
So I know we’re all joking here, but I ran into the real reason for this just the other day and I hated how much it made sense.
Working with a spring boot stack, security best practices say to hide stack traces in production so that you don’t leak your implementation details for attackers. However, this means you can’t throw a non-200 status code with a meaningful message because spring redact it and all you get back is the response code.
So if you want to return 400 with hints or a 401 with an expired token reason instead of a bare 401, you’re almost forced to return a 200 with a body that says it’s unsuccessful.
I don't know what y'all are integrating with but I'm gonna pick the one that the developers on the other end of this API are familiar with as well.
We were forced to use SOAP once about ten years back and spent a large portion of implementation explaining to the product engineers on the far end how SOAP worked and how they had screwed it up when integrating it into their own product.
Especially as the only option, it was hilarious how poorly they did it. But you just know it's because it was started by one developer who only knew SOAP and finished by another who didn't know it at all... Standards are useful.
It does the job, everything supports it, relatively easy to implement. JSON strikes a good balance between human and machine readability. If there’s no specific requirements for other techniques, why not?
It's also easy to trick yourself into thinking your users will "only request what they need" because you also have to remember to build out/enable the middleware that actually makes your db queries not select * when they only request a single field.
I remember hearing about this thing called graph or ql or whatever... it was gonna be this whole thing and change the world. It didn't. REST/JSON 4 LIFE.
Oh fuck, I haven't seen AJAX in at least a decade, maybe two. I remember when that was the hottest shit and our IE6 apps constantly exploded. Fuck yeah conditional comments.
Had a PM ask me to make an API that uses “Markdown instead of code” so “agents can chat with it easier”. I used to be proud of working in tech and excited for new things. Used to be.
I entered here to dunk on this complete shit opinion from perhaps a non developer or complete green novice but I see the good work has already been done
I love JSON, because I don't have to make sure the parser matched 100%. If I only use 10 out of 100 properties, I only need to care the 10 properties remains the same, the rest can change.
Yeah, we should all go back to binary protocols over TCP. Who needs all the infrastructure for http and parsing text protocols that are easy to understand and inspect.
I come from lots of other bullshit protocols + SOAP, I’m thrilled to use REST + JSON given how simple it is. No libraries needed (usually), no goofy deserialization logic, it’s lightweight, it’s easy to read (when formatted), and it has decent security mechanisms. HTTP can be pretty gross, but I’ll take that over yet-another overly complex bullshit library.
It's not REST though. It's just rpc and for some godforsaken reason we started calling it REST
HTML for a human is REST, MCP is REST, but your average JSON API is not, and it wouldn't make sense if it was because REST requires that the client has agency
So, programming language go through a hype cycle from "no type" to "strictly typed" being the way. Takes around 10 years to go from one to the other then back.
JSON is the data equivalent of "no type", you can put everything in and something will happen. Every derivative of json is the same. If you have the concept of truthy or falsy values, you're there. Getting burned by shitty data people will start requiring more strictly typed formats. It starts with things like json-schema which are just a bad fix. But it will either come back to xml or to some new very strict format.
Then those will be misused, many new people will be frustrated about how strict it is and how it could be made simpler and 20 years from now a new json will be there.
Because frameworks and datastructures exist to fix a certain problem and while there might be multiple for one and the same problem and sometimes even a more optimal one, maintenence, complexity or in short KISS are still a big factor.
1.3k
u/Yctallua 21d ago
Oh no, a standard has established among the developers.
Time to bring about the new standard that everyone will surely use instead.
417
u/a3dprinterfan 21d ago
You like SOAP or something? 😐
274
u/DrCthulhuface7 21d ago edited 21d ago
“Noooo, you can’t use something everyone in the industry understands by default! You need to use this hyper-specific bullshit that provides a 1% increase in efficiency!”
69
u/ryaaan89 21d ago
What are we supposed to be choosing instead??
21
u/jediorange 19d ago
TBF, REST/JSON is actually a good fit for most things. Simple to interface with, works with everything, easy to comprehend.
Alternatives like the various RPC, and webservices are really complicated, and have a tendency to expose the inner complexities of the underlying systems.
An API is an interface. Just like a user interface (GUI, CLI), it should hide the underlying complexity where possible, and be easy to work with.
17
u/VergilPrime 21d ago
The only thing they taught me besides json was XML. The only thing they taught me besides REST is nothing.
15
u/Skyswimsky 21d ago
I remember the last time I saw someone memeing and hating on REST and JSON there was this guy in the comments making multiple comments of paragraphs about rpc and how that's the one and proper way to do it.
13
u/masp3270 19d ago
Rest/json is so much easier than soap/xml.
24
u/Eleina_Edelweiss 20d ago
Well what else? gRPC is for internal, and graphql is too complex for a simple request. Soap is obselete, websocket cant scale due to the need of persistant open connection. By process of elimination rest is the default
5
u/--Aim 20d ago
Me using GET / POST for every api
8
u/sakkara 21d ago
Everyone using one standard way to do the same things is somehow bad now. Would you rather learn a new technology every time you wanted to communicate with a new service?
330
u/snoopbirb 21d ago
it's all POSTs... even the GETs...
Once it was all GETs... even what should be POST... Crazy times dudes.
Lots of credit cards in some nginx log out there
123
u/BeMyBrutus 21d ago
Just open up some sockets like a real man and yolo your packets.
117
u/deus_ith 21d ago
So, Whats the HTTP method to send new info? that's right, POST
And the method to obtain data? that's right, POST
And the method to delete data? that's right, POST
And the method to update data? that's right, POST
31
u/Sheepreak 21d ago
I'd rather use Rest than Graphql right now... Believe me
83
u/IslayProgrammes 21d ago
I hate that every endpoint return it’s own version of a status code in the body
I hate it even more when it’s different from the response header.
Fuck do you mean 200, but wait I have to parse the body and to find out it’s actually a 403 and my credential have expired
Bullshit
50
u/Thisbymaster 21d ago
It all goes into the POST hole.
40
u/Stummi 21d ago
Most APIs are JSON, but I think if you are pedantic, the least of them are REST
12
u/LogicBalm 20d ago
I don't know what y'all are integrating with but I'm gonna pick the one that the developers on the other end of this API are familiar with as well.
We were forced to use SOAP once about ten years back and spent a large portion of implementation explaining to the product engineers on the far end how SOAP worked and how they had screwed it up when integrating it into their own product.
Especially as the only option, it was hilarious how poorly they did it. But you just know it's because it was started by one developer who only knew SOAP and finished by another who didn't know it at all... Standards are useful.
21
u/T-J_H 20d ago
It does the job, everything supports it, relatively easy to implement. JSON strikes a good balance between human and machine readability. If there’s no specific requirements for other techniques, why not?
12
u/Mission_Friend3608 21d ago
GraphQL is not without its issues, but it improves on a lot of shortcomings.
Clean separation between query and updates (mutations)
Types everywhere
N+1 issues moved to the server.
The main downside is that it's a lot harder to call a GraphQL endpoint, so for simple public APIs it's not great.
4
u/Natural-Ocelot-6009 21d ago
They call everything ‘REST’, most APIs don’t actually conform to REST
4
u/PulpDood 20d ago
No. I REST my case 🤪
4
u/AutoGibbon 18d ago
I remember hearing about this thing called graph or ql or whatever... it was gonna be this whole thing and change the world. It didn't. REST/JSON 4 LIFE.
1
u/drowningincats97 21d ago
OP just shilling GRPC in the replies. Just use the right tool for the job 🙄
3
u/srb4 21d ago
Clearly we should go back to CORBA for APIs.
3
u/Silly_Guidance_8871 21d ago
It beats the fuckery that is/was XML
3
u/CinCoutMagus 20d ago
AJAX stands for Asynchronous JavaScript and JSON
5
u/notexecutive 21d ago
they are NOT using WSDL lmao
2
u/VoidZero25 21d ago edited 21d ago
Are there even other options?
2
u/daffalaxia 21d ago
REST and JSON are fine. Using POST for everything tho? Nah.
2
u/FabioTheFox 21d ago
Is OP a graphql glazer or what's with the REST hate
2
u/Capital-Garbage 21d ago
Had a PM ask me to make an API that uses “Markdown instead of code” so “agents can chat with it easier”. I used to be proud of working in tech and excited for new things. Used to be.
2
u/telas100 20d ago
Want some soap to reduce the burn?
2
u/Lurdekan 20d ago
I entered here to dunk on this complete shit opinion from perhaps a non developer or complete green novice but I see the good work has already been done
2
u/JAXxXTheRipper 16d ago
You are right, let's go back to the classics, SOAP and XML
3
u/RTSUPH 21d ago
When your post json includes method: “get”
2
u/bugo 21d ago
Better than graphql
1
u/Dillenger69 21d ago
SOAP 4 life!!!
1
u/Extreme-Edge-9843 21d ago
I'll take rest over that shitshow soap anyway
1
u/AaronTheElite007 21d ago
If by that you mean every api has a complete lack of documentation, then you’re correct.
If your customers have to learn how to use your api through trial and error and analysis of what little error messages are thrown, you have a problem
1
u/FoleyX90 21d ago
As opposed to....?
Please don't say SOAP
1
u/BoBoBearDev 21d ago
I love JSON, because I don't have to make sure the parser matched 100%. If I only use 10 out of 100 properties, I only need to care the 10 properties remains the same, the rest can change.
1
u/StochasticTinkr 21d ago
Yeah, we should all go back to binary protocols over TCP. Who needs all the infrastructure for http and parsing text protocols that are easy to understand and inspect.
/s
1
u/Sulungskwa 21d ago
Of all the bad/annoying/overused things in webdev, hating JSON is the weirdest hill I've ever seen anyone die on.
1
u/JunkNorrisOfficial 21d ago
Standard practice is to follow standard practices
1
u/TurdOfChaos 21d ago
Oh no why would developers insist on a simple and understandable protocol.
Let’s all invent our own shit for each specific scenario so we can pretend we’re smart!
1
u/gandalfx 21d ago
Wait till you get to deal with protobuf, then you'll be sobbing for some good old json.
1
u/billabong049 21d ago
I come from lots of other bullshit protocols + SOAP, I’m thrilled to use REST + JSON given how simple it is. No libraries needed (usually), no goofy deserialization logic, it’s lightweight, it’s easy to read (when formatted), and it has decent security mechanisms. HTTP can be pretty gross, but I’ll take that over yet-another overly complex bullshit library.
1
u/rover_G 21d ago
Just POST the JSON to the /api endpoint bro
1
u/StatisticianNo5402 21d ago
Rpc with proto-validation
1
u/Canon40 20d ago
Everybody should use Rusty Object Notation (RON). Even for projects not written in Rust.
1
u/TheNakedGabeNewell 20d ago
Api for monke, use mcp
1
u/deadmazebot 20d ago
What you want some SOAP, some XML, hell let's just go CSV get rid of repeating the field name when have 20 objects, super optimised
1
u/henke37 20d ago
I don't get it.
1
u/LibrarianOk3701 20d ago
Me choosing Rust with Leptos instead of JS:
1
u/eW4GJMqscYtbBkw9 20d ago
As opposed to... ?
1
u/MaleficentMode4222 19d ago
It's this thinking that gave us internet explorer.
1
u/ConsiderationLow2941 19d ago
It's not REST though. It's just rpc and for some godforsaken reason we started calling it REST
HTML for a human is REST, MCP is REST, but your average JSON API is not, and it wouldn't make sense if it was because REST requires that the client has agency
1
u/jolharg 18d ago
would you rather.... graphql
1
u/Just_Information334 18d ago
So, programming language go through a hype cycle from "no type" to "strictly typed" being the way. Takes around 10 years to go from one to the other then back.
JSON is the data equivalent of "no type", you can put everything in and something will happen. Every derivative of json is the same. If you have the concept of truthy or falsy values, you're there.
Getting burned by shitty data people will start requiring more strictly typed formats. It starts with things like json-schema which are just a bad fix. But it will either come back to xml or to some new very strict format.
Then those will be misused, many new people will be frustrated about how strict it is and how it could be made simpler and 20 years from now a new json will be there.
Unless LLM make all those discussions obsolete.
1
u/thenofootcanman 17d ago
It just works
1
u/Hi-Im-Bambi 14d ago
Because frameworks and datastructures exist to fix a certain problem and while there might be multiple for one and the same problem and sometimes even a more optimal one, maintenence, complexity or in short KISS are still a big factor.
1
u/CutlassRed 21d ago
OP is absolutely right and most of you are clowns.
When moving lots of data json sucks.
"Oh but what do you suggest?"
Protocol buffers are a good place to start