Re: About hydra:search and GET

Hi,

This is a common question of API Platform users. Not having the possibility
to guess filters before retrieving the collection data is painful, for
instance when creating administration interfaces like
https://github.com/api-platform/admin

Do someone have some feedback about this topic?

2017-04-08 13:44 GMT+02:00 GoutisD <gts.dmtr@gmail.com>:

> Hello,
>
> I was wondering why the hydra:search is not part of the main api
> documentation. I checked previous thoughts on this and seems pretty complex.
>
> A search is a GET method with arguments. Is it acceptable to use the below
> syntax?
>
> {
>           "@type": "hydra:SupportedProperty",
>           "hydra:property": {
>             "@id": "#Entrypoint/postalAddress",
>             "@type": "hydra:Link",
>             "domain": "#Entrypoint",
>             "rdfs:label": "The collection of PostalAddress resources",
>             "range": "hydra:PagedCollection",
>             "hydra:supportedOperation": [
>               {
>                 "@type": "hydra:Operation",
>                 "hydra:method": "GET",
>                 "hydra:title": "Retrieves the collection of PostalAddress
> resources.",
>                 "rdfs:label": "Retrieves the collection of PostalAddress
> resources.",
>                 "returns": "hydra:PagedCollection"
>               },
>               {
>                 "@type": "hydra:Operation",
>           *    "expects": {"@type": "hydra:IriTemplate" ...}
>                 "hydra:method": "GET",
>                 "hydra:title": "Retrieves the collection of PostalAddress
> resources.",
>                 "rdfs:label": "Retrieves the collection of PostalAddress
> resources.",
>                 "returns": "hydra:PagedCollection"
>               },
>               {
>                 "@type": "hydra:CreateResourceOperation",
>                 "expects": "http://schema.org/PostalAddress",
>                 "hydra:method": "POST",
>                 "hydra:title": "Creates a PostalAddress resource.",
>                 "rdfs:label": "Creates a PostalAddress resource.",
>                 "returns": "http://schema.org/PostalAddress"
>               }
>             ]
>           },
>
> *                "expects": {
>                   "@type": "hydra:IriTemplate",
>                   "hydra:template": "/postal_addresses{?id,id[],
> addressLocality,addressLocality[]}",
>                   "hydra:variableRepresentation": "BasicRepresentation",
>                   "hydra:mapping": [
>                     {
>                       "@type": "IriTemplateMapping",
>                       "variable": "id",
>                       "property": "id",
>                       "required": false
>                     },
>                     {
>                       "@type": "IriTemplateMapping",
>                       "variable": "id[]",
>                       "property": "id",
>                       "required": false
>                     },
>                     {
>                       "@type": "IriTemplateMapping",
>                       "variable": "addressLocality",
>                       "property": "addressLocality",
>                       "required": false
>                     },
>                     {
>                       "@type": "IriTemplateMapping",
>                       "variable": "addressLocality[]",
>                       "property": "addressLocality",
>                       "required": false
>                     }
>                   ]
>                 },
>
>
> Thanks,
> Dimitris
>



-- 
Kévin Dunglas

https://dunglas.fr
Twitter: @dunglas <https://twitter.com/dunglas>
Phone: +33 6 60 91 20 20

Received on Monday, 24 April 2017 14:43:28 UTC