curl --request POST \
--url https://api.exowpee.com/v1/discount/campaigns/{campaign}/accesses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": 123,
"source_reference": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"usage_limit": 2,
"metadata": [
"<string>"
]
}
'import requests
url = "https://api.exowpee.com/v1/discount/campaigns/{campaign}/accesses"
payload = {
"customer_id": 123,
"source_reference": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"usage_limit": 2,
"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({
customer_id: 123,
source_reference: '<string>',
starts_at: '2023-11-07T05:31:56Z',
ends_at: '2023-11-07T05:31:56Z',
usage_limit: 2,
metadata: ['<string>']
})
};
fetch('https://api.exowpee.com/v1/discount/campaigns/{campaign}/accesses', 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}/accesses",
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([
'customer_id' => 123,
'source_reference' => '<string>',
'starts_at' => '2023-11-07T05:31:56Z',
'ends_at' => '2023-11-07T05:31:56Z',
'usage_limit' => 2,
'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/{campaign}/accesses"
payload := strings.NewReader("{\n \"customer_id\": 123,\n \"source_reference\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"usage_limit\": 2,\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/{campaign}/accesses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": 123,\n \"source_reference\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"usage_limit\": 2,\n \"metadata\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/discount/campaigns/{campaign}/accesses")
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 \"customer_id\": 123,\n \"source_reference\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"usage_limit\": 2,\n \"metadata\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"discount_campaign_id": "<string>",
"customer_id": "<string>",
"source_type": "<string>",
"source_reference": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"usage_limit": 123,
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"id": "<string>",
"discount_campaign_id": "<string>",
"customer_id": "<string>",
"source_type": "<string>",
"source_reference": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"usage_limit": 123,
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}Give a customer campaign access
Lets a chosen customer use a restricted discount campaign, for example for a loyalty or VIP offer.
curl --request POST \
--url https://api.exowpee.com/v1/discount/campaigns/{campaign}/accesses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": 123,
"source_reference": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"usage_limit": 2,
"metadata": [
"<string>"
]
}
'import requests
url = "https://api.exowpee.com/v1/discount/campaigns/{campaign}/accesses"
payload = {
"customer_id": 123,
"source_reference": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"usage_limit": 2,
"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({
customer_id: 123,
source_reference: '<string>',
starts_at: '2023-11-07T05:31:56Z',
ends_at: '2023-11-07T05:31:56Z',
usage_limit: 2,
metadata: ['<string>']
})
};
fetch('https://api.exowpee.com/v1/discount/campaigns/{campaign}/accesses', 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}/accesses",
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([
'customer_id' => 123,
'source_reference' => '<string>',
'starts_at' => '2023-11-07T05:31:56Z',
'ends_at' => '2023-11-07T05:31:56Z',
'usage_limit' => 2,
'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/{campaign}/accesses"
payload := strings.NewReader("{\n \"customer_id\": 123,\n \"source_reference\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"usage_limit\": 2,\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/{campaign}/accesses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": 123,\n \"source_reference\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"usage_limit\": 2,\n \"metadata\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/discount/campaigns/{campaign}/accesses")
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 \"customer_id\": 123,\n \"source_reference\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"usage_limit\": 2,\n \"metadata\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"discount_campaign_id": "<string>",
"customer_id": "<string>",
"source_type": "<string>",
"source_reference": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"usage_limit": 123,
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"id": "<string>",
"discount_campaign_id": "<string>",
"customer_id": "<string>",
"source_type": "<string>",
"source_reference": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"usage_limit": 123,
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}discount_campaign_accesses.create
Conditions
- The campaign must not be archived.
- The campaign access mode must be restricted.
- The customer must be one of the company’s customers and not be deleted.
- A customer that already has an access to the campaign that was not removed cannot be given another one.
- ends_at must be after starts_at.
- A manual access is created for the customer (status 201).
- If the customer had an access to this campaign that was removed earlier, it is restored with the fields sent (status 200) instead of creating a new one.
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, discount_campaign_id, customer_id, source_type, source_reference, starts_at, ends_at, usage_limit, metadata, created_at, updated_at.
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: .
Body
Customer to give access to (27-character KSUID string). Required; must be an existing customer of the company.
Free-text reference to the origin of the access, up to 255 characters. Optional.
255Moment the access begins, as a date and time; a value without an offset is read in the company time zone. Optional; omitted means valid at once.
Moment the access ends, after starts_at. Optional; omitted means it does not expire.
Maximum number of orders the customer can use this access on, at least 1. Optional; omitted means no limit.
x >= 1Free-form object stored with the access. Optional.
Response
Resource (only with response=resource).
Identifier of the access (27-character KSUID string).
Identifier of the campaign the access is for (27-character KSUID string).
Identifier of the customer who may use the campaign (27-character KSUID string).
How the access was given: manual (through this API), loyalty or system. Accesses created by this API are manual.
Free-text reference to the origin of the access, for example a loyalty programme name. Null when none was given.
Moment the access begins, in ISO 8601 (UTC). Null means it is valid from the start.
Moment the access ends, in ISO 8601 (UTC). Null means it does not expire.
Maximum number of orders this access can be used on. Null means no limit.
Free-form data stored with the access, or null.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).