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

Question: What is the links object used for? #1019

Closed
gracedo opened this issue Apr 4, 2016 · 4 comments
Closed

Question: What is the links object used for? #1019

gracedo opened this issue Apr 4, 2016 · 4 comments

Comments

@gracedo
Copy link

gracedo commented Apr 4, 2016

It's not entirely clear from the specs how the links object should be used. What urls can it hold? Must it only contain links to the resource url that the request is being made for? That seems to be the pattern according to the examples given, but the specs don't actually explain what these links need to be. Also, is the links object required with every resource response?

@masterspambot
Copy link
Contributor

It's used to represent url linkage between objects, mainly used in communication system-to-system. For most simple cases you can use it to just keep url to current resource aka self.

And they are optional.

@gracedo
Copy link
Author

gracedo commented Apr 4, 2016

It was proposed in one of my projects to populate the links object with a url to a file download. Would it be appropriate by jsonapi convention to use the links object for such a url, or should they only be used to link to resources?

@vrybas
Copy link

vrybas commented Apr 5, 2016

@gracedo,

url to a file download

Sounds like an object attribute to me. links object is more related to
the spec itself.

Note: Additional members may be specified for links objects and link
objects in the future.
http://jsonapi.org/format/#document-links

You wouldn't want your included custom attributes to conflict with
the changes in spec.

@ethanresnick
Copy link
Member

links is optional everywhere but, for now, can only hold specific, spec-defined members. We'll likely open up links for holding urls with custom meanings in the future

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