Reserve coupons
curl --request POST \
--url https://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve \
--header 'Content-Type: application/json' \
--data '
{
"reservedBy": "<string>",
"reservedUntil": "2023-11-07T05:31:56Z",
"couponIds": [
"<string>"
]
}
'import requests
url = "https://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve"
payload = {
"reservedBy": "<string>",
"reservedUntil": "2023-11-07T05:31:56Z",
"couponIds": ["<string>"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
reservedBy: '<string>',
reservedUntil: '2023-11-07T05:31:56Z',
couponIds: ['<string>']
})
};
fetch('https://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve', 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://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve",
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([
'reservedBy' => '<string>',
'reservedUntil' => '2023-11-07T05:31:56Z',
'couponIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve"
payload := strings.NewReader("{\n \"reservedBy\": \"<string>\",\n \"reservedUntil\": \"2023-11-07T05:31:56Z\",\n \"couponIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve")
.header("Content-Type", "application/json")
.body("{\n \"reservedBy\": \"<string>\",\n \"reservedUntil\": \"2023-11-07T05:31:56Z\",\n \"couponIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"reservedBy\": \"<string>\",\n \"reservedUntil\": \"2023-11-07T05:31:56Z\",\n \"couponIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"couponIds": [
"<string>"
]
}{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Reserve coupons
Reserve coupons in order to disallow to use same coupon simultaneously.
Coupon will be reserved until the time specified in ReservedUntil.
ReservedBy specifies the system that reserved coupons.
If the reservation is not already populated (ReservedBy and ReservedUntil), new values will be set. However, if ReservedBy is already populated and the reservation is still active (ReservedUntil > CurrentTime), and a new ReservedBy value is provided in the request, an error will be returned. If the ReservedBy value matches the already populated value, the reserver can edit the reservation time and reserve more coupons.
POST
/
api
/
v1
/
customers
/
{customerId}
/
coupons
/
reserve
Reserve coupons
curl --request POST \
--url https://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve \
--header 'Content-Type: application/json' \
--data '
{
"reservedBy": "<string>",
"reservedUntil": "2023-11-07T05:31:56Z",
"couponIds": [
"<string>"
]
}
'import requests
url = "https://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve"
payload = {
"reservedBy": "<string>",
"reservedUntil": "2023-11-07T05:31:56Z",
"couponIds": ["<string>"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
reservedBy: '<string>',
reservedUntil: '2023-11-07T05:31:56Z',
couponIds: ['<string>']
})
};
fetch('https://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve', 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://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve",
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([
'reservedBy' => '<string>',
'reservedUntil' => '2023-11-07T05:31:56Z',
'couponIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve"
payload := strings.NewReader("{\n \"reservedBy\": \"<string>\",\n \"reservedUntil\": \"2023-11-07T05:31:56Z\",\n \"couponIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve")
.header("Content-Type", "application/json")
.body("{\n \"reservedBy\": \"<string>\",\n \"reservedUntil\": \"2023-11-07T05:31:56Z\",\n \"couponIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/coupon/api/v1/customers/{customerId}/coupons/reserve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"reservedBy\": \"<string>\",\n \"reservedUntil\": \"2023-11-07T05:31:56Z\",\n \"couponIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"couponIds": [
"<string>"
]
}{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Last modified on August 10, 2026
⌘I