curl --request PUT \
--url https://api.exowpee.com/v1/discount/campaigns/{campaign} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"metadata": [
"<string>"
],
"activation_mode": "<string>",
"discount_type": "<string>",
"application_scope": "<string>",
"access_mode": "<string>",
"code": "<string>",
"usage_limit": 2,
"usage_pool_limit": 2,
"usage_limit_per_customer": 2,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.exowpee.com/v1/discount/campaigns/{campaign}"
payload = {
"name": "<string>",
"description": "<string>",
"metadata": ["<string>"],
"activation_mode": "<string>",
"discount_type": "<string>",
"application_scope": "<string>",
"access_mode": "<string>",
"code": "<string>",
"usage_limit": 2,
"usage_pool_limit": 2,
"usage_limit_per_customer": 2,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
metadata: ['<string>'],
activation_mode: '<string>',
discount_type: '<string>',
application_scope: '<string>',
access_mode: '<string>',
code: '<string>',
usage_limit: 2,
usage_pool_limit: 2,
usage_limit_per_customer: 2,
starts_at: '2023-11-07T05:31:56Z',
ends_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.exowpee.com/v1/discount/campaigns/{campaign}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exowpee.com/v1/discount/campaigns/{campaign}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'metadata' => [
'<string>'
],
'activation_mode' => '<string>',
'discount_type' => '<string>',
'application_scope' => '<string>',
'access_mode' => '<string>',
'code' => '<string>',
'usage_limit' => 2,
'usage_pool_limit' => 2,
'usage_limit_per_customer' => 2,
'starts_at' => '2023-11-07T05:31:56Z',
'ends_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/discount/campaigns/{campaign}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": [\n \"<string>\"\n ],\n \"activation_mode\": \"<string>\",\n \"discount_type\": \"<string>\",\n \"application_scope\": \"<string>\",\n \"access_mode\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.exowpee.com/v1/discount/campaigns/{campaign}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": [\n \"<string>\"\n ],\n \"activation_mode\": \"<string>\",\n \"discount_type\": \"<string>\",\n \"application_scope\": \"<string>\",\n \"access_mode\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/discount/campaigns/{campaign}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": [\n \"<string>\"\n ],\n \"activation_mode\": \"<string>\",\n \"discount_type\": \"<string>\",\n \"application_scope\": \"<string>\",\n \"access_mode\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"activation_mode": "<string>",
"code": "<string>",
"status": "<string>",
"discount_type": "<string>",
"tier_basis": "<string>",
"currency_code": "<string>",
"currency_exponent": 123,
"application_scope": "<string>",
"access_mode": "<string>",
"combination_policy": "<string>",
"usage_limit": 123,
"usage_pool_limit": 123,
"usage_limit_per_customer": 123,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"metadata": {},
"conditions": "<array>",
"tiers": "<array>",
"stockable_units": [
"<unknown>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}Edit a discount campaign
Changes the name, code, limits or dates of a discount campaign.
curl --request PUT \
--url https://api.exowpee.com/v1/discount/campaigns/{campaign} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"metadata": [
"<string>"
],
"activation_mode": "<string>",
"discount_type": "<string>",
"application_scope": "<string>",
"access_mode": "<string>",
"code": "<string>",
"usage_limit": 2,
"usage_pool_limit": 2,
"usage_limit_per_customer": 2,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.exowpee.com/v1/discount/campaigns/{campaign}"
payload = {
"name": "<string>",
"description": "<string>",
"metadata": ["<string>"],
"activation_mode": "<string>",
"discount_type": "<string>",
"application_scope": "<string>",
"access_mode": "<string>",
"code": "<string>",
"usage_limit": 2,
"usage_pool_limit": 2,
"usage_limit_per_customer": 2,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
metadata: ['<string>'],
activation_mode: '<string>',
discount_type: '<string>',
application_scope: '<string>',
access_mode: '<string>',
code: '<string>',
usage_limit: 2,
usage_pool_limit: 2,
usage_limit_per_customer: 2,
starts_at: '2023-11-07T05:31:56Z',
ends_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.exowpee.com/v1/discount/campaigns/{campaign}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exowpee.com/v1/discount/campaigns/{campaign}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'metadata' => [
'<string>'
],
'activation_mode' => '<string>',
'discount_type' => '<string>',
'application_scope' => '<string>',
'access_mode' => '<string>',
'code' => '<string>',
'usage_limit' => 2,
'usage_pool_limit' => 2,
'usage_limit_per_customer' => 2,
'starts_at' => '2023-11-07T05:31:56Z',
'ends_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/discount/campaigns/{campaign}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": [\n \"<string>\"\n ],\n \"activation_mode\": \"<string>\",\n \"discount_type\": \"<string>\",\n \"application_scope\": \"<string>\",\n \"access_mode\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.exowpee.com/v1/discount/campaigns/{campaign}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": [\n \"<string>\"\n ],\n \"activation_mode\": \"<string>\",\n \"discount_type\": \"<string>\",\n \"application_scope\": \"<string>\",\n \"access_mode\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/discount/campaigns/{campaign}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": [\n \"<string>\"\n ],\n \"activation_mode\": \"<string>\",\n \"discount_type\": \"<string>\",\n \"application_scope\": \"<string>\",\n \"access_mode\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"activation_mode": "<string>",
"code": "<string>",
"status": "<string>",
"discount_type": "<string>",
"tier_basis": "<string>",
"currency_code": "<string>",
"currency_exponent": 123,
"application_scope": "<string>",
"access_mode": "<string>",
"combination_policy": "<string>",
"usage_limit": 123,
"usage_pool_limit": 123,
"usage_limit_per_customer": 123,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"metadata": {},
"conditions": "<array>",
"tiers": "<array>",
"stockable_units": [
"<unknown>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}discount_campaigns.update
Conditions
- Archived campaigns are read-only.
- activation_mode, discount_type, application_scope and access_mode cannot be changed after creation.
- The code can only be changed while the campaign is draft, and only on a campaign whose activation mode is code; it cannot be emptied.
- tier_basis and combination_policy can only be changed while the campaign is draft or paused.
- The resulting end date must be after the start date.
- The code must stay unique among the company’s campaigns.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the discount campaign (27-character KSUID string).
Query Parameters
Response mode. Default none; none answers 204 No Content.
none, resource Comma-separated JSON keys of the root resource (id is always rendered). Available: id, name, description, activation_mode, code, status, discount_type, tier_basis, currency_code, currency_exponent, application_scope, access_mode, combination_policy, usage_limit, usage_pool_limit, usage_limit_per_customer, starts_at, ends_at, metadata, created_at, updated_at, stockable_units.
Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: conditions, tiers.
Body
New name, up to 255 characters. When sent it cannot be empty.
255New description; null clears it.
New free-form object; null clears it.
Not accepted: the activation mode is fixed when the campaign is created.
Not accepted: the discount type is fixed when the campaign is created.
Not accepted: the application scope is fixed when the campaign is created.
Not accepted: the access mode is fixed when the campaign is created.
New code, up to 64 characters, stored in capitals and unique within the company. Accepted only while the campaign is draft and its activation mode is code; it cannot be empty.
64Maximum number of orders in total, at least 1; null removes the limit.
x >= 1Maximum number of orders without a customer, at least 1; null removes the limit.
x >= 1Maximum number of orders per customer, at least 1; null removes the limit.
x >= 1New start of eligibility, as a date and time; a value without an offset is read in the company time zone. When sent it cannot be empty.
New end of eligibility, as a date and time; null removes the end date. The resulting end must be after the start.
New tier basis (order or eligible_stockables). Accepted only while the campaign is draft or paused.
order, eligible_stockables New combination policy (exclusive or stackable). Accepted only while the campaign is draft or paused.
exclusive, stackable Response
Resource (only with response=resource).
Identifier of the campaign (27-character KSUID string).
Name of the campaign.
Free-text description, or null when none was given.
How the campaign starts to apply: automatic (to every eligible order) or code (only when the customer gives the campaign code). Cannot be changed after creation.
Code the customer gives, stored in capitals. Null for an automatic campaign.
Lifecycle status: draft (being set up, not applied), active (applied to orders), paused (temporarily not applied) or archived (retired, read-only). Changed only by the activate, pause, archive and draft actions.
How the discount is computed: percentage (tiers give a percentage) or fixed (tiers give a fixed amount). Cannot be changed after creation.
Amount compared with the tier minimums: order (the whole order) or eligible_stockables (only the lines targeted by the campaign).
Currency of the campaign amounts, copied from the company when the campaign was created.
Number of decimal places of the currency (0 for XOF). An amount in minor units divided by 10 to this power gives the amount in the currency.
What the discount applies to: order (the whole order) or stockables (only the product units chosen for the campaign). Cannot be changed after creation.
Who may use the campaign: public (everyone) or restricted (only customers given access). Cannot be changed after creation.
Whether the campaign can be combined with other campaigns: exclusive or stackable.
Maximum number of orders that can use the campaign in total. Null means no limit.
Maximum number of orders without a customer that can use the campaign. Null means no limit.
Maximum number of orders each customer can use the campaign on. Null means no limit.
Moment the campaign starts to be eligible, in ISO 8601 (UTC).
Moment the campaign stops being eligible, in ISO 8601 (UTC). Null means no end date.
Free-form data stored with the campaign by the client, or null.
Conditions an order must meet for the campaign to apply. Returned only when selected with ?include=conditions.
Discount levels of the campaign, ordered by minimum amount. Returned only when selected with ?include=tiers.
Identifiers of the product units targeted by the campaign (27-character KSUID strings). Empty when application_scope is order, since targets can only be set on a stockables campaign.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).