November Happy Hour will be moved to Thursday December 5th.

Episerver Content Delivery API Query by Category?

Vote:
 

Hello,

Does anyone know if a way to query the content delivery api by a category id? For example if we have the following JSON

{
    faqCategory: {
        PropertyDataType$$string: "PropertyLongString",
        ___types: [
            "EPiServer.ContentApi.Core.LongStringPropertyModel",
            "EPiServer.ContentApi.Core.PropertyModel`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[EPiServer.Core.PropertyLongString, EPiServer, Version=11.9.1.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]]",
            "System.Object",
            "EPiServer.ContentApi.Core.IPropertyModel`1[[EPiServer.Core.PropertyLongString, EPiServer, Version=11.9.1.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]]",
            "EPiServer.ContentApi.Core.IPropertyModel"
        ],
        $type: "EPiServer.ContentApi.Core.LongStringPropertyModel, EPiServer.ContentApi.Core",
        Value$$string: "FAQCategory1"
    }
}

My normal query is

/api/episerver/v1.0/search/content?filter=ContentType%2Fany(t%3At eq 'FAQPage')

How would I query and get all the pages that have FAQCategory1 as the Value$$string for faqCategory field? I've tried

faqCategory en 'FAQCategory1'

faqCategory/Value en 'FAQCategory1'

No luck... Any ideas? There doesn't seem to be much for documentation on Episerver Content Delivery API query parameters.

#198860
Nov 07, 2018 16:07
Vote:
 

Hi,

The "category" is a separate property (which is not content type) that why the query filter=ContentType%2Fany(t%3At eq 'FAQPage') does not work. Given an "Alloy Plan" category has an id equals "3", you can use the standard OData syntax to query it just like any other properties:

/api/episerver/v2.0/search/content?filter=category/value/id eq 3

or

/api/episerver/v2.0/search/content?filter=category/value/name eq 'Alloy Plan'
#256741
Jun 17, 2021 2:50
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.