younifyd
Menu

Badges

Get badges for a set of placement IDs

POST/rest/organizations/{organizationId}/commerce/v2/tracking-ids/{trackingId}/badges

Use it in a workflow

  1. Add a step and choose the Coveo connector.
  2. Pick the Badges action (under Commerce).
  3. Fill in the fields below, then reference the result from later steps as {{badges.response.data}}.

Request

Path parameters

organizationIdstringrequired

The unique identifier of the target [organization](https://docs.coveo.com/en/185/).<br />**Example:** `acmecorporation8tp8wu3`

trackingIdstringrequired

The unique identifier of the tracking target.

Request body

Enter the body as JSON in the step's Body field.

contextobjectrequired

Contextual information about the query.

captureboolean

Whether the request should be tracked for analytics and machine learning purposes. When set to `true`, this will trigger a server-side event to be logged. When set to `false`, the server-side event will not be logged.

cartarray<object>2 fields

The cart information.

customobject

Custom context values under context.custom. Use this for context mapping.

labelsobject

Deprecated - The context labels.

productobject1 fields

The product ID used to generate the recommendations.

sourcearray<string>

Defines one or more client side libraries that generated the analytics event. The format should be the library's name followed by '@', and then the version. For example, '[custom.library.js@2.0.0]'.

userobject1 fields

The user information.

viewobjectrequired2 fields

A collection of data points describing the view. Note: The term 'view' is used instead of 'page' to accommodate usage in contexts such as mobile apps.

countrystringrequired

An ISO 3166-1 alpha-2 country code.

currencystringrequired

An ISO 4217 currency code.

languagestringrequired

An ISO 639-1 language code.

placementIdsarray<string (uuid)>required

The list of placement unique identifiers for which to retrieve badges. Maximum of 5 placement IDs allowed per request.

json
{
  "context": {
    "view": {
      "url": "https://acme.com/summersale",
      "referrer": "https://example.com/"
    },
    "capture": true,
    "cart": [
      {
        "productId": "shoe-a1-red",
        "quantity": 2
      }
    ],
    "custom": {
      "fitmentProducts": [
        "sku_123",
        "sku_456"
      ]
    },
    "labels": {
      "brand": "ACME",
      "category": "garden > garden-tools > chainsaws"
    },
    "product": {
      "productId": "shoe-a1-red"
    },
    "source": [
      "@coveo/headless@2.61.0",
      "custom.library.js@2.0.0"
    ],
    "user": {
      "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
    }
  },
  "country": "US",
  "currency": "USD",
  "language": "en",
  "placementIds": [
    "36164bca-b489-4c42-8574-e1325d56d0be",
    "47275dcb-c590-5d53-9685-f2436e67e1cf"
  ]
}

Response

Returns 200 with an object. Read it in later steps with {{badges.response.data.<field>}}.

productsarray<object>

The list of products

badgePlacementsarray<object>2 fields

The list of badge placements associated with this product.

productIdstring

The product identifier.

json
{
  "products": [
    {
      "badgePlacements": [
        {
          "badges": [
            {
              "backgroundColor": null,
              "iconUrl": null,
              "text": null,
              "textColor": null
            }
          ],
          "placementId": "36164bca-b489-4c42-8574-e1325d56d0be"
        }
      ],
      "productId": "0000003035-45"
    }
  ]
}

Need more? See the Coveo guide for connection setup and behaviour shared by every action.

Was this page helpful?
Badges — Coveo — Documentation