News for hackers. Stuff that matters.
Re:Most RESTful APIs Aren't RESTful by motorest on Wednesday July 09, 2025 @08:23AM (#44509167)
> I sympathize with the pedantry here and found Fielding's paper to be interesting, but this is a lost battle.

Why do people feel compelled to even consider it to be a battle?

As I see it, the REST concept is useful, but the HATEOAS detail ends up having no practical value and creates more problems than the ones it solves. This is in line with the Richardson maturity model[1], where the apex of REST includes all the HATEOAS bells and whistles.

Should REST without HATEOAS classify as REST? Why not? I mean, what is the strong argument to differentiate an architectural style that meets all but one requirement? And is there a point to this nitpicking if HATEOAS is practically irrelevant and the bulk of RESTful APIs do not implement it? What's the value in this nitpicking? Is there any value to cite thesis as if they where Monty Python skits?

[1] https://en.wikipedia.org/wiki/Richardson_Maturity_Model

Re:Most RESTful APIs Aren't RESTful by cle on Wednesday July 09, 2025 @10:29AM (#44510485)
For me the battle is with people who want to waste time bikeshedding over the definition of "REST" and whether the APIs are "RESTful", with no practical advantages, and then having to steer the conversation--and their motivation--towards more useful things without alienating them. It's tiresome.
Re:Most RESTful APIs Aren't RESTful by HumblyTossed on Wednesday July 09, 2025 @01:42PM (#44512843)
Then let developer-Darwin win and fire those people. Let the natural selection of the hiring process win against pedantic assholes. The days are too short to argue over issues that are not really issues.
Re:Most RESTful APIs Aren't RESTful by smaudet on Wednesday July 09, 2025 @01:45PM (#44512874)
It was buried towards the bottom of the article, but the reason, to me:

Clients can be almost automatic with a HATEOS implementation, because it is a self describing protocol.

Of course, Open API (and perhaps to some extent now AI) also mean that clients don't need to be written they are just generated.

However it is important perhaps to remember the context here: SOAP is and was terrible, but for enterprise that needed a complex and robust RPC system, it was beginning to gain traction. HATEOS is a much more general yet simple and comprehensive system in comparison.

Of course, you don't need any of this. So people built APIs they did need that were not restfull but had an acronym that their bosses thought sounded better than SOAP, and the rest is History.

Re:Most RESTful APIs Aren't RESTful by wstrange on Wednesday July 09, 2025 @02:17PM (#44513215)
> Clients can be almost automatic with a HATEOS implementation, because it is a self describing protocol.

That was the theory, but it was never true in practice.

The oft comparisons to the browser really missed the mark. The browser was driven by advanced AI wetware.

Given the advancements in LLMs, it's not even clear that RESTish interfaces would be easier for them to consume (say vs. gRPC, etc.)

Re:Most RESTful APIs Aren't RESTful by paulddraper on Wednesday July 09, 2025 @06:35PM (#44515393)
Can we just call them HTTP APIs?
Re:Most RESTful APIs Aren't RESTful by ivan_gammel on Wednesday July 09, 2025 @09:23AM (#44509749)
>the HATEOAS detail ends up having no practical value and creates more problems than the ones it solves.

Many server-rendered websites support REST by design: a web page with links and forms is the state transferred to client. Even in SPAs, HATEOAS APIs are great for shifting business logic and security to server, where it belongs. I have built plenty of them, it does require certain mindset, but it does make many things easier. What problems are you talking about?

Re:Most RESTful APIs Aren't RESTful by guru4consulting on Wednesday July 09, 2025 @12:34PM (#44512030)
complexity
Re:Most RESTful APIs Aren't RESTful by ivan_gammel on Wednesday July 09, 2025 @01:33PM (#44512754)
Backend only and verbosity would be more correct description.
Re:Most RESTful APIs Aren't RESTful by commandlinefan on Wednesday July 09, 2025 @10:08AM (#44510242)
We should probably stop calling the thing that we call REST, REST and be done with it - it's only tangentially related to what Fielding tried to define.
Re:Most RESTful APIs Aren't RESTful by motorest on Wednesday July 09, 2025 @11:59AM (#44511660)
> We should probably stop calling the thing that we call REST (...)

