Update a Rule Promotion
PUThttps://useast.api.elasticpath.com/v2/rule-promotions/:promotionID
Updates an existing Rule Promotion specified by its promotion ID. This includes both semantic and syntactic validation to ensure correctness. For example, the start date must be earlier than the end date.
Editable fields include:
name
description
enabled
start
end
automatic
stackable
override_stacking
rule_set
Please refer to the OpenAPI examples section on this page for sample update requests.
Request
Path Parameters
promotionID stringrequired
The unique identifier of the promotion to be updated.
Header Parameters
Authorization Bearerrequired
The Bearer token required to get access to the API.
- application/json
Bodyrequired
data object
Responses
- 200
OK
- application/json
- Schema
- Example (auto)
Schema
data object
{
"data": {
"type": "rule_promotion",
"id": "string",
"store_id": "string",
"name": "string",
"description": "string",
"priority": 0,
"enabled": true,
"automatic": true,
"stackable": true,
"override_stacking": true,
"rule_set": {
"catalog_ids": [
"string"
],
"currencies": [
"string"
],
"rules": {
"strategy": "string",
"operator": "string",
"args": [
"string"
],
"children": [
{
"strategy": "string",
"operator": "string",
"args": [
"string"
]
}
]
},
"actions": [
{
"strategy": "string",
"args": [
"string"
],
"condition": {
"strategy": "string",
"children": [
{
"strategy": "string",
"operator": "string",
"args": [
"string"
]
}
]
},
"limitations": {
"max_discount": 0,
"max_quantity": 0,
"items": {
"max_items": 0,
"price_strategy": "cheapest"
}
}
}
]
},
"start": "2024-07-29T15:51:28.071Z",
"end": "2024-07-29T15:51:28.071Z",
"meta": {
"timestamps": {
"created_at": "2024-07-29T15:51:28.071Z",
"updated_at": "2024-07-29T15:51:28.071Z"
}
}
}
}
Authorization: http
name: BearerAuthtype: httpscheme: bearer
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, "https://useast.api.elasticpath.com/v2/rule-promotions/:promotionID");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"rule_promotion\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"priority\": 0,\n \"enabled\": true,\n \"automatic\": true,\n \"stackable\": true,\n \"override_stacking\": true,\n \"start\": \"2024-07-29T15:51:28.071Z\",\n \"end\": \"2024-07-29T15:51:28.071Z\",\n \"rule_set\": {\n \"catalog_ids\": [\n \"string\"\n ],\n \"currencies\": [\n \"string\"\n ],\n \"rules\": {\n \"strategy\": \"string\",\n \"operator\": \"string\",\n \"args\": [\n \"string\"\n ],\n \"children\": [\n {\n \"strategy\": \"string\",\n \"operator\": \"string\",\n \"args\": [\n \"string\"\n ]\n }\n ]\n },\n \"actions\": [\n {\n \"strategy\": \"string\",\n \"args\": [\n \"string\"\n ],\n \"condition\": {\n \"strategy\": \"string\",\n \"children\": [\n {\n \"strategy\": \"string\",\n \"operator\": \"string\",\n \"args\": [\n \"string\"\n ]\n }\n ]\n },\n \"limitations\": {\n \"max_discount\": 0,\n \"max_quantity\": 0,\n \"items\": {\n \"max_items\": 0,\n \"price_strategy\": \"cheapest\"\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());
ResponseClear