POST
/banned-users/Add banned email or domain
You can ban a specific email or domain. It results in stopped sending to defined users.
| Attributes | Type | Required | Description |
|---|---|---|---|
| banned_name | string | yes | A list of banned emails. |
| is_domain | boolean | no | A flag that determines if banned name is email or domain. |
Request
- CURL
- JavaScript
- PHP
- Python
curl -X POST
"https://<your_app_subdomain>.user.com/api/public/banned-users/"
-H 'Authorization: Token <your_64_char_api_key>'
-H 'Content-Type: application/json'
-H "Accept: */*; version=2"
-d '{ "banned_name": "test@mail.com"}'
var data = JSON.stringify({
"banned_name": "test@mail.com"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://<your_app_subdomain>.user.com/api/public/banned-users/");
xhr.setRequestHeader("Authorization", "Token <your_64_char_api_key>");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/banned-users/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"banned_name\": \"test@mail.com\"\n}",
CURLOPT_HTTPHEADER => array(
"Accept: */*; version=2",
"Authorization: Token \<your_64_char_api_key>",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://<your_app_subdomain>.user.com/api/public/banned-users/"
payload = "{\n \"banned_name\": \"test@mail.com\"\n}"
headers = {
'Authorization': "Token <your_64_char_api_key>",
'Content-Type': "application/json"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
Response
{
"id": 36,
"banned_name": "test@mail.com",
"is_domain": false
}