Searching within a collection resource of Sitecore CDP REST APIs

Abstract

Provides attributes and a cURL command for searching within a collection resource of Sitecore CDP REST APIs (Data model 2.0).

You can search for specific resources within a collection resource by using certain query parameters to specify your search criteria. You can perform a search based on generic query parameters. Search supports result pagination and link expansion.

A search consists of specifying one or more query parameters and a corresponding search value on a collection resource URL. The following cURL command returns all someCollection resources where both are true:

  • The someCollection attribute parameter1 is equal to searchValue1 (case insensitive).

  • The someCollection attribute parameter2 is equal to searchValue2 (case insensitive).

$ curl -H "Accept: application/json" \
     "https://{apiEndpoint}/v2/someCollection?parameter1=searchValue1&parameter2=searchValue2"

You can sort search results by specifying a sort query parameter and a corresponding sort value (ASC or DESC case sensitive) on a collection resource URL. The following cURL command returns all someCollection resources ordered by the following:

  • The someCollection resource createdAt date sorted ascending (case insensitive).

  • The someCollection resource label sorted descending (case insensitive).

curl -H "Accept: application/json" \
     "https://{apiEndpoint}/v2/someCollection?sort=createdAt::ASC|label::DESC"