That solves no problem at all. We have Richardson maturity model that provides a crisp definition, and it's ignored. We have the concept of RESTful, which is also ignored. We have RESTless, to contrast with RESTful. Etc etc etc.

None of this discourages nitpickers. They are pedantic in one direction, and so lax in another direction.

Ultimately it's all about nitpicking.

Re:Most RESTful APIs Aren't RESTful by troupo on Wednesday July 09, 2025 @10:53AM (#44510745)
> but the HATEOAS detail ends up having no practical value and creates more problems than the ones it solves.

Only because we never had the tools and resources that, say, GraphQL has.

And now everyone keeps re-inventing half of HTTP anyway. See this diagram https://raw.githubusercontent.com/for-GET/http-decision-diag... (docs https://github.com/for-GET/http-decision-diagram/tree/master...) and this: https://github.com/for-GET/know-your-http-well

Re:Most RESTful APIs Aren't RESTful by motorest on Thursday July 10, 2025 @01:49AM (#44517691)
> Only because we never had the tools and resources that, say, GraphQL has.

GraphQL promised to solve real-world problems.

What real world problems does HATEOAS addresses? None.

Re:Most RESTful APIs Aren't RESTful by troupo on Thursday July 10, 2025 @04:00AM (#44518498)
GraphQL was "promising" something because it was a thing by a single company.

HATEOAS didn't need to "promise" anything since it was just describing already existing protocols and capabilities that you can see in the links I posted.

And that's how you got POST-only GraphQL which for years has been busily reinventing half of HTTP

Re:Most RESTful APIs Aren't RESTful by naasking on Wednesday July 09, 2025 @08:36AM (#44509299)
HATEOAS adds lots of practical value if you care about discoverability and longevity.
Re:Most RESTful APIs Aren't RESTful by montroser on Wednesday July 09, 2025 @10:06AM (#44510212)
Discoverability by whom, exactly? Like if it's for developer humans, then good docs are better. If it's for robots, then _maybe_ there's some value... But in reality, it's not for robots.

HATEOAS solves a problem that doesn't exist in practice. Can you imagine an API provider being like, "hey, we can go ahead and change our interface...should be fine as long as our users are using proper clients that automatically discover endpoints and programmatically adapt accordingly"? Or can you imagine an API consumer going, "well, this HTTP request delivers the data we need, but let's make sure not to hit it directly -- instead, let's recursively traverse a graph of requests each time to make sure this is still the way to do it!"

Re:Most RESTful APIs Aren't RESTful by ivan_gammel on Wednesday July 09, 2025 @10:20AM (#44510392)
You have got it wrong. Let's say I build some API with different user roles. Some users can delete an object, others can only read it. The UI knows about the semantics of the operations and logical names of it, so when UI gets the object from server it can simply check, if certain operations are available, instead of encoding the permission checking on the client side. This is the discoverability. It does not imply generated interfaces, UI may know something about the data in advance.
Re:Most RESTful APIs Aren't RESTful by svieira on Wednesday July 09, 2025 @10:55AM (#44510764)
This is actually what we do at [DAYJOB] and it's been working well for over 12 years. Like any other kind of interface indirection it adds the overhead of indirection for the benefit of being able to change the producer's side of the implementation without having to change all of the consumers at the same time.
Re:Most RESTful APIs Aren't RESTful by tacone on Wednesday July 09, 2025 @10:35AM (#44510555)
That's actually an interesting take, thank you.
Re:Most RESTful APIs Aren't RESTful by shadowgovt on Wednesday July 09, 2025 @10:39AM (#44510589)
How does the UI check if certain operations are available?
Re:Most RESTful APIs Aren't RESTful by troupo on Wednesday July 09, 2025 @10:56AM (#44510785)
Re:Most RESTful APIs Aren't RESTful by notpushkin on Wednesday July 09, 2025 @11:18AM (#44511108)
Or probably just an Allow header on a response to another query (e.g. when fetching an object, server could respond with an Allow: GET, PUT, DELETE if the user has read-write access and Allow: GET if it’s read-only).
Re:Most RESTful APIs Aren't RESTful by 9dev on Wednesday July 09, 2025 @03:57PM (#44514181)
That’s a neat idea actually, I think I’ll need to read up on the semantics of Allow again…. There is no reason you couldn’t just include it with arbitrary responses, no?
Re:Most RESTful APIs Aren't RESTful by notpushkin on Thursday July 10, 2025 @02:07AM (#44517795)
I don’t see why not!
Re:Most RESTful APIs Aren't RESTful by ivan_gammel on Wednesday July 09, 2025 @12:34PM (#44512028)
It’s something else. List of available actions may include other resources, so you cannot express it with pure HTTP, you need a data model for that (HAL is one of possible solutions, but there are others)
Re:Most RESTful APIs Aren't RESTful by troupo on Wednesday July 09, 2025 @04:32PM (#44514463)
With HATEOAS you're supposed to return the list of available actions with the representation of your state.

