Campaigns

Create ruleset (V2)

Changed on

[!note] Management API endpoints are not meant to be used in real-time integrations that directly serve your end users. Rate limit: 3 requests per second.

Create a ruleset from promotion and strikethrough rules in the V2 JSON block format. A ruleset is a revision of all the rules of a campaign.

Only the first block of a rule can be a condition. Every other block must be an effect.

post/v2/applications/{applicationId}/campaigns/{campaignId}/rulesets

Request

Path parameters

applicationIdinteger required

The ID of the Application. It is displayed in your Talon.One deployment URL.

campaignIdinteger required

The ID of the campaign. It is displayed in your Talon.One deployment URL.

Request body

idinteger

Internal ID of this entity.

createdstring date-time

The time this entity was created.

userIdinteger

The ID of the user that created this ruleset.

campaignIdinteger

The ID of the campaign that owns this entity.

templateIdinteger

The ID of the campaign template that owns this entity.

activatedAtstring date-time

Timestamp indicating when this ruleset was activated.

Example request

{
  "id": 6,
  "userId": 385,
  "campaignId": 320,
  "templateId": 3,
  "promotionRules": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "title": "10% off for loyalty members",
      "blocks": [
        {
          "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
        }
      ]
    }
  ],
  "strikethroughRules": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "title": "10% off for loyalty members",
      "blocks": [
        {
          "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
        }
      ]
    }
  ],
  "selectors": [
    {
      "name": "discountedCartItems",
      "type": "selector",
      "source": "$Session.CartItems",
      "steps": [
        {
          "type": "filter",
          "predicate": {
            "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
          }
        }
      ]
    }
  ],
  "bundles": [
    {
      "id": "1b671a64-40d5-491e-99b0-da01ff1f3341",
      "name": "meal_deal",
      "type": "bundle",
      "sources": [
        "{{$mains}}",
        "{{$drinks}}"
      ],
      "counts": [
        1,
        2
      ],
      "matchers": [
        "color"
      ]
    }
  ],
  "parameters": [
    {
      "name": "minCartTotal",
      "value": 50,
      "valueType": "number",
      "maxValue": 10000,
      "description": "Minimum cart total to trigger the campaign.",
      "attribute": 42
    }
  ]
}

Response

Created

idinteger

Internal ID of this entity.

createdstring date-time

The time this entity was created.

userIdinteger

The ID of the user that created this ruleset.

campaignIdinteger

The ID of the campaign that owns this entity.

templateIdinteger

The ID of the campaign template that owns this entity.

activatedAtstring date-time

Timestamp indicating when this ruleset was activated.

Example response

{
  "id": 6,
  "userId": 385,
  "campaignId": 320,
  "templateId": 3,
  "promotionRules": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "title": "10% off for loyalty members",
      "blocks": [
        {
          "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
        }
      ]
    }
  ],
  "strikethroughRules": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "title": "10% off for loyalty members",
      "blocks": [
        {
          "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
        }
      ]
    }
  ],
  "selectors": [
    {
      "name": "discountedCartItems",
      "type": "selector",
      "source": "$Session.CartItems",
      "steps": [
        {
          "type": "filter",
          "predicate": {
            "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
          }
        }
      ]
    }
  ],
  "bundles": [
    {
      "id": "1b671a64-40d5-491e-99b0-da01ff1f3341",
      "name": "meal_deal",
      "type": "bundle",
      "sources": [
        "{{$mains}}",
        "{{$drinks}}"
      ],
      "counts": [
        1,
        2
      ],
      "matchers": [
        "color"
      ]
    }
  ],
  "parameters": [
    {
      "name": "minCartTotal",
      "value": 50,
      "valueType": "number",
      "maxValue": 10000,
      "description": "Minimum cart total to trigger the campaign.",
      "attribute": 42
    }
  ]
}

Changes