Re: About hydra:search and GET

HI Kevin

By ”directly in the API docs”, do you mean to have the template and mapping in the hydra:ApiDocumentation and not inline in the resource representation?

Actually, I’m not sure this is possible. Maybe you would join us next Monday to discuss on the sonf call?

Best,
Tom

> On 25 Oct 2017, at 08:39, Kévin Dunglas <dunglas@gmail.com> wrote:
> 
> 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[],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
> Phone: +33 6 60 91 20 20
> 
> 
> 
> -- 
> Kévin Dunglas
> 
> https://dunglas.fr
> Twitter: @dunglas
> Phone: +33 6 60 91 20 20

Received on Wednesday, 25 October 2017 14:30:54 UTC