Create list


Lists are similar to tags, you can group people with them.

Group your users with lists, this will allow you to easily send email campaigns to certain group of users, or filter them using Lists attribute.

POST

/lists/

Data
Type
Description
name
string
The name of a list you want to create
description:
string
Description of a list you want to create
curl -X POST -H "Authorization: Token :token" -H "Content-Type: application/json" -d '{
    "name": "New List",
    "description": "This is description for this list",
    "client": 3577959,
    "timestamp": 1472736404
}' "https://app.userengage.com/api/public/lists/"

Response

{
  "description": "This is description for this list",
  "name": "New List",
  "id": 1723
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://app.userengage.com/api/public/lists/",
  "method": "POST",
  "headers": {
    "authorization": "Token :token",
    "content-type": "application/json"
  },
  "processData": false,
  "data": "{ \n    \"name\": \"New List\",\n    \"description\": \"This is description for this list\",\n    \"client\": 3577959,\n    \"timestamp\": 1472736404\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
var data = JSON.stringify({
  "name": "New List",
  "description": "This is description for this list",
  "client": 3577959,
  "timestamp": 1472736404
});

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/lists/");
xhr.setRequestHeader("authorization", "Token :token");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "app.userengage.com",
  "port": null,
  "path": "/api/public/lists/",
  "headers": {
    "authorization": "Token :token",
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ name: 'New List',
  description: 'This is description for this list',
  client: 3577959,
  timestamp: 1472736404 }));
req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://app.userengage.com/api/public/lists/",
  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    \"name\": \"New List\",\n    \"description\": \"This is description for this list\",\n    \"client\": 3577959,\n    \"timestamp\": 1472736404\n}",
  CURLOPT_HTTPHEADER => array(
    "authorization: Token :token",
    "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/lists/"

payload = "{ \n    \"name\": \"New List\",\n    \"description\": \"This is description for this list\",\n    \"client\": 3577959,\n    \"timestamp\": 1472736404\n}"
headers = {
    'authorization': "Token :token",
    'content-type': "application/json"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
import http.client

conn = http.client.HTTPSConnection("app.userengage.com")

payload = "{ \n    \"name\": \"New List\",\n    \"description\": \"This is description for this list\",\n    \"client\": 3577959,\n    \"timestamp\": 1472736404\n}"

headers = {
    'authorization': "Token :token",
    'content-type': "application/json"
    }

conn.request("POST", "/api/public/lists/", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))