PUT
/users-by-id/mass_update_standard_attributes/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, custom_id.
| Attributes | Type | Required | Description |
|---|---|---|---|
| ids | list(strings) | yes | List of users' custom ids (unique identifiers for the user which are provided by the client). |
| attribute | string | yes | A name of your attribute. It must a be a standard and allowed for update attribute. |
| value | depending on the attribute type | yes | A value for the attribute |
Request
- CURL
- JavaScript
- PHP
- Python
curl -X PUT -H "Authorization: Token <your_64_char_api_key>"
-H "Accept: */*; version=2" -H "Content-Type: application/json" -d '{
"ids": ['1', '5', '10', '23', '24'],
"attribute": "country",
"value": "USA"
}' "https://<your_app_subdomain>.user.com/api/public/users-by-id/mass_update_standard_attributes/"
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-by-id/mass_update_standard_attributes/");
xhr.setRequestHeader("authorization", "Token <your_64_char_api_key>");
xhr.setRequestHeader("accept", "*/*; version=2");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
<?php
$request = new HttpRequest();
$request->setUrl('https://<your_app_subdomain>.user.com/api/public/users-by-id/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-by-id/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)
Response
{
"status": "ok"
}