Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rel for actions #56

Open
dominicbarnes opened this issue Aug 16, 2015 · 4 comments
Open

Add rel for actions #56

dominicbarnes opened this issue Aug 16, 2015 · 4 comments

Comments

@dominicbarnes
Copy link
Contributor

While looking through the list of link relations, I discovered things like create-form and edit-form, which I thought would make sense in the context of an action.

Would adding rel make sense for actions? Since actions have an href, I think this technically makes it a link, but I'm still learning the vernacular of hypermedia.

@kevinswiber
Copy link
Owner

@dominicbarnes Sorry for the delay. I've used create-form and edit-form link relations in the past, but I've used them as that--links. The response returned from following the link includes an action for creating or editing. The benefit here is that if the action itself is lengthy, it doesn't have to be included in the entity's GET response for those who just want to view.

A relation on an action would change from "why do you want to follow this link?" to "why do you want to execute this request?" For that information, I tie it to documentation with the action name. That said, there's no reason an action name couldn't be a URI. It just doesn't have to be, per the spec.

@dominicbarnes
Copy link
Contributor Author

Ok, I can understand that reasoning. I guess my main question is why actions are treated differently than links in this regard?

Rather, why is the discoverability of actions different than that of links? By not having any sort of URL tied to the name of an action, the only way to discover more about that action is to read external documentation. This difference doesn't fully align with siren's goal of making an API discoverable. Thus, using a URL with the name field seems like a reasonable workaround in the short-term.

However, I would like to formally propose a long-term solution by using rel instead. This would make actions consistent with links, thereby simplifying siren itself and making discoverability a first-class feature of actions as well. For backwards-compatibility, the name can remain in use, but my ultimate aim in this proposal is to replace name with rel in the long run.

@shaunparsloe
Copy link

I'm in agreement with @dominicbarnes in this. The fact that a link has a rel attribute and an action has a name attribute is confusing - especially when both of them are used in the same way as a key to discover the href.

@pke
Copy link

pke commented Sep 25, 2020

Just implementing a new REST API loosely based on SIREN and rel it will be.
I think it will only have actions and no links, since links are just GET actions in the end, or aren't they?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants