Update banned user
Update existing banned user with HTTP PUT request.
PUT
/banned-users/:id/
Parameters
Type
Description
id
integer
Unique ID of banned user
Attributes
Type
Description
banned_name
string
Domain or email to be banned
is_domain
bool
Determines if banned name is email or domain (read only)
curl -X PUT \
https://<your_app_subdomain>.user.com/api/public/banned-users/:id/ \
-H 'Authorization: Token <your_64_char_api_key>' \
-H 'Content-Type: application/json' \
-d '{
"banned_name": "test@mail.com"
}'
Response
{
"id": 36,
"banned_name": "test@mail.com",
"is_domain": false
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://<your_app_subdomain>.user.com/api/public/banned-users/:id/",
"method": "PUT",
"headers": {
"Authorization": "Token <your_64_char_api_key>",
"Content-Type": "application/json"
},
"processData": false,
"data": "{\n \"banned_name\": \"test@mail.com\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
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("PUT", "https://<your_app_subdomain>.user.com/api/public/banned-users/:id/");
xhr.setRequestHeader("Authorization", "Token <your_64_char_api_key>");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
var request = require("request");
var options = { method: 'PUT',
url: 'https://<your_app_subdomain>.user.com/api/public/banned-users/:id/',
headers:
{ 'Content-Type': 'application/json',
Authorization: 'Token <your_64_char_api_key>' },
body: { banned_name: 'test@mail.com' },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/banned-users/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "{\n \"banned_name\": \"test@mail.com\"\n}",
CURLOPT_HTTPHEADER => array(
"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/:id/"
payload = "{\n \"banned_name\": \"test@mail.com\"\n}"
headers = {
'Authorization': "Token <your_64_char_api_key>",
'Content-Type': "application/json"
}
response = requests.request("PUT", url, data=payload, headers=headers)
print(response.text)