Re: About hydra:search and GET

Hi guys,

I revive this post. We're in the process of implementing filters support in
our HydraAdmin component (https://github.com/api-platform/admin). It would
be very useful to be able to define available filters directly in the API
docs (just like Swagger does).

Do you know a way to achieve this.

Best regards,

2017-04-24 16:42 GMT+02:00 Kévin Dunglas <dunglas@gmail.com>:

> 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[],ad
>> dressLocality,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 <+33%206%2060%2091%2020%2020>
>



-- 
Kévin Dunglas

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

Received on Wednesday, 25 October 2017 06:39:50 UTC