Re: Hydra collections, pagination, search

Hi Ardie,

You can find some examples and ApiDocumentation in the hydrus repository on
Github also: https://github.com/HTTP-APIs/hydrus

Have fun!

2017-08-16 19:29 GMT+01:00 Ardie Saeidi <ardalan.saeidi@gmail.com>:

> Hello everyone!
>
> My name is Ardie and i'm interested in using Hydra for some new APIs i'm
> building but was looking for examples on how to properly implement
> collections. Specifically i'd like to see an example of how to implement
> operations, searches and templated links.
>
> Based on the examples within the spec, i believe a collection object
> should look something like this:
> {
>     "@context": "http://www.w3.org/ns/hydra/context.jsonld",
>     "@id": "http://api.example.com/an-issue/comments",
>     "@type": "Collection",
>     "totalItems": "4980",
>     "member": [
>         {
>             "@id": "/comments/1",
>             "value": "Some comment about this or that",
>             "operation": [
>                 {
>                     "@type": "Operation",
>                     "method": "DELETE"
>                 }
>             ]
>         }
>     ],
>     "view": {
>         "@id": "http://api.example.com/an-issue/comments?page=3&createdB
> y=123",
>         "@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"
>     },
>     "search": {
>         "@id": "hydra:search",
>         "@type": "hydra:TemplatedLink"
>         ...
>     }
> }
>
>
>    - Where do operations go to create a new comment?
>    - How about search filters that were used on the collection endpoint,
>    are they included in the ID?
>
>
> Also is the current iteration of the spec considered stable enough to use
> in production? If not i was considering "wrapping" hydra around my custom
> context until the official release. Any help would be greatly appreciated.
>
>
> Thanks,
>
> -Ardie
>



-- 
¤ acM ¤
Lorenzo
Moriondo
@lorenzogotuned
https://stackoverflow.com/cv/lorenzomoriondo
https://www.linkedin.com/in/lorenzomoriondo
https://github.com/Mec-iS
https://profiles.udacity.com/u/lorenzomoriondo

Received on Thursday, 17 August 2017 16:35:55 UTC