3 ms·
OPTIONS https://datatracker.ietf.org/doc/html/rfc2616 https://datatracker.ietf.org/doc/html/rfc2616 More links here: https://news.ycombinator.com/item?id=44510
by troupo 1y ago
OPTIONS https://datatracker.ietf.org/doc/html/rfc2616 https://datatracker.ietf.org/doc/html/rfc2616
More links here: https://news.ycombinator.com/item?id=44510745 https://news.ycombinator.com/item?id=44510745
- notpushkin 1y agoOr 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).
- 9dev 1y agoThat’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?
- notpushkin 1y agoI don’t see why not!
- ivan_gammel 1y agoIt’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)
- troupo 1y agoWith 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 https://neo4j.com/docs/rest-docs/current/#rest-api-get-node
- ivan_gammel 1y agoThat 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.
- troupo 1y agoI'm not saying it's perfect, but it's really good, and you could create a client for it in an evening.
- esafak 1y agothese levels? https://blog.restcase.com/4-maturity-levels-of-rest-api-design/ https://blog.restcase.com/4-maturity-levels-of-rest-api-desi...
- ivan_gammel 1y agoYes. Though more canonical link is here: https://martinfowler.com/articles/richardsonMaturityModel.html https://martinfowler.com/articles/richardsonMaturityModel.ht...
- shadowgovt 1y agoIt 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.
- brigandish 1y agoI 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.