PromotionCampaignAssignmentSearch resource (Data API 23.2)

Summary

Http Method Resource Description
POST /sites/{site_id}/promotion_campaign_assignment_search

Searches for promotion campaign assignments.

The PromotionCampaignAssignment Search document contains a search object that allows filtering on various attributes.

The query attribute specifies a complex query that can be used to narrow down the search. Attributes are grouped into different buckets. These are the list of searchable attributes with their corresponding buckets:

Main:

  • rank - Integer
  • start_date - Date
  • end_date - Date

Campaign:

  • campaign_id - String

Promotion:

  • promotion_id - String
  • description - String
  • enabled - Boolean

Special handling:

  • coupon_id - String

Only fields in the same bucket can be joined using a disjunction (OR). For instance, when joining campaign_id and rank above, only a conjunction is allowed (AND), whereas promotion_id and description can be joined to each other using an OR because they are in the same bucket. Special handling fields must always use conjunctions. If the field is used in a disjunction (OR) that violates this rule, an exception will be thrown.

Expands that can be applied for the search request

  • promotion
  • campaign

Note that only searchable attributes (excluding the ones marked with above with an asterisk) can be used in sorting.

Search Promotion Campaign Assignments

Searches for promotion campaign assignments.

The PromotionCampaignAssignment Search document contains a search object that allows filtering on various attributes.

The query attribute specifies a complex query that can be used to narrow down the search. Attributes are grouped into different buckets. These are the list of searchable attributes with their corresponding buckets:

Main:

  • rank - Integer
  • start_date - Date
  • end_date - Date

Campaign:

  • campaign_id - String

Promotion:

  • promotion_id - String
  • description - String
  • enabled - Boolean

Special handling:

  • coupon_id - String

Only fields in the same bucket can be joined using a disjunction (OR). For instance, when joining campaign_id and rank above, only a conjunction is allowed (AND), whereas promotion_id and description can be joined to each other using an OR because they are in the same bucket. Special handling fields must always use conjunctions. If the field is used in a disjunction (OR) that violates this rule, an exception will be thrown.

Expands that can be applied for the search request

  • promotion
  • campaign

Note that only searchable attributes (excluding the ones marked with above with an asterisk) can be used in sorting.

Url

POST https://hostname:port/dw/data/v23_2/sites/{site_id}/promotion_campaign_assignment_search

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

SearchRequest

Response Document

PromotionCampaignAssignmentSearchResult

Path Parameters

Parameter Type Description Constraints
site_id String The site context. minLength=1

Sample

REQUEST:
POST /s/-/dw/data/v23_2/sites/site-one/promotion_campaign_assignment_search HTTP/1.1
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Accept: application/json

{
    "query" : {
        "bool_query" : {
            must : [
                "text_query" : { "fields" : ["campaign_id", "description"], "search_phrase" : "coupon" },
                "term_query" : { "fields" : ["enabled"], "operator" : "is", "values" : [true] }
            ]
        }
    },
    "expand" : ["campaign"],
    "select" : "(**)"
}

RESPONSE:
HTTP/1.1 200 OK
Content-Length: 532
Content-Type: application/json; charset=UTF-8
{
  "_v" : "23.2",
  "count" : 1,
  "expand" : 
   [
      "campaign"
   ],
   "hits" : [
      {
         "_type" : "promotion_campaign_assignment",
           "campaign" :
           {
               "_type" : "campaign",
               "campaign_id" : "coupon-campaign",
               "description" : "A campaign for coupons.",
               "enabled" : true
           }
         "campaign_id" : "coupon-campaign",
         "coupons" : [
            "order-promotion-coupon"
         ],
         "description" : "Coupon Order Promotion",
         "enabled" : true,
         "link" : "https://example.com/s/-/dw/data/v23_2/sites/SiteGenesis/promotions/coupon-promotion-order/campaigns/coupon-campaign",
         "promotion_id" : "coupon-promotion-order",
         "schedule" : {
            "end_date" : "2050-01-01T00:00:00.000Z",
            "start_date" : "2000-01-01T00:00:00.000Z"
         }
      }
   ],
  "query" : {
      "bool_query" : {
          must : [
              "text_query" : { "fields" : ["campaign_id", "description"], "search_phrase" : "coupon" },
              "term_query" : { "fields" : ["enabled"], "operator" : "is", "values" : [true] }
          ]
      }
  },
  "select": "**",
  "start" : 0,
  "total" : 1
}
X OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.