POST/ users/ :id/ remove_attribute/
Remove attribute
Keep in mind that you have to use full original name as an attribute name. Other names will result in 404 Not Found response and no changes in the user profile.
Attributes
Optional unless marked required
- id
- A unique identifier for the user which is given by User automatically.
- attribute
- A name of your attribute.
Request
- cURL
- JavaScript
- PHP
- Python
curl -X POST "https://<your_app_subdomain>.user.com/api/public/users/:id/remove_attribute/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2" \
-H "Content-Type: application/json" \
-d '{
"attribute": "20261110_1519_seats"
}'
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/users/:id/remove_attribute/",
{
method: "POST",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
"Content-Type": "application/json",
},
body: JSON.stringify({
attribute: "20261110_1519_seats",
}),
},
);
console.log(response.status);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/users/:id/remove_attribute/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"attribute" => "20261110_1519_seats",
]),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.post(
"https://<your_app_subdomain>.user.com/api/public/users/:id/remove_attribute/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
json={
"attribute": "20261110_1519_seats",
},
)
print(response.status_code)
Response examples
- 204 No Content
- 400 Bad Request
- 404 Not Found
No response body.
{
"errors": "Missing attribute name"
}
{
"detail": "No ClientUser matches the given query."
}
A 400 with "errors": "Missing attribute name" comes back when the body has no attribute. A 404 comes back for a contact that doesn't exist (with "detail") and for an attribute that doesn't exist (with no body). An attribute the contact has no value for answers 204.
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.