Skip navigation

Filter content items (examples)

When building your apps, you'll use the Delivery API to get content items. The Delivery API provides several filters to help you refine your requests based on your requirements.

What do you know about the content you want to get? Find a relevant scenario below and adjust the code to get the content you need.

Table of contents

    Item ID, codename, or external ID

    To get an item based on its identifier (like ID, codename, or external ID), use the equals filter. For example, if you need to get an item by its internal ID, you match the item's ID (system.id) against the ID you have. 

    • Swift
    // Gets an item by its internal ID let customQuery = "items?system.id=2f7288a1-cfc8-47be-9bf1-b1d312f7da18" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Gets an item by its internal ID let customQuery = "items?system.id=2f7288a1-cfc8-47be-9bf1-b1d312f7da18" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Gets an item by its internal ID CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterEquals("system.id", "2f7288a1-cfc8-47be-9bf1-b1d312f7da18") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Gets an item by its internal ID CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterEquals("system.id", "2f7288a1-cfc8-47be-9bf1-b1d312f7da18") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Gets an item by its internal ID deliveryClient.items() .equalsFilter('system.id', '2f7288a1-cfc8-47be-9bf1-b1d312f7da18') .toObservable() .subscribe(response => console.log(response));
    // Gets an item by its internal ID deliveryClient.items() .equalsFilter('system.id', '2f7288a1-cfc8-47be-9bf1-b1d312f7da18') .toObservable() .subscribe(response => console.log(response));
    • C#
    // Gets an item by its internal ID IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new EqualsFilter("system.id", "2f7288a1-cfc8-47be-9bf1-b1d312f7da18") );
    // Gets an item by its internal ID IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new EqualsFilter("system.id", "2f7288a1-cfc8-47be-9bf1-b1d312f7da18") );
    • PHP
    // Gets an item by its internal ID $items = $client->getItems((new QueryParams()) ->equals('system.id', '2f7288a1-cfc8-47be-9bf1-b1d312f7da18'));
    // Gets an item by its internal ID $items = $client->getItems((new QueryParams()) ->equals('system.id', '2f7288a1-cfc8-47be-9bf1-b1d312f7da18'));
    • cURL
    # Gets an item by its internal ID curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.id=2f7288a1-cfc8-47be-9bf1-b1d312f7da18' \ --header 'content-type: application/json'
    # Gets an item by its internal ID curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.id=2f7288a1-cfc8-47be-9bf1-b1d312f7da18' \ --header 'content-type: application/json'
    • Ruby
    # Gets an item by its internal ID delivery_client.items('system.id'.equals('2f7288a1-cfc8-47be-9bf1-b1d312f7da18'))
    # Gets an item by its internal ID delivery_client.items('system.id'.equals('2f7288a1-cfc8-47be-9bf1-b1d312f7da18'))
    • TypeScript
    // Gets an item by its internal ID deliveryClient.items<ContentItem>() .equalsFilter('system.id', '2f7288a1-cfc8-47be-9bf1-b1d312f7da18') .toObservable() .subscribe(response => console.log(response));
    // Gets an item by its internal ID deliveryClient.items<ContentItem>() .equalsFilter('system.id', '2f7288a1-cfc8-47be-9bf1-b1d312f7da18') .toObservable() .subscribe(response => console.log(response));

    If you have multiple identifiers of a single type (for example, only IDs or codenames) and want to retrieve them in a single request, use the in filter.

    • Swift
    // Gets three items by their codenames. The codenames are unique per project. let customQuery = "items?system.codename[in]=delivery_api,get_content,hello_world" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Gets three items by their codenames. The codenames are unique per project. let customQuery = "items?system.codename[in]=delivery_api,get_content,hello_world" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Gets three items by their codenames. The codenames are unique per project. CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterIn("system.codename", "delivery_api", "get_content", "hello_world") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Gets three items by their codenames. The codenames are unique per project. CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterIn("system.codename", "delivery_api", "get_content", "hello_world") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Gets three items by their codenames. The codenames are unique per project. deliveryClient.items() .inFilter('system.codename', ['delivery_api', 'get_content', 'hello_world']) .toObservable() .subscribe(response => console.log(response));
    // Gets three items by their codenames. The codenames are unique per project. deliveryClient.items() .inFilter('system.codename', ['delivery_api', 'get_content', 'hello_world']) .toObservable() .subscribe(response => console.log(response));
    • C#
    // Gets three items by their codenames. The codenames are unique per project. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new InFilter("system.codename", "delivery_api", "get_content", "hello_world") );
    // Gets three items by their codenames. The codenames are unique per project. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new InFilter("system.codename", "delivery_api", "get_content", "hello_world") );
    • PHP
    // Gets three items by their codenames. The codenames are unique per project. $items = $client->getItems((new QueryParams()) ->in('system.codename', 'delivery_api', 'get_content', 'hello_world'));
    // Gets three items by their codenames. The codenames are unique per project. $items = $client->getItems((new QueryParams()) ->in('system.codename', 'delivery_api', 'get_content', 'hello_world'));
    • cURL
    # Gets three items by their codenames. The codenames are unique per project. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.codename[in]=delivery_api,get_content,hello_world' \ --header 'content-type: application/json'
    # Gets three items by their codenames. The codenames are unique per project. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.codename[in]=delivery_api,get_content,hello_world' \ --header 'content-type: application/json'
    • Ruby
    # Gets three items by their codenames. The codenames are unique per project. delivery_client.items('system.codename'.in('delivery_api', 'get_content', 'hello_world'))
    # Gets three items by their codenames. The codenames are unique per project. delivery_client.items('system.codename'.in('delivery_api', 'get_content', 'hello_world'))
    • TypeScript
    // Gets three items by their codenames. The codenames are unique per project. deliveryClient.items<ContentItem>() .inFilter('system.codename', ['delivery_api', 'get_content', 'hello_world']) .toObservable() .subscribe(response => console.log(response));
    // Gets three items by their codenames. The codenames are unique per project. deliveryClient.items<ContentItem>() .inFilter('system.codename', ['delivery_api', 'get_content', 'hello_world']) .toObservable() .subscribe(response => console.log(response));

    If you know the item's codename, retrieve the content item directly for better performance.

    Content types

    To get items based on a single content type, specify the content type's codename (system.type) using the equals filter.

    • Swift
    // Gets items based on the type Product let customQuery = "items?system.type=product" client.getItems(modelType: Product.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let products = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Gets items based on the type Product let customQuery = "items?system.type=product" client.getItems(modelType: Product.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let products = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Gets items of content type Product CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterEquals("system.type", "product") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Gets items of content type Product CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterEquals("system.type", "product") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Gets items based on the type Product deliveryClient.items<ContentItem>() .equalsFilter('system.type', 'product') // Same as using .type('product') .toObservable() .subscribe(response => console.log(response));
    // Gets items based on the type Product deliveryClient.items<ContentItem>() .equalsFilter('system.type', 'product') // Same as using .type('product') .toObservable() .subscribe(response => console.log(response));
    • C#
    // Gets items based on the type Product IDeliveryItemListingResponse<Product> response = await deliveryClient.GetItemsAsync<Product>( new EqualsFilter("system.type", "product") );
    // Gets items based on the type Product IDeliveryItemListingResponse<Product> response = await deliveryClient.GetItemsAsync<Product>( new EqualsFilter("system.type", "product") );
    • PHP
    // Gets items based on the type Product $items = $deliveryClient->getItems((new QueryParams()) ->equals('system.type', 'product'));
    // Gets items based on the type Product $items = $deliveryClient->getItems((new QueryParams()) ->equals('system.type', 'product'));
    • cURL
    # Gets items based on the type Product curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.type=product' \ --header 'content-type: application/json'
    # Gets items based on the type Product curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.type=product' \ --header 'content-type: application/json'
    • Ruby
    # Gets items of content type Product delivery_client.items('system.type'.eq('product'))
    # Gets items of content type Product delivery_client.items('system.type'.eq('product'))
    • TypeScript
    // Gets items based on the type Product deliveryClient.items<ContentItem>() .equalsFilter('system.type', 'product') // Same as using .type('product') .toObservable() .subscribe(response => console.log(response));
    // Gets items based on the type Product deliveryClient.items<ContentItem>() .equalsFilter('system.type', 'product') // Same as using .type('product') .toObservable() .subscribe(response => console.log(response));

    To get items based on multiple content types, specify the content types' codenames using the in  filter. 

    • Swift
    // Gets items of following content types let customQuery = "items?system.type[in]=product,article,news" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Gets items of following content types let customQuery = "items?system.type[in]=product,article,news" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Gets items based on the types Article, Product, and News CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterIn("system.type", "article", "product", "news") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Gets items based on the types Article, Product, and News CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterIn("system.type", "article", "product", "news") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Gets items based on the type Product, Article, and News deliveryClient.items() .inFilter('system.type', ['product', 'article', 'news']) .toObservable() .subscribe(response => console.log(response));
    // Gets items based on the type Product, Article, and News deliveryClient.items() .inFilter('system.type', ['product', 'article', 'news']) .toObservable() .subscribe(response => console.log(response));
    • C#
    // Gets items based on the types Product, Article, and News IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new InFilter("system.type", "product", "article", "news") );
    // Gets items based on the types Product, Article, and News IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new InFilter("system.type", "product", "article", "news") );
    • PHP
    // Gets items based on the types Product, Article, and News $items = $deliveryClient->getItems((new QueryParams()) ->in('system.type', 'product', 'article', 'news'));
    // Gets items based on the types Product, Article, and News $items = $deliveryClient->getItems((new QueryParams()) ->in('system.type', 'product', 'article', 'news'));
    • cURL
    # Gets items based on the types Product, Article, and News curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.type[in]=product,article,news' \ --header 'content-type: application/json'
    # Gets items based on the types Product, Article, and News curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.type[in]=product,article,news' \ --header 'content-type: application/json'
    • Ruby
    # Gets items based on the types Product, Article, and News delivery_client.items('system.type'.in('product', 'article', 'news'))
    # Gets items based on the types Product, Article, and News delivery_client.items('system.type'.in('product', 'article', 'news'))
    • TypeScript
    // Gets items based on the types Product, Article, and News deliveryClient.items<ContentItem>() .inFilter('system.type', ['product', 'article', 'news']) .toObservable() .subscribe(response => console.log(response));
    // Gets items based on the types Product, Article, and News deliveryClient.items<ContentItem>() .inFilter('system.type', ['product', 'article', 'news']) .toObservable() .subscribe(response => console.log(response));

    Date & time and numbers

    To get items by a datetime value, you can use one of the comparison filters. This lets you retrieve content modified or released before or after a certain date. The following code shows the filters used on the last content modification date and a date & time element.

    • Swift
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Filters items modified after April 9 2020, 9 am UTC+0 let customQuery = "items?system.last_modified[gt]=2020-05-09T09:00:00.000000Z" // Other examples: // Filters items released at or after April 9 2020, 7 am UTC+0 // let customQuery = "elements.release_date[gte]=2020-05-09T07:00:00Z" // Filters items modified before April 5 2020 UTC+0 // let customQuery = "system.last_modified[lt]=2020-05-05" // Filters items released at or before April 5 2020 10:30 am UTC+0 // let customQuery = "elements.release_date[lte]=2020-05-05T10:30:00Z" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Filters items modified after April 9 2020, 9 am UTC+0 let customQuery = "items?system.last_modified[gt]=2020-05-09T09:00:00.000000Z" // Other examples: // Filters items released at or after April 9 2020, 7 am UTC+0 // let customQuery = "elements.release_date[gte]=2020-05-09T07:00:00Z" // Filters items modified before April 5 2020 UTC+0 // let customQuery = "system.last_modified[lt]=2020-05-05" // Filters items released at or before April 5 2020 10:30 am UTC+0 // let customQuery = "elements.release_date[lte]=2020-05-05T10:30:00Z" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified after April 9 2020, 9 am UTC+0 CompletionStage<ContentItemsListingResponse> items1 = client.getItems( DeliveryParameterBuilder.params() .filterGreaterThan("system.last_modified", "2020-05-09T09:00:00.000000Z") .build() ); // Gets items released at or after April 9 2020, 7 am UTC+0 CompletionStage<ContentItemsListingResponse> items2 = client.getItems( DeliveryParameterBuilder.params() .filterGreaterThanEquals("system.release_date", "2020-05-09T07:00:00Z") .build() ); // Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. CompletionStage<ContentItemsListingResponse> items3 = client.getItems( DeliveryParameterBuilder.params() .filterLessThan("system.last_modified", "2020-05-05") .build() ); // Gets items released at or before April 5 2020 10:30 am UTC+0 CompletionStage<ContentItemsListingResponse> items4 = client.getItems( DeliveryParameterBuilder.params() .filterLessThanEquals("system.release_date", "2020-05-05T10:30:00Z") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified after April 9 2020, 9 am UTC+0 CompletionStage<ContentItemsListingResponse> items1 = client.getItems( DeliveryParameterBuilder.params() .filterGreaterThan("system.last_modified", "2020-05-09T09:00:00.000000Z") .build() ); // Gets items released at or after April 9 2020, 7 am UTC+0 CompletionStage<ContentItemsListingResponse> items2 = client.getItems( DeliveryParameterBuilder.params() .filterGreaterThanEquals("system.release_date", "2020-05-09T07:00:00Z") .build() ); // Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. CompletionStage<ContentItemsListingResponse> items3 = client.getItems( DeliveryParameterBuilder.params() .filterLessThan("system.last_modified", "2020-05-05") .build() ); // Gets items released at or before April 5 2020 10:30 am UTC+0 CompletionStage<ContentItemsListingResponse> items4 = client.getItems( DeliveryParameterBuilder.params() .filterLessThanEquals("system.release_date", "2020-05-05T10:30:00Z") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified after April 9 2020, 9 am UTC+0 deliveryClient.items() .greaterThanFilter('system.last_modified', '2020-05-09T09:00:00.000000Z') .toObservable() .subscribe(response => console.log(response)); // Gets items released at or after April 9 2020, 7 am UTC+0 deliveryClient.items() .greaterThanOrEqualFilter('elements.release_date', '2020-05-09T07:00:00Z') .toObservable() .subscribe(response => console.log(response)); // Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. deliveryClient.items() .lessThanFilter('system.last_modified', '2020-05-05') .toObservable() .subscribe(response => console.log(response)); // Gets items released at or before April 5 2020 10:30 am UTC+0 deliveryClient.items() .lessThanOrEqualFilter('elements.release_date', '2020-05-05T10:30:00Z') .toObservable() .subscribe(response => console.log(response));
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified after April 9 2020, 9 am UTC+0 deliveryClient.items() .greaterThanFilter('system.last_modified', '2020-05-09T09:00:00.000000Z') .toObservable() .subscribe(response => console.log(response)); // Gets items released at or after April 9 2020, 7 am UTC+0 deliveryClient.items() .greaterThanOrEqualFilter('elements.release_date', '2020-05-09T07:00:00Z') .toObservable() .subscribe(response => console.log(response)); // Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. deliveryClient.items() .lessThanFilter('system.last_modified', '2020-05-05') .toObservable() .subscribe(response => console.log(response)); // Gets items released at or before April 5 2020 10:30 am UTC+0 deliveryClient.items() .lessThanOrEqualFilter('elements.release_date', '2020-05-05T10:30:00Z') .toObservable() .subscribe(response => console.log(response));
    • C#
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified after April 9 2020, 9 am UTC+0 IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new GreaterThanFilter("system.last_modified", "2020-05-09T09:00:00.000000Z") ); // Gets items released at or after April 9 2020, 7 am UTC+0 IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new GreaterThanOrEqualFilter("elements.release_date", "2020-05-09T07:00:00Z") ); // Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new LessThanFilter("system.last_modified", "2020-05-05") ); // Gets items released at or before April 5 2020 10:30 am UTC+0 IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new LessThanOrEqualFilter("elements.release_date", "2020-05-05T10:30:00Z") );
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified after April 9 2020, 9 am UTC+0 IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new GreaterThanFilter("system.last_modified", "2020-05-09T09:00:00.000000Z") ); // Gets items released at or after April 9 2020, 7 am UTC+0 IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new GreaterThanOrEqualFilter("elements.release_date", "2020-05-09T07:00:00Z") ); // Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new LessThanFilter("system.last_modified", "2020-05-05") ); // Gets items released at or before April 5 2020 10:30 am UTC+0 IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new LessThanOrEqualFilter("elements.release_date", "2020-05-05T10:30:00Z") );
    • PHP
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified after April 9 2020, 9 am UTC+0 $items1 = $client->getItems((new QueryParams()) ->greaterThan('system.last_modified', '2020-05-09T09:00:00.000000Z')); // Gets items released at or after April 9 2020, 7 am UTC+0 $items2 = $client->getItems((new QueryParams()) ->greaterThanOrEqual('elements.release_date', '2020-05-09T07:00:00Z')); // Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. $items3 = $client->getItems((new QueryParams()) ->lessThan('system.last_modified', '2020-05-05')); // Gets items released at or before April 5 2020 10:30 am UTC+0 $items4 = $client->getItems((new QueryParams()) ->lessThanOrEqual('elements.release_date', '2020-05-05T10:30:00Z'));
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified after April 9 2020, 9 am UTC+0 $items1 = $client->getItems((new QueryParams()) ->greaterThan('system.last_modified', '2020-05-09T09:00:00.000000Z')); // Gets items released at or after April 9 2020, 7 am UTC+0 $items2 = $client->getItems((new QueryParams()) ->greaterThanOrEqual('elements.release_date', '2020-05-09T07:00:00Z')); // Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. $items3 = $client->getItems((new QueryParams()) ->lessThan('system.last_modified', '2020-05-05')); // Gets items released at or before April 5 2020 10:30 am UTC+0 $items4 = $client->getItems((new QueryParams()) ->lessThanOrEqual('elements.release_date', '2020-05-05T10:30:00Z'));
    • cURL
    # Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. # Gets items modified after April 9 2020, 9 am UTC+0 curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.last_modified[gt]=2020-05-09T09:00:00.000000Z' \ --header 'content-type: application/json' # Gets items released at or after April 9 2020, 7 am UTC+0 curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?"elements.release_date[gte]=2020-05-09T07:00:00Z"' \ --header 'content-type: application/json' # Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.last_modified[lt]=2020-05-05' \ --header 'content-type: application/json' # Gets items released at or before April 5 2020 10:30 am UTC+0 curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.release_date", "2020-05-05T10:30:00Z' \ --header 'content-type: application/json'
    # Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. # Gets items modified after April 9 2020, 9 am UTC+0 curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.last_modified[gt]=2020-05-09T09:00:00.000000Z' \ --header 'content-type: application/json' # Gets items released at or after April 9 2020, 7 am UTC+0 curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?"elements.release_date[gte]=2020-05-09T07:00:00Z"' \ --header 'content-type: application/json' # Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.last_modified[lt]=2020-05-05' \ --header 'content-type: application/json' # Gets items released at or before April 5 2020 10:30 am UTC+0 curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.release_date", "2020-05-05T10:30:00Z' \ --header 'content-type: application/json'
    • Ruby
    # Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. # Gets items modified after April 9 2020, 9 am UTC+0 delivery_client.items('system.last_modified'.greaterThan('2020-05-09T09:00:00.000000Z')) # Gets items released at or after April 9 2020, 7 am UTC+0 delivery_client.items('elements.release_date'.greaterThanOrEqual('2020-05-09T07:00:00Z')) # Gets items modified before April 5 2020 UTC+0; Last match would be at 2020-05-04T23:59:59 delivery_client.items('system.last_modified'.lessThan('2020-05-05')) # Gets items released at or before April 5 2020 10:30 am UTC+0 delivery_client.items('elements.release_date'.lessThanOrEqual('2020-05-05T10:30:00Z'))
    # Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. # Gets items modified after April 9 2020, 9 am UTC+0 delivery_client.items('system.last_modified'.greaterThan('2020-05-09T09:00:00.000000Z')) # Gets items released at or after April 9 2020, 7 am UTC+0 delivery_client.items('elements.release_date'.greaterThanOrEqual('2020-05-09T07:00:00Z')) # Gets items modified before April 5 2020 UTC+0; Last match would be at 2020-05-04T23:59:59 delivery_client.items('system.last_modified'.lessThan('2020-05-05')) # Gets items released at or before April 5 2020 10:30 am UTC+0 delivery_client.items('elements.release_date'.lessThanOrEqual('2020-05-05T10:30:00Z'))
    • TypeScript
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified after April 9 2020, 9 am UTC+0 deliveryClient.items<ContentItem>() .greaterThanFilter('system.last_modified', '2020-05-09T09:00:00.000000Z') .toObservable() .subscribe(response => console.log(response)); // Gets items released at or after April 9 2020, 7 am UTC+0 deliveryClient.items<ContentItem>() .greaterThanOrEqualFilter('elements.release_date', '2020-05-09T07:00:00Z') .toObservable() .subscribe(response => console.log(response)); // Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. deliveryClient.items<ContentItem>() .lessThanFilter('system.last_modified', '2020-05-05') .toObservable() .subscribe(response => console.log(response)); // Gets items released at or before April 5 2020 10:30 am UTC+0 deliveryClient.items<ContentItem>() .lessThanOrEqualFilter('elements.release_date', '2020-05-05T10:30:00Z') .toObservable() .subscribe(response => console.log(response));
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified after April 9 2020, 9 am UTC+0 deliveryClient.items<ContentItem>() .greaterThanFilter('system.last_modified', '2020-05-09T09:00:00.000000Z') .toObservable() .subscribe(response => console.log(response)); // Gets items released at or after April 9 2020, 7 am UTC+0 deliveryClient.items<ContentItem>() .greaterThanOrEqualFilter('elements.release_date', '2020-05-09T07:00:00Z') .toObservable() .subscribe(response => console.log(response)); // Gets items modified before April 5 2020 UTC+0. Last match would be at 2020-05-04T23:59:59. deliveryClient.items<ContentItem>() .lessThanFilter('system.last_modified', '2020-05-05') .toObservable() .subscribe(response => console.log(response)); // Gets items released at or before April 5 2020 10:30 am UTC+0 deliveryClient.items<ContentItem>() .lessThanOrEqualFilter('elements.release_date', '2020-05-05T10:30:00Z') .toObservable() .subscribe(response => console.log(response));

    Use the same approach for number elements.

    Range of dates and numbers

    To get items based on a date range, you need to specify two datetime values using the range filter.

    • Swift
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC let customQuery = "items?system.last_modified[range]=2020-05-05T10:30:00,2020-05-07T07:00:00" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC let customQuery = "items?system.last_modified[range]=2020-05-05T10:30:00,2020-05-07T07:00:00" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterRange("system.last_modified", "2020-05-05T10:30:00", "2020-05-07T07:00:00") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterRange("system.last_modified", "2020-05-05T10:30:00", "2020-05-07T07:00:00") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC deliveryClient.items() .rangeFilter('system.last_modified', '2020-05-05T10:30:00', '2020-05-07T07:00:00') .toObservable() .subscribe(response => console.log(response));
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC deliveryClient.items() .rangeFilter('system.last_modified', '2020-05-05T10:30:00', '2020-05-07T07:00:00') .toObservable() .subscribe(response => console.log(response));
    • C#
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new RangeFilter("system.last_modified", "2020-05-05T10:30:00", "2020-05-07T07:00:00") );
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new RangeFilter("system.last_modified", "2020-05-05T10:30:00", "2020-05-07T07:00:00") );
    • PHP
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC $items = $client->getItems((new QueryParams()) ->range('system.last_modified', '2020-05-05T10:30:00', '2020-05-07T07:00:00'));
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC $items = $client->getItems((new QueryParams()) ->range('system.last_modified', '2020-05-05T10:30:00', '2020-05-07T07:00:00'));
    • cURL
    # Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. # Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.last_modified[range]=2020-05-05T10:30:00,2020-05-07T07:00:00' \ --header 'content-type: application/json'
    # Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. # Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?system.last_modified[range]=2020-05-05T10:30:00,2020-05-07T07:00:00' \ --header 'content-type: application/json'
    • Ruby
    # Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. # Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC delivery_client.items('system.last_modified'.range('2020-05-05T10:30:00','2020-05-07T07:00:00'))
    # Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. # Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC delivery_client.items('system.last_modified'.range('2020-05-05T10:30:00','2020-05-07T07:00:00'))
    • TypeScript
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC deliveryClient.items<ContentItem>() .rangeFilter('system.last_modified', '2020-05-05T10:30:00', '2020-05-07T07:00:00') .toObservable() .subscribe(response => console.log(response));
    // Note: Date & time element values are provided by users and stored with minute precision. The system.last_modified value reflects Last content change to an item and is stored with ms precision. // Gets items modified between April 5, 2020 10:30 UTC and April 7, 2020, 7:00 UTC deliveryClient.items<ContentItem>() .rangeFilter('system.last_modified', '2020-05-05T10:30:00', '2020-05-07T07:00:00') .toObservable() .subscribe(response => console.log(response));

    To get items based on a number range, you need to specify two numbers. The numbers can be either integers like 3 or floats like 3.14.

    • Swift
    // Gets items whose rating is at least 7 and at most 9 let customQuery = "items?elements.product_rating[range]=7,9" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Gets items whose rating is at least 7 and at most 9 let customQuery = "items?elements.product_rating[range]=7,9" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Gets items whose rating is at least 6.5 and at most 9 CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterRange("elements.product_rating", "6.5", "9") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Gets items whose rating is at least 6.5 and at most 9 CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterRange("elements.product_rating", "6.5", "9") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Gets items whose rating is at least 6.5 and at most 9 deliveryClient.items() .rangeFilter('elements.product_rating', '6.5', '9') .toObservable() .subscribe(response => console.log(response));
    // Gets items whose rating is at least 6.5 and at most 9 deliveryClient.items() .rangeFilter('elements.product_rating', '6.5', '9') .toObservable() .subscribe(response => console.log(response));
    • C#
    // Gets items whose rating is at least 6.5 and at most 9 IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new RangeFilter("elements.product_rating", "6.5", "9") );
    // Gets items whose rating is at least 6.5 and at most 9 IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new RangeFilter("elements.product_rating", "6.5", "9") );
    • PHP
    // Gets items whose rating is at least 6.5 and at most 9 $items = $client->getItems((new QueryParams()) ->range('elements.product_rating', '6.5', '9')
    // Gets items whose rating is at least 6.5 and at most 9 $items = $client->getItems((new QueryParams()) ->range('elements.product_rating', '6.5', '9')
    • cURL
    # Gets items whose rating is at least 6.5 and at most 9 curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.product_rating[range]=6.5,9' \ --header 'content-type: application/json'
    # Gets items whose rating is at least 6.5 and at most 9 curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.product_rating[range]=6.5,9' \ --header 'content-type: application/json'
    • Ruby
    # Gets items whose rating is at least 6.5 and at most 9 delivery_client.items('elements.product_rating'.range('7', '9'))
    # Gets items whose rating is at least 6.5 and at most 9 delivery_client.items('elements.product_rating'.range('7', '9'))
    • TypeScript
    // Gets items whose rating is at least 6.5 and at most 9 deliveryClient.items<ContentItem>() .rangeFilter('elements.product_rating', '6.5', '9') .toObservable() .subscribe(response => console.log(response));
    // Gets items whose rating is at least 6.5 and at most 9 deliveryClient.items<ContentItem>() .rangeFilter('elements.product_rating', '6.5', '9') .toObservable() .subscribe(response => console.log(response));

    Text and rich text

    To get items based on the value of a text or rich text element, you need to specify the value using the equals filter. The same approach also applies to custom elements.

    • Swift
    // Filters items whose Title element value equals to "Hello World" let customQuery = "items?elements.title=Hello World" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Filters items whose Title element value equals to "Hello World" let customQuery = "items?elements.title=Hello World" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Gets items whose Title element value equals to "Hello World" CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterEquals("elements.title", "Hello World") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Gets items whose Title element value equals to "Hello World" CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterEquals("elements.title", "Hello World") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Gets items whose Title element value equals to "Hello World" deliveryClient.items() .equalsFilter('elements.title', 'Hello World') .toObservable() .subscribe(response => console.log(response));
    // Gets items whose Title element value equals to "Hello World" deliveryClient.items() .equalsFilter('elements.title', 'Hello World') .toObservable() .subscribe(response => console.log(response));
    • C#
    // Gets items whose Title element value equals to "Hello World" IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new EqualsFilter("elements.title", "Hello World") );
    // Gets items whose Title element value equals to "Hello World" IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new EqualsFilter("elements.title", "Hello World") );
    • PHP
    // Gets items whose Title element value equals to 'Hello World' $items = $client->getItems((new QueryParams()) ->equals('elements.title', 'Hello World'));
    // Gets items whose Title element value equals to 'Hello World' $items = $client->getItems((new QueryParams()) ->equals('elements.title', 'Hello World'));
    • cURL
    # Gets items whose Title element value equals to "Hello World" curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.title=Hello World' \ --header 'content-type: application/json'
    # Gets items whose Title element value equals to "Hello World" curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.title=Hello World' \ --header 'content-type: application/json'
    • Ruby
    # Gets items whose Title element value equals to "Hello World" delivery_client.items('elements.title'.eq('Hello World'))
    # Gets items whose Title element value equals to "Hello World" delivery_client.items('elements.title'.eq('Hello World'))
    • TypeScript
    // Gets items whose Title element value equals to 'Hello World' deliveryClient.items<ContentItem>() .equalsFilter('elements.title', 'Hello World') .toObservable() .subscribe(response => console.log(response));
    // Gets items whose Title element value equals to 'Hello World' deliveryClient.items<ContentItem>() .equalsFilter('elements.title', 'Hello World') .toObservable() .subscribe(response => console.log(response));

    Taxonomy and multiple choice

    To get items tagged with specific terms, you need to specify the terms using the contains, any, or all filters.

    • Swift
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag let customQuery = "items?elements.tags[contains]=kontent" // Gets items tagged with a list of specific tags // let customQuery = "items?elements.tags[all]=kontent,headless" // Gets items tagged with at least one of multiple tags // let customQuery = "items?elements.tags[any]=football,soccer" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag let customQuery = "items?elements.tags[contains]=kontent" // Gets items tagged with a list of specific tags // let customQuery = "items?elements.tags[all]=kontent,headless" // Gets items tagged with at least one of multiple tags // let customQuery = "items?elements.tags[any]=football,soccer" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterContains("elements.tags", "kentico") .build() ); // Gets items tagged with a list of specific tags CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterAll("elements.tags", "kontent", "headless") .build() ); // Gets items tagged with at least one of multiple tags CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterAny("elements.tags", "football", "soccer") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterContains("elements.tags", "kentico") .build() ); // Gets items tagged with a list of specific tags CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterAll("elements.tags", "kontent", "headless") .build() ); // Gets items tagged with at least one of multiple tags CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterAny("elements.tags", "football", "soccer") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag deliveryClient.items() .containsFilter('elements.tags', ['kontent']) .toObservable() .subscribe(response => console.log(response)); // Gets items tagged with a list of specific tags deliveryClient.items() .allFilter('elements.tags', ['kontent', 'headless']) .toObservable() .subscribe(response => console.log(response)); // Gets items tagged with at least one tag from the list deliveryClient.items() .anyFilter('elements.tags', ['football', 'soccer']) .toObservable() .subscribe(response => console.log(response));
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag deliveryClient.items() .containsFilter('elements.tags', ['kontent']) .toObservable() .subscribe(response => console.log(response)); // Gets items tagged with a list of specific tags deliveryClient.items() .allFilter('elements.tags', ['kontent', 'headless']) .toObservable() .subscribe(response => console.log(response)); // Gets items tagged with at least one tag from the list deliveryClient.items() .anyFilter('elements.tags', ['football', 'soccer']) .toObservable() .subscribe(response => console.log(response));
    • C#
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new ContainsFilter("elements.tags", "kontent") ); // Gets items tagged with a list of specific tags IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new AllFilter("elements.tags", "kontent", "headless") ); // Gets items tagged with at least one tag from the list IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new AnyFilter("elements.tags", "football", "soccer") );
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new ContainsFilter("elements.tags", "kontent") ); // Gets items tagged with a list of specific tags IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new AllFilter("elements.tags", "kontent", "headless") ); // Gets items tagged with at least one tag from the list IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new AnyFilter("elements.tags", "football", "soccer") );
    • PHP
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag $items = $client->getItems((new QueryParams()) ->contains('elements.tags', ['kontent']) // Gets items tagged with a list of specific tags $items = $client->getItems((new QueryParams()) ->all('elements.tags', ['kontent'], ['headless']) // Gets items tagged with at least one of multiple tags $items = $client->getItems((new QueryParams()) ->any('elements.tags', ['football'], ['soccer'])
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag $items = $client->getItems((new QueryParams()) ->contains('elements.tags', ['kontent']) // Gets items tagged with a list of specific tags $items = $client->getItems((new QueryParams()) ->all('elements.tags', ['kontent'], ['headless']) // Gets items tagged with at least one of multiple tags $items = $client->getItems((new QueryParams()) ->any('elements.tags', ['football'], ['soccer'])
    • cURL
    # Note: Filters work with codenames of the tags. # Gets items tagged with one specific tag curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.tags[contains]=kontent' \ --header 'content-type: application/json' # Gets items tagged with a list of specific tags curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.tags[all]=kontent,headless' \ --header 'content-type: application/json' # Gets items tagged with at least one of multiple tags curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.tags[any]=football,soccer' \ --header 'content-type: application/json'
    # Note: Filters work with codenames of the tags. # Gets items tagged with one specific tag curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.tags[contains]=kontent' \ --header 'content-type: application/json' # Gets items tagged with a list of specific tags curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.tags[all]=kontent,headless' \ --header 'content-type: application/json' # Gets items tagged with at least one of multiple tags curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.tags[any]=football,soccer' \ --header 'content-type: application/json'
    • Ruby
    # Note: Filters work with codenames of the tags. # Gets itmes tagged with one specific tag delivery_client.items('elements.tags'.contains('kontent')) # Gets items tagged with a list of specific tags delivery_client.items('elements.tags'.any('football', 'soccer')) # Gets items tagged with at least one of multiple tags delivery_client.items('elements.tags'.contains('mvc', 'kontent', 'headless'))
    # Note: Filters work with codenames of the tags. # Gets itmes tagged with one specific tag delivery_client.items('elements.tags'.contains('kontent')) # Gets items tagged with a list of specific tags delivery_client.items('elements.tags'.any('football', 'soccer')) # Gets items tagged with at least one of multiple tags delivery_client.items('elements.tags'.contains('mvc', 'kontent', 'headless'))
    • TypeScript
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag deliveryClient.items<ContentItem>() .containsFilter('elements.tags', ['kontent']) .toObservable() .subscribe(response => console.log(response)); // Gets items tagged with a list of specific tags deliveryClient.items<ContentItem>() .allFilter('elements.tags', ['kontent', 'headless']) .toObservable() .subscribe(response => console.log(response)); // Gets items tagged with at least one tag from the list deliveryClient.items<ContentItem>() .anyFilter('elements.tags', ['football', 'soccer']) .toObservable() .subscribe(response => console.log(response));
    // Note: Filters work with codenames of the tags. // Gets items tagged with one specific tag deliveryClient.items<ContentItem>() .containsFilter('elements.tags', ['kontent']) .toObservable() .subscribe(response => console.log(response)); // Gets items tagged with a list of specific tags deliveryClient.items<ContentItem>() .allFilter('elements.tags', ['kontent', 'headless']) .toObservable() .subscribe(response => console.log(response)); // Gets items tagged with at least one tag from the list deliveryClient.items<ContentItem>() .anyFilter('elements.tags', ['football', 'soccer']) .toObservable() .subscribe(response => console.log(response));

    Also works for multiple choice and custom elements

    Use the same approach to get items based on a specific value or values of multiple choice element.

    For custom elements, the contains, any, and all filters work only if the element's value is a stringified array of strings. For example, "[\"DE\",\"US\",\"UK\"]".

    URL slug

    The URL slug element element value is stored in the same way as text or rich text. This means the approach to get items by a specific URL slug is the same, using the equals filter.

    • Swift
    // Gets items whose URL slug equals to sample-url-slug let customQuery = "items?elements.url_slug=sample-url-slug" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Gets items whose URL slug equals to sample-url-slug let customQuery = "items?elements.url_slug=sample-url-slug" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Gets items whose URL slug equals to sample-url-slug CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterEquals("elements.url_slug", "sample-url-slug") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Gets items whose URL slug equals to sample-url-slug CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterEquals("elements.url_slug", "sample-url-slug") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Gets items whose URL slug equals to sample-url-slug deliveryClient.items() .equalsFilter('elements.url_slug', 'sample-url-slug') .toObservable() .subscribe(response => console.log(response));
    // Gets items whose URL slug equals to sample-url-slug deliveryClient.items() .equalsFilter('elements.url_slug', 'sample-url-slug') .toObservable() .subscribe(response => console.log(response));
    • C#
    // Gets items whose URL slug equals to sample-url-slug IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new EqualsFilter("elements.url_slug", "sample-url-slug") );
    // Gets items whose URL slug equals to sample-url-slug IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new EqualsFilter("elements.url_slug", "sample-url-slug") );
    • PHP
    // Gets items whose URL slug equals to sample-url-slug $items = $client->getItems((new QueryParams()) ->equals('elements.url_slug', 'sample-url-slug')
    // Gets items whose URL slug equals to sample-url-slug $items = $client->getItems((new QueryParams()) ->equals('elements.url_slug', 'sample-url-slug')
    • cURL
    # Gets items whose URL slug equals to sample-url-slug curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.url_slug=sample-url-slug' \ --header 'content-type: application/json'
    # Gets items whose URL slug equals to sample-url-slug curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.url_slug=sample-url-slug' \ --header 'content-type: application/json'
    • Ruby
    # Gets items whose URL slug equals to sample-url-slug delivery_client.items('elements.url_slug'.eq('sample-url-slug'))
    # Gets items whose URL slug equals to sample-url-slug delivery_client.items('elements.url_slug'.eq('sample-url-slug'))
    • TypeScript
    // Gets items whose URL slug equals to sample-url-slug deliveryClient.items<ContentItem>() .equalsFilter('elements.url_slug', 'sample-url-slug') .toObservable() .subscribe(response => console.log(response));
    // Gets items whose URL slug equals to sample-url-slug deliveryClient.items<ContentItem>() .equalsFilter('elements.url_slug', 'sample-url-slug') .toObservable() .subscribe(response => console.log(response));

    To ensure you get content in a specific language, use the language parameter in your requests.

    Author of an article and other relationships

    When you link multiple items together you might want to retrieve your items based on their relationships.

    For example, you can have several articles written by a single author, Jane. Each article has a linked items element named Author. This element contains a reference to a content item that represents the author Jane. The reference in the Author element is stored as a codename of the Jane content item.

    • Swift
    // Gets items attributed to Jane. let customQuery = "items?elements.author[contains]=jane_doe" // Gets items attributed to at least Jane, John, or both. // let customQuery = "items?elements.author[any]=jane_doe,john_wick" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Gets items attributed to Jane. let customQuery = "items?elements.author[contains]=jane_doe" // Gets items attributed to at least Jane, John, or both. // let customQuery = "items?elements.author[any]=jane_doe,john_wick" client.getItems(modelType: Article.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let articles = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Gets items attributed to Jane. CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterContains("elements.author", "jane_doe") .build() ); // Gets items attributed to at least Jane, John, or both. CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterAny("elements.author", "jane_doe", "john_wick") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Gets items attributed to Jane. CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterContains("elements.author", "jane_doe") .build() ); // Gets items attributed to at least Jane, John, or both. CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterAny("elements.author", "jane_doe", "john_wick") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Gets items attributed to Jane. deliveryClient.items() .containsFilter('elements.author', ['jane_doe']) .toObservable() .subscribe(response => console.log(response)); // Gets items attributed to at least Jane, John, or both. deliveryClient.items() .anyFilter('elements.author', ['jane_doe', 'john_wick']) .toObservable() .subscribe(response => console.log(response));
    // Gets items attributed to Jane. deliveryClient.items() .containsFilter('elements.author', ['jane_doe']) .toObservable() .subscribe(response => console.log(response)); // Gets items attributed to at least Jane, John, or both. deliveryClient.items() .anyFilter('elements.author', ['jane_doe', 'john_wick']) .toObservable() .subscribe(response => console.log(response));
    • C#
    // Gets items attributed to Jane. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new ContainsFilter("elements.author", "jane_doe") ); // Gets items attributed to at least Jane, John, or both. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new AnyFilter("elements.author", "jane_doe", "john_wick") );
    // Gets items attributed to Jane. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new ContainsFilter("elements.author", "jane_doe") ); // Gets items attributed to at least Jane, John, or both. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new AnyFilter("elements.author", "jane_doe", "john_wick") );
    • PHP
    // Gets items attributed to Jane. $items = $client->getItems((new QueryParams()) ->contains('elements.author', ['jane_doe'])); // Gets items attributed to at least Jane, John, or both. $items = $client->getItems((new QueryParams()) ->any('elements.author', ['jane_doe'], ['john_wick']));
    // Gets items attributed to Jane. $items = $client->getItems((new QueryParams()) ->contains('elements.author', ['jane_doe'])); // Gets items attributed to at least Jane, John, or both. $items = $client->getItems((new QueryParams()) ->any('elements.author', ['jane_doe'], ['john_wick']));
    • cURL
    # Gets items attributed to Jane. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.author[contains]=jane_doe' \ --header 'content-type: application/json' # Gets items attributed to at least Jane, John, or both. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.author[any]=jane_doe,john_wick' \ --header 'content-type: application/json'
    # Gets items attributed to Jane. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.author[contains]=jane_doe' \ --header 'content-type: application/json' # Gets items attributed to at least Jane, John, or both. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.author[any]=jane_doe,john_wick' \ --header 'content-type: application/json'
    • Ruby
    # Gets items attributed to Jane. delivery_client.items('elements.author'.contains('jane_doe')) # Gets items attributed to at least Jane, John, or both. delivery_client.items('elements.author'.any('jane_doe', 'john_wick'))
    # Gets items attributed to Jane. delivery_client.items('elements.author'.contains('jane_doe')) # Gets items attributed to at least Jane, John, or both. delivery_client.items('elements.author'.any('jane_doe', 'john_wick'))
    • TypeScript
    // Gets items attributed to Jane. deliveryClient.items<ContentItem>() .containsFilter('elements.author', ['jane_doe']) .toObservable() .subscribe(response => console.log(response)); // Gets items attributed to at least Jane, John, or both. deliveryClient.items<ContentItem>() .anyFilter('elements.author', ['jane_doe', 'john_wick']) .toObservable() .subscribe(response => console.log(response));
    // Gets items attributed to Jane. deliveryClient.items<ContentItem>() .containsFilter('elements.author', ['jane_doe']) .toObservable() .subscribe(response => console.log(response)); // Gets items attributed to at least Jane, John, or both. deliveryClient.items<ContentItem>() .anyFilter('elements.author', ['jane_doe', 'john_wick']) .toObservable() .subscribe(response => console.log(response));

    Subpages

    When using Web Spotlight to manage your website content, you can retrieve subpages the same way as your linked items.

    For example, you can have various insurance-related pages linked in multiple places on your website. To get the pages that reference the Travel insurance page in a subpages element called Subpages, use the contains filter in your request.

    • Swift
    // Gets pages linking travel insurance as their subpage. let customQuery = "items?elements.subpages[contains]=travel_insurance" // Gets pages linking at least travel insurance, car insurance, or both as their subpage. // let customQuery = "items?elements.subpages[any]=travel_insurance,car_insurance" client.getItems(modelType: Page.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let pages = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    // Gets pages linking travel insurance as their subpage. let customQuery = "items?elements.subpages[contains]=travel_insurance" // Gets pages linking at least travel insurance, car insurance, or both as their subpage. // let customQuery = "items?elements.subpages[any]=travel_insurance,car_insurance" client.getItems(modelType: Page.self, customQuery: customQuery) { (isSuccess, itemsResponse, error) in if isSuccess { if let pages = itemsResponse?.items { // Use your items here } } else { if let error = error { print(error) } } }
    • Java
    // Gets pages linking travel insurance as their subpage. CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterContains("elements.subpages", "travel_insurance") .build() ); // Gets pages linking at least travel insurance, car insurance, or both as their subpage. CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterAny("elements.subpages", "travel_insurance", "car_insurance") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    // Gets pages linking travel insurance as their subpage. CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterContains("elements.subpages", "travel_insurance") .build() ); // Gets pages linking at least travel insurance, car insurance, or both as their subpage. CompletionStage<ContentItemsListingResponse> items = client.getItems( DeliveryParameterBuilder.params() .filterAny("elements.subpages", "travel_insurance", "car_insurance") .build() ); // To use the code for Android projects, see http://docs.kontent.ai/android
    • JavaScript
    // Gets pages linking travel insurance as their subpage. deliveryClient.items() .containsFilter('elements.subpages', ['travel_insurance']) .toObservable() .subscribe(response => console.log(response)); // Gets pages linking at least travel insurance, car insurance, or both as their subpage. deliveryClient.items() .anyFilter('elements.subpages', ['travel_insurance', 'car_insurance']) .toObservable() .subscribe(response => console.log(response));
    // Gets pages linking travel insurance as their subpage. deliveryClient.items() .containsFilter('elements.subpages', ['travel_insurance']) .toObservable() .subscribe(response => console.log(response)); // Gets pages linking at least travel insurance, car insurance, or both as their subpage. deliveryClient.items() .anyFilter('elements.subpages', ['travel_insurance', 'car_insurance']) .toObservable() .subscribe(response => console.log(response));
    • C#
    // Gets pages linking travel insurance as their subpage. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new ContainsFilter("elements.subpages", "travel_insurance") ); // Gets pages linking at least travel insurance, car insurance, or both as their subpage. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new AnyFilter("elements.subpages", "travel_insurance", "car_insurance") );
    // Gets pages linking travel insurance as their subpage. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new ContainsFilter("elements.subpages", "travel_insurance") ); // Gets pages linking at least travel insurance, car insurance, or both as their subpage. IDeliveryItemListingResponse<object> response = await deliveryClient.GetItemsAsync<object>( new AnyFilter("elements.subpages", "travel_insurance", "car_insurance") );
    • PHP
    // Gets pages linking travel insurance as their subpage. $items = $client->getItems((new QueryParams()) ->contains('elements.subpages', ['travel_insurance'])); // Gets pages linking at least travel insurance, car insurance, or both as their subpage. $items = $client->getItems((new QueryParams()) ->any('elements.subpages', ['travel_insurance'], ['car_insurance']));
    // Gets pages linking travel insurance as their subpage. $items = $client->getItems((new QueryParams()) ->contains('elements.subpages', ['travel_insurance'])); // Gets pages linking at least travel insurance, car insurance, or both as their subpage. $items = $client->getItems((new QueryParams()) ->any('elements.subpages', ['travel_insurance'], ['car_insurance']));
    • cURL
    # Gets pages linking travel insurance as their subpage. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.subpages[contains]=travel_insurance' \ --header 'content-type: application/json' # Gets pages linking at least travel insurance, car insurance, or both as their subpage. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.subpages[any]=travel_insurance,car_insurance' \ --header 'content-type: application/json'
    # Gets pages linking travel insurance as their subpage. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.subpages[contains]=travel_insurance' \ --header 'content-type: application/json' # Gets pages linking at least travel insurance, car insurance, or both as their subpage. curl --request GET \ --url 'https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items?elements.subpages[any]=travel_insurance,car_insurance' \ --header 'content-type: application/json'
    • Ruby
    # Gets pages linking travel insurance as their subpage. delivery_client.items('elements.subpages'.contains('travel_insurance')) # Gets pages linking at least travel insurance, car insurance, or both as their subpage. delivery_client.items('elements.subpages'.any('travel_insurance', 'car_insurance'))
    # Gets pages linking travel insurance as their subpage. delivery_client.items('elements.subpages'.contains('travel_insurance')) # Gets pages linking at least travel insurance, car insurance, or both as their subpage. delivery_client.items('elements.subpages'.any('travel_insurance', 'car_insurance'))
    • TypeScript
    // Gets pages linking travel insurance as their subpage. deliveryClient.items<ContentItem>() .containsFilter('elements.subpages', ['travel_insurance']) .toObservable() .subscribe(response => console.log(response)); // Gets pages linking at least travel insurance, car insurance, or both as their subpage. deliveryClient.items<ContentItem>() .anyFilter('elements.subpages', ['travel_insurance', 'car_insurance']) .toObservable() .subscribe(response => console.log(response));
    // Gets pages linking travel insurance as their subpage. deliveryClient.items<ContentItem>() .containsFilter('elements.subpages', ['travel_insurance']) .toObservable() .subscribe(response => console.log(response)); // Gets pages linking at least travel insurance, car insurance, or both as their subpage. deliveryClient.items<ContentItem>() .anyFilter('elements.subpages', ['travel_insurance', 'car_insurance']) .toObservable() .subscribe(response => console.log(response));

    What's next?