Invalidate a coupon code
1 min
POST
https://api.campaign.episerver.net/rest/{clientId}/couponblocks/{couponBlockId}/codes/{code}
Path Parameters
- clientIdinteger<int64>requiredDescriptionFormatint64
- codestringrequiredDescription
- couponBlockIdinteger<int64>requiredDescriptionFormatint64
Header Parameters
- acceptstringDescriptionDefaultapplication/jsonAllowedapplication/jsonapplication/vnd.optivo.broadmail.v1+json
Responses
200
- RestCouponCode
- codestringDescription
- assignedMailinginteger<int64>DescriptionFormatint64
- assignedRecipientstringDescription
- assignedbooleanDescription
- usedbooleanDescription
- createdstring<date-time>DescriptionFormatdate-time
- modifiedstring<date-time>DescriptionFormatdate-time
- linksobject[]Description
- uriBuilderobject
- relsstring[]
- relstring
- typestring
- paramsmap<string, string>
- titlestring
- uristring<uri>Formaturi
404
409
curl
curl --request POST \
--url https://api.campaign.episerver.net/rest/{clientId}/couponblocks/{couponBlockId}/codes/{code} \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.campaign.episerver.net/rest/{clientId}/couponblocks/{couponBlockId}/codes/{code}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.campaign.episerver.net/rest/{clientId}/couponblocks/{couponBlockId}/codes/{code}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.campaign.episerver.net/rest/{clientId}/couponblocks/{couponBlockId}/codes/{code}"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// The coupon code was invalidated successfully.
{
"code": "",
"assignedMailing": "",
"assignedRecipient": "",
"assigned": false,
"used": false,
"created": "",
"modified": "",
"links": [
{
"uriBuilder": {},
"rels": [
""
],
"rel": "",
"type": "",
"params": "",
"title": "",
"uri": ""
}
]
}404
// The coupon code could not be found. Ensure that the required parameters such as "couponBlockId" are correct and the coupon code exists.
409
// The coupon code is not assigned to the indicated client. Ensure that "clientId" and the coupon code are correct and that the "couponBlockId" is assigned to the indicated client.