Campaigns

POST Search for campaigns using a search request object that allows filtering on various attributes.

POST /organizations/{organizationId}/campaigns

Operation ID: campaignsSearch. Security: AmOAuth2 (sfcc.promotions, sfcc.promotions.rw).

Supported Query Attributes

The query attribute specifies a complex query that you can use to narrow down the search. A subset of these attributes can optionally be used to sort the returned results.

Attribute Type Sortable
campaignId String yes
description String yes
enabled Boolean yes
couponId String no
customerGroup String no
sourceCode String no
startDate Date no
endDate Date no
lastModified Date no

These fields can only be used in queries as conjunctions (using AND). If the field is used in a disjunction (OR), an exception is thrown.

Parameters

  • organizationId (path, OrganizationId, required) An identifier for the Salesforce Commerce Cloud organization the request is being made by. It consists of a prefix 'f_ecom_' followed by a 4-character realm identifier and a 3-character instance type identifier.

    Example

    f_ecom_zzxy_prd
  • siteId (query, SiteId, required) The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.

    Example: SiteId

    RefArch

Request body

Media type: application/json. Schema: SearchRequest.

Responses

  • 200 Campaign search successfully executed.

    Media type: application/json. Schema: CampaignSearchResult.

    Example: CampaignSearchResult

    {
      "limit": 2,
      "hits": [
        {
          "campaignId": "mens-clothing-dress-shirts",
          "creationDate": "2019-11-06T21:12:35.000Z",
          "customerGroups": [
            "Everyone"
          ],
          "description": "This a campaign for the Mens Dress Shirts Category offering a specific banner as well as a 20% off dress shirts promotion, and a custom sort rule of product name ascending",
          "enabled": false,
          "lastModified": "2019-11-06T21:12:35.000Z"
        },
        {
          "campaignId": "mens-clothing-suits",
          "creationDate": "2019-11-06T21:12:35.000Z",
          "customerGroups": [
            "Everyone"
          ],
          "description": "This is a campaign that displays a landing banner, with a 25% discount on all suits and default sorting rule of top selling suits.",
          "enabled": false,
          "lastModified": "2019-11-06T21:12:35.000Z"
        }
      ],
      "query": {
        "textQuery": {
          "fields": [
            "id",
            "description"
          ],
          "searchPhrase": "campaign"
        }
      },
      "offset": 1,
      "total": 4
    }
  • 400 Returned when the query is ill-formed.

    Media type: application/json. Schema: ErrorResponse.

    Example: InvalidOperation

    {
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/invalid-operation",
      "detail": "Failed to execute search query: wrong syntax.",
      "title": "Incorrect Syntax"
    }