Skip to main content

Update a Promotion

PUT 

https://useast.api.elasticpath.com/v2/promotions/:promotionID

Use this endpoint to update a specific promotion.

note

You can re-enable an expired promotion by updating the end date to a future date. However, when you enable a promotion again, all codes previously attached to it are deleted to make sure that duplicate promotion codes do not exist on different promotions.

Errors

When extending the end date of an expired promotion with over 1000 codes, you will receive the following error response. In such cases, we recommend duplicating the promotion, allowing you to set the new end dates and create promotion codes as needed.

{
"errors": [
{
"status": 422,
"source": "request",
"title": "Unprocessable Entity",
"detail": ""
}
]
}

Request

Responses

Response Headers

    Authorization: http

    name: bearerAuthtype: httpscheme: bearer
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Put, "https://useast.api.elasticpath.com/v2/promotions/:promotionID");
    request.Headers.Add("Accept", "application/json");
    request.Headers.Add("Authorization", "Bearer <token>");
    var content = new StringContent("{\n \"promotion_type\": \"fixed_discount\",\n \"type\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"enabled\": true,\n \"automatic\": true,\n \"start\": \"string\",\n \"end\": \"string\",\n \"min_cart_value\": {},\n \"max_applications_per_cart\": 0,\n \"schema\": {\n \"target_catalogs\": [\n \"string\"\n ],\n \"currencies\": [\n {\n \"amount\": 0,\n \"currency\": \"string\"\n }\n ],\n \"conditions\": {\n \"or\": [\n {\n \"and\": [\n {\n \"attribute\": {\n \"template\": \"string\",\n \"field\": \"string\",\n \"type\": \"string\",\n \"value\": \"string\"\n }\n },\n {\n \"node\": {\n \"values\": [\n \"string\"\n ]\n }\n }\n ]\n }\n ]\n }\n }\n}", null, "application/json");
    request.Content = content;
    var response = await client.SendAsync(request);
    response.EnsureSuccessStatusCode();
    Console.WriteLine(await response.Content.ReadAsStringAsync());
    Request Collapse all
    Base URL
    https://useast.api.elasticpath.com
    Auth
    Parameters
    — pathrequired
    — headerrequired
    Body
    {
      "promotion_type": "fixed_discount",
      "type": "string",
      "name": "string",
      "description": "string",
      "enabled": true,
      "automatic": true,
      "start": "string",
      "end": "string",
      "min_cart_value": {},
      "max_applications_per_cart": 0,
      "schema": {
        "target_catalogs": [
          "string"
        ],
        "currencies": [
          {
            "amount": 0,
            "currency": "string"
          }
        ],
        "conditions": {
          "or": [
            {
              "and": [
                {
                  "attribute": {
                    "template": "string",
                    "field": "string",
                    "type": "string",
                    "value": "string"
                  }
                },
                {
                  "node": {
                    "values": [
                      "string"
                    ]
                  }
                }
              ]
            }
          ]
        }
      }
    }
    
    ResponseClear

    Click the Send API Request button above and see the response here!

    We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.