Filter user by using custom attributes
Long awaited feature to filter users by their custom attributes
GET
/users/search/?custom_attr__gte=10
Attributes
Type
Description
custom_attr
string
name of your custom attribute
Lookups
Works with
Description
__lte
integer
less or equal than
__lt
integer
less than
__gte
integer
greater or equal than
__gt
integer
greater than
__startswith
string
value of given attribute starts with (case sensitive)
__istartswith
string
value of given attribute starts with (case insensitive)
__endswith
string
value of given attribute ends with (case sensitive)
__iendswith
string
value of given attribute ends with (case insensitive)
__contains
string
value of given attribute contains string (case insensitive)
__icontains
string
value of given attribute contains string (case insensitive)
curl -X GET -H "Authorization: Token <your_64_char_api_key>" "https://<your_app_subdomain>.user.com/api/public/users/search/?custom_attr__gte=10"
Example response
{
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": 41762938,
"key": "KSkZrYtUZ0PW",
"name": John,
"email": Doe,
"gender": "unknown",
"status": "vistor",
"phone_number": null,
"first_seen": "2017-09-22T12:08:28.490534Z",
"last_seen": "2017-09-22T12:08:28.500483Z",
"page_views": 1,
"last_ip": "213.216.69.162",
"timezone": "Europe/Kaliningrad",
"city": null,
"region": null,
"country": "Poland",
"unsubscribed": false,
"browser_language": "pl",
"score": 0,
"browser": "Opera",
"os_type": "Linux",
"resolution": "1920x1080",
"created_at": "2017-09-22T12:08:28.502834Z",
"updated_at": "2017-09-25T13:10:34.616559Z",
"attributes": [
{
"name_std": "ordered_items",
"name": "ordered_items",
"value": 11,
"id": 248806
}
],
"gravatar_url": null,
"lists": [],
"tags": [],
"notifications": true,
"facebook_url": null,
"linkedin_url": null,
"twitter_url": null,
"google_url": null,
"chat_id": "Chat ID is deprecated and will be removed in future",
"last_contacted": null,
"user_id": null
},
{
"id": 41757460,
"key": "4oiw2fRWyVSs",
"name": Jane,
"email": Doe,
"gender": "unknown",
"status": "vistor",
"phone_number": null,
"first_seen": "2017-09-22T11:41:25.312941Z",
"last_seen": "2017-09-22T11:41:25.331167Z",
"page_views": 1,
"last_ip": "213.216.69.162",
"timezone": "Europe/Kaliningrad",
"city": null,
"region": null,
"country": "Poland",
"unsubscribed": false,
"browser_language": "pl",
"score": 0,
"browser": "Opera",
"os_type": "Linux",
"resolution": "1920x1080",
"created_at": "2017-09-22T11:41:25.334508Z",
"updated_at": "2017-09-25T13:10:49.155165Z",
"attributes": [
{
"name_std": "ordered_items",
"name": "ordered_items",
"value": 17,
"id": 248806
}
],
"gravatar_url": null,
"lists": [],
"tags": [],
"notifications": true,
"facebook_url": null,
"linkedin_url": null,
"twitter_url": null,
"google_url": null,
"chat_id": "Chat ID is deprecated and will be removed in future",
"last_contacted": null,
"user_id": null
},
{
"id": 41742710,
"key": "SvepkkkqXykw",
"name": John Junior,
"email": Doe,
"gender": "unknown",
"status": "vistor",
"phone_number": null,
"first_seen": "2017-09-22T10:31:39.473347Z",
"last_seen": "2017-09-22T10:31:39.495327Z",
"page_views": 1,
"last_ip": "213.216.69.162",
"timezone": "Europe/Kaliningrad",
"city": null,
"region": null,
"country": "Poland",
"unsubscribed": false,
"browser_language": "pl",
"score": 0,
"browser": "Opera",
"os_type": "Linux",
"resolution": "1920x1080",
"created_at": "2017-09-22T10:31:39.498994Z",
"updated_at": "2017-09-25T13:10:59.566249Z",
"attributes": [
{
"name_std": "ordered_items",
"name": "ordered_items",
"value": 10,
"id": 248806
}
],
"gravatar_url": null,
"lists": [],
"tags": [],
"notifications": true,
"facebook_url": null,
"linkedin_url": null,
"twitter_url": null,
"google_url": null,
"chat_id": "Chat ID is deprecated and will be removed in future",
"last_contacted": null,
"user_id": null
}
]
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://<your_app_subdomain>.user.com/api/public/users/search/?custom_attr__gte=10",
"method": "GET",
"headers": {
"authorization": "Token <your_64_char_api_key>"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://<your_app_subdomain>.user.com/api/public/users/search/?custom_attr__gte=10");
xhr.setRequestHeader("authorization", "Token <your_64_char_api_key>");
xhr.send(data);
var request = require("request");
var options = { method: 'GET',
url: 'https://<your_app_subdomain>.user.com/api/public/users/search/',
qs: { custom_attr__gte: '10' },
headers: { authorization: 'Token <your_64_char_api_key>' } };
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/users/search/?custom_attr__gte=10",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"authorization: Token <your_64_char_api_key>"
),
));
$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/users/search/"
querystring = {"custom_attr__gte":"10"}
headers = {'authorization': 'Token <your_64_char_api_key>'}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
import http.client
conn = http.client.HTTPSConnection("<your_app_subdomain>.user.com")
headers = { 'authorization': "Token <your_64_char_api_key>" }
conn.request("GET", "/api/public/users/search/?custom_attr__gte=10", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))