POST
/
api
/
v2
/
platform
/
promotions
curl --request POST \
  --url http://{defaultHost}/api/v2/platform/promotions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "promotion": {
    "name": "Promotions Used in 2021",
    "code": "BLK-FRI",
    "description": "Save today with discount code XYZ at checkout.",
    "usage_limit": 100,
    "advertise": true,
    "starts_at": "<string>",
    "ends_at": "<string>",
    "store_ids": [
      "2"
    ]
  }
}'
{
  "data": {
    "id": "35",
    "type": "promotion",
    "attributes": {
      "description": "First 1000 Customers Save 20%",
      "expires_at": "2022-11-12T19:35:03.283Z",
      "starts_at": "2022-11-08T19:35:03.283Z",
      "name": "Black Friday 20% Off",
      "type": "Spree::Promotion",
      "usage_limit": 1000,
      "match_policy": "any",
      "code": "BLK-20",
      "advertise": true,
      "path": "/black-fri/today",
      "created_at": "2022-11-08T19:35:03.521Z",
      "updated_at": "2022-11-08T19:35:03.533Z",
      "public_metadata": {},
      "private_metadata": {}
    },
    "relationships": {
      "promotion_category": {
        "data": {
          "id": "15",
          "type": "promotion_category"
        }
      },
      "promotion_rules": {
        "data": []
      },
      "promotion_actions": {
        "data": []
      },
      "stores": {
        "data": [
          {
            "id": "382",
            "type": "store"
          },
          {
            "id": "383",
            "type": "store"
          },
          {
            "id": "381",
            "type": "store"
          }
        ]
      }
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

include
string

Select which associated resources you would like to fetch, see: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>

Body

application/json
promotion
object
required

Response

201
application/vnd.api+json
Record created
data
object
required