Neo4j's old REST API was really good about that. See e.g. get node: https://neo4j.com/docs/rest-docs/current/#rest-api-get-node

Re:Most RESTful APIs Aren't RESTful by ivan_gammel on Wednesday July 09, 2025 @05:13PM (#44514799)
That API doesn’t look like REST level 3 API. For example, there’s an endpoint to create a node. It is not referenced by root or anywhere else. GetNode endpoint does include some traversal links in response, but those links are part of domain model, not part of the protocol. HAL does offer a protocol by which you enhance your domain model with links with semantics and additional resources.
Re:Most RESTful APIs Aren't RESTful by esafak on Wednesday July 09, 2025 @07:25PM (#44515735)
Re:Most RESTful APIs Aren't RESTful by ivan_gammel on Thursday July 10, 2025 @04:53AM (#44518830)
Re:Most RESTful APIs Aren't RESTful by shadowgovt on Friday July 11, 2025 @01:46PM (#44535062)
It is interesting to me that GraphQL would be in "the swamp of POX," mostly because personal experience was that shifting from hand-built REST to GraphQL solved a lot of problems we had. Mostly around discovery and composition; the ability to sometimes ask for a little data and sometimes a lot at the same endpoint is huge, and the fact that all of that happens under the same syntax as opposed to smearing out such controls over headers, method, URI, and query params decreased cognitive load.

Perhaps the real issue was that XML is awful and a much thinner resource representation simplifies most of the problems for developers and users.

