Mass update standard attributes


HTTP PUT request enabling you to update chosen standard attribute for users in bulk.

Allowed attributes: assigned_to, city, company_id, country, email, facebook_url, first_name, gender, google_url, gravatar_url, last_name, linkedin_url, notifications, phone_number, region, score, status, timezone, twitter_url, unsubscribed, user_id.

If you want to update mass custom attributes use Mass update custom attributes.

PUT

/users/mass_update_standard_attributes/

Data
Type
Description
ids
list
List of users' id (integers)
attribute
string
The name of your attribute. It must a be a standard and allowed for update attribute.
value
string
Value for the attribute
curl -X PUT -H "Authorization: Token <your_64_char_api_key>" -H "Content-Type: application/json" -d '{
    "ids": [10, 15, 22, 23],
    "attribute": "country",
    "value": "USA"
}' "https://<your_app_subdomain>.user.com/api/public/users/mass_update_standard_attributes/"

Response

{
    "status": "ok"
}
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://<your_app_subdomain>.user.com/api/public/users/mass_update_standard_attributes/",
  "method": "PUT",
  "headers": {
    "authorization": "Token <your_64_char_api_key>",
    "content-type": "application/json"
  },
  "processData": false,
  "data": "{\n  \"ids\": [5, 10, 15, 23, 24],\n  \"attribute\": \"country\",\n  \"value\": "USA"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
var data = JSON.stringify({
  "ids": [1, 5, 10, 23, 24],
  "attribute": "country",
  "value": "USA"
});

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/users/mass_update_standard_attributes/");
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/users/mass_update_standard_attributes/',
  headers:
   { 'content-type': 'application/json',
     authorization: 'Token <your_64_char_api_key>' },
  body:
   {
     ids: [1, 5, 10, 23, 24],
     attribute: "country",
     value: "USA"},
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
<?php

$request = new HttpRequest();
$request->setUrl('https://<your_app_subdomain>.user.com/api/public/users/mass_update_standard_attributes/');
$request->setMethod(HTTP_METH_PUT);

$request->setHeaders(array(
  'content-type' => 'application/json',
  'authorization' => 'Token <your_64_char_api_key>'
));

$request->setBody('{
  "ids": [1, 5, 10, 23, 24],
  "attributes": "country",
  "value": "USA"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
import requests

url = "https://<your_app_subdomain>.user.com/api/public/users/mass_update_standard_attributes/"

payload = "{\n  \"ids\": [1, 5, 10, 23, 24],\n  \"attribute\": \"country\",\n  \"value\": \"USA\"\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)