GET/ attributes/ :id/
Get single attribute
You can return details about a contact attribute.
warning
This endpoint finds contact attributes only. Attribute IDs are numbered separately for each model, so the ID of a company, deal or other attribute returns the contact attribute that happens to have the same ID, or a 404. Use Get all attributes for other models.
Attributes
Optional unless marked required
- id
- ID of the contact attribute, from the Create attribute response.
Request
- cURL
- JavaScript
- PHP
- Python
curl -X GET "https://<your_app_subdomain>.user.com/api/public/attributes/:id/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2"
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/attributes/:id/",
{
method: "GET",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
},
},
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/attributes/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.get(
"https://<your_app_subdomain>.user.com/api/public/attributes/:id/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
)
print(response.json())
Response examples
- 200 OK
- 404 Not Found
{
"name": "My Attribute",
"id": 2511,
"content_type": "user",
"value_type": "boolean",
"name_std": "my_attribute"
}
{
"detail": "No ClientUserDynamicAttribute matches the given query."
}
The 404 comes back when no contact attribute has that ID.
Response fields
Fields returned in the 200 OK response body.
- id
- A unique identifier for the attribute which is given by User automatically.
- name
- Attribute name, as entered when it was created.
- name_std
- Standardized name used in the API and in record bodies (
Loyalty tierbecomesloyalty_tier). - value_type
- Value type of the attribute:
boolean,date,datetime,fixed,float,integer,jsonorstring. - content_type
- Always
user: the endpoint returns contact attributes only.
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.