Re:Most RESTful APIs Aren't RESTful by troupo on Wednesday July 09, 2025 @06:04PM (#44515163)
I'm not saying it's perfect, but it's really good, and you could create a client for it in an evening.
Re:Most RESTful APIs Aren't RESTful by brigandish on Thursday July 10, 2025 @01:52AM (#44517713)
I always thought soooo many REST implementations and explainers were missing a trick by ignoring the OPTIONS verb, it seems completely natural to me, but people love to stuff things inside of JSON.
Re:Most RESTful APIs Aren't RESTful by ivan_gammel on Wednesday July 09, 2025 @12:32PM (#44512002)
It’s literally in server response:

   {
    … resource model
    _links: {
       “delete” : { “href” : “.” }
    }
In this example you receive list of permitted operations embedded in the resource model. href=. means you can perform this operation on resource self link.
Re:Most RESTful APIs Aren't RESTful by shadowgovt on Wednesday July 09, 2025 @01:05PM (#44512419)
Oh, interesting. So rather than the UI computing what operations should be allowed currently by, say, knowing the user's current role and having rules baked into it about the relationship between role and UI widgets, the UI can compute what motive should be in or simply off of explicit statements or capability from the server.

I can see some meat on these bones. The counterpoint is that the protocol is now chattier than it would be otherwise... But a full analysis of bandwidth to the client would have to factor that you have to ship over a whole framework to implement those rules and keep those rules synchronized between client and server implementation.

Re:Most RESTful APIs Aren't RESTful by ivan_gammel on Wednesday July 09, 2025 @01:30PM (#44512729)
I’d suggest that bandwidth optimization should happen when it becomes critical and control presence of hypermedia controls via feature flag or header. This way frontend becomes simpler, so FE dev speed and quality improves, but backend becomes more complex. The main problem here is that most backend frameworks are supporting RMM level 2 and hypermedia controls require different architecture to make server code less verbose. Unfortunately REST wasn’t understood well, so full support of it wasn’t in focus of open source community.
Re:Most RESTful APIs Aren't RESTful by hughw on Wednesday July 09, 2025 @05:28PM (#44514902)
The promise of REST and HATEOAS was best realized not by building RESTful apps like say "my airline reservation app" but by building a programming system, spiritually like HTTP + HTML, in which you'd able to declaratively specify applications, of which "my airline reservation app" could be one and "my sports gambling service" could be another. So some smart person would invent a new application protocol with rich semantics as you did above, and a new type of user agent installed on desktops understands how to present them to the user, and the app on the server just assembles the resources in this rich format, directing users to their choices through the states of hte program.

So that never got done (because it's complex) and people started building apps like "my airline reservation app" but then realized to to build that domain app you don't need all the abstraction of a full REST system.

Re:Most RESTful APIs Aren't RESTful by motorest on Thursday July 10, 2025 @01:50AM (#44517707)
> You have got it wrong. Let's say I build some API with different user roles. Some users can delete an object, others can only read it. The UI knows about the semantics of the operations and logical names of it, so when UI gets the object from server it can simply check, if certain operations are available, instead of encoding the permission checking on the client side.

Have you ever heard of HTTP's OPTIONS verb?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/...

Follow-up trick question: how come you never heard of it and still managed quite well to live without it?

Re:Most RESTful APIs Aren't RESTful by ivan_gammel on Thursday July 10, 2025 @05:16AM (#44518982)
Maybe you should reconsider the way you ask questions on this forum. Your tone is not appropriate and the question itself just demonstrates that you don't understand this topic.

Yes, I'm aware of this header and know the web standards well enough.

In hypermedia API you communicate to client the list of all operations in the context of the resource (note: not ON the resource), which includes not only basic CRUD but also operations on adjacent resources (e.g. on user account you may have an operation of sending a message to this user). Yes, in theory one could use OPTIONS with a non-standard response body to communicate such operations that cannot be expressed in plain HTTP verbs in Allow header.

However such solution is not practical, because it requires an extra round trip for every resource. There's a better alternative, which is to provide the list of operations with the resource using one of the common standards - HAL, JSON-LD, Siren etc. The example in my another comment in this thread is based on HAL. If you wonder what is that, look no further than at Spring - it does support HAL APIs out of the box from quite a long time. And of course there's an RFC draft and a Wikipedia article (https://en.wikipedia.org/wiki/Hypertext_Application_Language).

Re:Most RESTful APIs Aren't RESTful by marcosdumay on Wednesday July 09, 2025 @11:39AM (#44511413)
> If it's for robots, then _maybe_ there's some value...

Nah, machine readable docs beat HATEOAS in basically any application.

The person that created HATEOAS was really not designing an API protocol. It's a general use content delivery platform and not very useful for software development.

Re:Most RESTful APIs Aren't RESTful by naasking on Wednesday July 09, 2025 @10:18AM (#44510359)
The problems do exist, and they're everywhere. People just invented all sorts of hacks and workarounds for these issues instead of thinking more carefully about them. See my posts in this thread for some examples:

https://news.ycombinator.com/item?id=44509745

Re:Most RESTful APIs Aren't RESTful by cable on Wednesday July 09, 2025 @10:40AM (#44510602)
LLMs also appear to have an easier time consuming it (not surprisingly.)
Re:Most RESTful APIs Aren't RESTful by programmarchy on Wednesday July 09, 2025 @09:14AM (#44509665)
For most APIs that doesn’t deliver any value which can’t be gained from API docs, so it’s hard to justify. However, these days it could be very useful if you want an AI to be able to navigate your API. But MCP has the spotlight now.
Re:Most RESTful APIs Aren't RESTful by naasking on Wednesday July 09, 2025 @09:23AM (#44509754)
And that's fine, but then you're doing RPC instead of REST and we should all be clear and honest about that.
Re:Most RESTful APIs Aren't RESTful by Spivak on Wednesday July 09, 2025 @09:48AM (#44510020)
I think you throw away a useful description of an API by lumping them all under RPC. If you tell me your API is RPC instead of REST then I'll assume that:

* If the API is available over HTTP then the only verb used is POST.

* The API is exposed on a single URL and the `method` is encoded in the body of the request.

Re:Most RESTful APIs Aren't RESTful by osigurdson on Wednesday July 09, 2025 @10:16AM (#44510343)
It is true, if you say "RPC" I'm more likely to assume gRPC or something like that. If you say "REST", I'm 95% confident that it is a standard / familiar OpenAPI style json-over-http style API but will reserve a 5% probability that it is actually HATEOAS and have to deal with that. I'd say, if you are doing Roy Fielding certified REST / HATEOAS it is non-standard and you should call it out specifically by using the term "HATEOAS" to describe it.
Re:Most RESTful APIs Aren't RESTful by kelseyfrog on Wednesday July 09, 2025 @10:45AM (#44510670)
What would it take for you to update your assumptions?
Re:Most RESTful APIs Aren't RESTful by Spivak on Wednesday July 09, 2025 @12:00PM (#44511671)
People in the real world referring to "REST" APIs, the kind that use HTTP verbs and have routes like /resource/id as RPC APIs. As it stands in the world outside of this thread nobody does that.

At some level language is outside of your control as an individual even if you think it's literally wrong--you sometimes have to choose between being 'correct' and communicating clearly.

Re:Most RESTful APIs Aren't RESTful by cryptonector on Wednesday July 09, 2025 @12:31PM (#44511989)
Defining media types seems right to me, but what ends up happening is that you use swagger instead to define APIs and out the window goes HATEOAS, and part of the reason for this is just that defining media types is not something people do (though they should).

Basically: define a schema for your JSON, use an obvious CRUD mapping to HTTP verbs for all actions, use URI local-parts embedded in the JSON, use standard HTTP status codes, and embed more error detail in the JSON.

Re:Most RESTful APIs Aren't RESTful by motorest on Wednesday July 09, 2025 @03:16PM (#44513796)
> (...) and part of the reason for this is just that defining media types is not something people do (...)

People do not define media types because it's useless and serves no purpose. They define endpoints that return specific resource types, and clients send requests to those endpoints expecting those resource types. When a breaking change is introduced, backend developers simply provide a new version of the API where a new endpoint is added to serve the new resource.

In theory, media types would allow the same endpoint to support multiple resource types. Services would sent specific resource types to clients if they asked for them by passing the media type in the accept header. That is all fine and dandy, except this forces endpoints to support an ever more complex content negotiation scheme that no backend framework comes close to support, and this brings absolutely no improvement in the way clients are developed.

So why bother?

Re:Most RESTful APIs Aren't RESTful by reactordev on Wednesday July 09, 2025 @12:46PM (#44512186)
I’m with you. HATEOAS is great when you have two independent (or more) enterprise teams with PMs fighting for budget.

When it’s just yours and your two pizza team, contract-first-design is totally fine. Just make sure you can version your endpoints or feature-flag new API’s so it doesn’t break your older clients.

Re:Most RESTful APIs Aren't RESTful by rafark on Wednesday July 09, 2025 @04:54PM (#44514643)
> Why do people feel compelled to even consider it to be a battle?

Because words have specific meanings. There’s a specific expectation when using them. It’s like if someone said “I can’t install this app on my iPhone” but then they have an android phone. They are similar in that they’re both smartphones and overall behave and look similar, but they’re still different.

If you are told an api is restful there’s an expectation of how it will behave.

Re:Most RESTful APIs Aren't RESTful by barnabee on Thursday July 10, 2025 @06:33AM (#44519414)
> If you are told an api is restful there’s an expectation of how it will behave.

And today, for most people in most situations, that expectation doesn’t include anything to do with HATEOAS.

Re:Most RESTful APIs Aren't RESTful by incrudible on Thursday July 10, 2025 @08:49AM (#44520421)
Words derive their meaning from the context in which they are (not) used, which is not fixed and often changes over time.

Few people actually use the word RESTful anymore, they talk about REST APIs, and what they mean is almost certainly very far from what Roy had in mind decades ago.

People generally do not refer to all smartphones as iPhones, but if they did, that would literally change the meaning of the word. Examples: Zipper, cellophane, escalator… all specific brands that became ordinary words.

Re:Most RESTful APIs Aren't RESTful by drewcoo on Wednesday July 09, 2025 @11:28PM (#44516899)
> Why do people feel compelled to even consider it to be a battle?

Because September isn't just for users.

Re:Most RESTful APIs Aren't RESTful by masklinn on Thursday July 10, 2025 @01:22AM (#44517534)
> Should REST without HATEOAS classify as REST? Why not?

Because what got backnamed HATEOAS is the very core of what Fielding called REST: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypert...

Everything else is window dressing.