This method cancels all messages scheduled for a future time or date. It has no effect on messages that have already been sent or queued.
Endpoint
POST:https://messaging.esendex.us/messaging.svc/CancelAllMessages
GET:https://messaging.esendex.us/messaging.svc/CancelAllMessages?LicenseKey={LICENSEKEY}
Syntax
CancelAllMessages(LicenseKey)
Request Parameters
Parameter Name | Description | Data Type | Required | Sample Value |
---|---|---|---|---|
LicenseKey | Your license key. | GUID | True | 00000000-0000-0000-0000-000000000000 |
Response
Returns: Boolean
Description: Whether the cancellation was successful or not.
Code Samples
You can use any programming language you want with our API, as long as it can make a REST or SOAP call. Here are examples for some of the most common platforms.
C#
// https://messaging.esendex.us/Messaging.svc?wsdl was added as a Service Reference and given the name WSDL
using WSDL;
var client = new MessagingClient(MessagingClient.EndpointConfiguration.mms2wsHttpBindingSecure);
var success = await client.CancelAllMessagesAsync(YOUR_LICENSE_KEY);
Console.WriteLine("Messages cancelled: " + success);
JavaScript
const url = 'https://messaging.esendex.us/Messaging.svc/CancelAllMessages';
const response = await fetch(url, {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: '00000000-0000-0000-0000-000000000000',
method: 'POST'
});
const success = await response.json();
console.log(success);
JSON POST Request
"1627aea5-8e0a-4371-9022-9b504344e724"
JSON Response
true
Python
import httpx
headers = {"Accept": "application/json"}
url = "https://messaging.esendex.us/Messaging.svc/CancelAllMessages"
request = "00000000-0000-0000-0000-000000000000"
with httpx.Client(headers=headers) as client:
response = client.post(url=url, json=request)
response.raise_for_status()
print(response.json())
Ruby
require 'json'
require 'net/http'
headers = { Accept: 'application/json', 'Content-Type': 'application/json' }
uri = URI('https://messaging.esendex.us/Messaging.svc/CancelAllMessages')
data = '00000000-0000-0000-0000-000000000000'
response = Net::HTTP.post(uri, data, headers)
raise response.message if response.is_a?(Net::HTTPClientError) || response.is_a?(Net::HTTPServerError)
puts JSON.parse(response.body)
XML POST Request
<guid xmlns="http://schemas.microsoft.com/2003/10/Serialization/">1627aea5-8e0a-4371-9022-9b504344e724</guid>
XML Response
<boolean xmlns="http://schemas.microsoft.com/2003/10/Serialization/">true</boolean>