curl --request POST \
--url https://api.exowpee.com/v1/discount/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"code": "<string>",
"usage_limit": 2,
"usage_pool_limit": 2,
"usage_limit_per_customer": 2,
"ends_at": "2023-11-07T05:31:56Z",
"metadata": [
"<string>"
]
}
'import requests
url = "https://api.exowpee.com/v1/discount/campaigns"
payload = {
"name": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"code": "<string>",
"usage_limit": 2,
"usage_pool_limit": 2,
"usage_limit_per_customer": 2,
"ends_at": "2023-11-07T05:31:56Z",
"metadata": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
starts_at: '2023-11-07T05:31:56Z',
description: '<string>',
code: '<string>',
usage_limit: 2,
usage_pool_limit: 2,
usage_limit_per_customer: 2,
ends_at: '2023-11-07T05:31:56Z',
metadata: ['<string>']
})
};
fetch('https://api.exowpee.com/v1/discount/campaigns', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'starts_at' => '2023-11-07T05:31:56Z',
'description' => '<string>',
'code' => '<string>',
'usage_limit' => 2,
'usage_pool_limit' => 2,
'usage_limit_per_customer' => 2,
'ends_at' => '2023-11-07T05:31:56Z',
'metadata' => [
'<string>'
]
]),
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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"metadata\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.exowpee.com/v1/discount/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"metadata\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/discount/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"metadata\": [\n \"<string>\"\n ]\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": {}
}Create a discount campaign
Creates a new discount campaign (automatic or by code) in draft, ready to be configured before going live.
curl --request POST \
--url https://api.exowpee.com/v1/discount/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"code": "<string>",
"usage_limit": 2,
"usage_pool_limit": 2,
"usage_limit_per_customer": 2,
"ends_at": "2023-11-07T05:31:56Z",
"metadata": [
"<string>"
]
}
'import requests
url = "https://api.exowpee.com/v1/discount/campaigns"
payload = {
"name": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"code": "<string>",
"usage_limit": 2,
"usage_pool_limit": 2,
"usage_limit_per_customer": 2,
"ends_at": "2023-11-07T05:31:56Z",
"metadata": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
starts_at: '2023-11-07T05:31:56Z',
description: '<string>',
code: '<string>',
usage_limit: 2,
usage_pool_limit: 2,
usage_limit_per_customer: 2,
ends_at: '2023-11-07T05:31:56Z',
metadata: ['<string>']
})
};
fetch('https://api.exowpee.com/v1/discount/campaigns', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'starts_at' => '2023-11-07T05:31:56Z',
'description' => '<string>',
'code' => '<string>',
'usage_limit' => 2,
'usage_pool_limit' => 2,
'usage_limit_per_customer' => 2,
'ends_at' => '2023-11-07T05:31:56Z',
'metadata' => [
'<string>'
]
]),
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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"metadata\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.exowpee.com/v1/discount/campaigns")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"metadata\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/discount/campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"usage_limit\": 2,\n \"usage_pool_limit\": 2,\n \"usage_limit_per_customer\": 2,\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"metadata\": [\n \"<string>\"\n ]\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.create
Conditions
- The name, activation mode, discount type, tier basis, application scope, combination policy and start date are required. The access mode is public when left out.
- A code is required when activation_mode is code and refused when it is automatic.
- The code is stored in capitals and must be unique among the company’s campaigns.
- ends_at must be after starts_at.
- Dates without an offset are read in the company time zone and stored in UTC.
- The campaign is created in draft status, with the company currency and its exponent copied onto it and the member making the call recorded as creator. It has no tiers yet.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
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
Name of the campaign, up to 255 characters. Required.
255Required. automatic: applies by itself to eligible orders. code: applies only when the customer gives the campaign code.
automatic, code Required. percentage: tiers give a percentage. fixed: tiers give a fixed amount.
percentage, fixed Required. order: tier minimums are compared with the whole order. eligible_stockables: they are compared with the targeted lines only.
order, eligible_stockables Required. order: the discount applies to the whole order. stockables: it applies only to chosen product units.
order, stockables Required. exclusive or stackable, which decides whether the campaign can be combined with other campaigns.
exclusive, stackable Start of eligibility, as a date and time. Required. A value without an offset is read in the company time zone.
Free-text description. Optional.
Code the customer gives, up to 64 characters, stored in capitals and unique within the company. Required when activation_mode is code; refused when it is automatic.
64public (everyone, the default when omitted) or restricted (only customers given access).
public, restricted Maximum number of orders that can use the campaign in total, at least 1. Null or omitted means no limit.
x >= 1Maximum number of orders without a customer that can use the campaign, at least 1. Null or omitted means no limit.
x >= 1Maximum number of orders per customer, at least 1. Null or omitted means no limit.
x >= 1End of eligibility, as a date and time, after starts_at. Optional; omitted means no end date.
Free-form object stored with the campaign. Optional.
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).