News for hackers. Stuff that matters.
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.