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

Collections / List endpoints should return JSON-LD #2

Open
nickevansuk opened this issue Jul 16, 2018 · 5 comments
Open

Collections / List endpoints should return JSON-LD #2

nickevansuk opened this issue Jul 16, 2018 · 5 comments

Comments

@nickevansuk
Copy link
Contributor

nickevansuk commented Jul 16, 2018

Use Case

Provide a pattern for listing resources while querying a resource collection.

Proposal

Use Hydra Collections, except instead of using the "member" property for the list of resources, use "item", as the term "member" has a specific meaning within the sport and physical activity sector, and item is consistent with the existing totalItems property.

Example

{
  "@context": "http://www.w3.org/ns/hydra/context.jsonld",
  "id": "http://api.example.com/an-issue/comments",
  "type": "Collection",
  "totalItems": 4980,
  "item": [
    ... a subset of the members of the Collection ...
  ],
  "view": {
    "id": "http://api.example.com/an-issue/comments?page=3",
    "type": "PartialCollectionView",
    "first": "/an-issue/comments?page=1",
    "previous": "/an-issue/comments?page=2",
    "next": "/an-issue/comments?page=4",
    "last": "/an-issue/comments?page=498"
  }
}

See also

@civsiv
Copy link

civsiv commented Jul 17, 2018

Why item and not items? Feels like a plural for an array makes more sense?

@lukehesluke
Copy link

@nickevansuk this looks good to me. And the id and type fields are consistent with e.g. the modelling spec

@lukehesluke
Copy link

@civsiv it being singular would be consistent with e.g. activity in an Event, which can be either a single activity or array. Or subEvent

@house92
Copy link

house92 commented Jul 17, 2018

But we use items for /v2/sessions, /v2/activities, etc. Shouldn't they all be consistent?

@nickevansuk
Copy link
Contributor Author

Great! Yes good spot: all schema.org props are singular (see https://www.w3.org/wiki/WebSchemas/Singularity for rationale), the previous prototype was incorrect in this regard.

@lukehesluke lukehesluke mentioned this issue Jul 19, 2018
@nickevansuk nickevansuk changed the title Collections Collections / List endpoints should return JSON-LD Jul 27, 2018
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