Add banned user


Create new banned user with HTTP POST request.

POST

/banned-users/

Data
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 POST \
  https://app.userengage.com/api/public/banned-users/ \
  -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://app.userengage.com/api/public/banned-users/",
  "method": "POST",
  "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("POST", "https://app.userengage.com/api/public/banned-users/");
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: 'POST',
  url: 'https://app.userengage.com/api/public/banned-users/',
  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://app.userengage.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(
    "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://app.userengage.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)