Once you get started developing with Kentico Cloud, you’ll quickly realize the power of the platform is its accessibility. By leveraging industry-standard services to retrieve information, companies can architect robust solutions capable of delivering content to any device. In this article, I’ll be introducing you to the various filters that are available within the Delivery API to help you understand how to get your content quickly.
Incorporating a cloud-based CMS into your projects means there will be a lot of calls to the system to get data. With Kentico Cloud, this means a whole mess of Delivery API calls to get the information. Luckily, the platform has several built-in capabilities to simplify data retrieval and help you get your content.
Because Kentico Cloud content is designed to be multi-channel, data of all types can be stored in the system. This means in Kentico Cloud, your website information lives right alongside your mobile app details. To help you keep all this data organized, Kentico Cloud has content types, taxonomies, locations, and other resources you can leverage to keep things sorted.
Because there are so many ways to categorize your content, you will need to know how to filter items when retrieving them for your applications. Say hello to the Delivery API Filters. These powerful functions can help you retrieve the exact information you need, in a variety of ways. Here’s a brief overview of each filter currently available in the API.
This filter is used to match a field or property to all the items in a collection of values.
- Filtering for articles that contain all the specified keywords
- Returning products that match a set of criteria or multiple values
This filter can be used to return content items that match any of the values in a collection. The AnyFilter is typically used for multi-valued elements such as taxonomy or multiple choice.
- Returning items that match any value in a specific collection
This filter can be used to return content items that contain a specific value in a collection. Similarly to AnyFilter, the ContainsFilter is typically used for multi-valued elements such as taxonomy or multiple choice.
- Trying to find blog articles with a specific tag (taxonomy term)
GreaterThanFilter / GreaterThanOrEqualFilter / LessThanFilter/LessThanOrEqualFilter
These filters are used to determine if a value is greater or less than the specified value. This can be very useful when working with dates and numeric elements.
- Filtering articles by dates
- Limiting results by setting an element value threshold
This filter is useful when you are determining if a field or element contains a value in the specified collection. The InFilter is typically used for single-valued elements such as price or type.
- Filtering results by a collection of values
- Pulling back multiple types of tags for articles
This filter is helpful when you want to limit results based on a pre-defined range. The filter will compare the specified value to see if it falls between the range limits.
- Retrieving content pages with a rating within a specific range
- Returning articles published between two dates
As this blog shows, there are a lot of different ways to filter data retrieved from Kentico Cloud. By learning how and when to use each type of filter, you can easily return the content you need, and reduce the amount of programming and calls.
You can learn loads more about the Kentico Cloud Delivery API here.
You can find out more about the Kentico .NET SDK here.