curl --request GET \
--url 'https://YOURSITE.konstant.ly/openapi/v1/custom/attributes/users' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
from typing import List, Dict, Any
def get_user_attributes(api_key: str) -> List[Dict[str, Any]]:
url = "https://YOURSITE.konstant.ly/openapi/v1/custom/attributes/users"
headers = {"X-API-KEY": api_key}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
# Example usage
try:
attributes = get_user_attributes("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv")
for attr in attributes:
print(f"Attribute: {attr['name']}")
print(f"Type: {attr['type']}")
print(f"Required: {attr['isRequired']}")
if attr['extraData']:
print("Options:")
for option in attr['extraData']:
print(f" - {option['value']}")
print("---")
except Exception as e:
print(f"Error fetching user attributes: {str(e)}")
const axios = require('axios');
async function getUserAttributes(apiKey) {
try {
const response = await axios.get(
'https://YOURSITE.konstant.ly/openapi/v1/custom/attributes/users',
{
headers: {
'X-API-KEY': apiKey
}
}
);
return response.data;
} catch (error) {
console.error('Error fetching user attributes:', error.message);
throw error;
}
}
// Example usage
getUserAttributes('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv')
.then(attributes => {
attributes.forEach(attr => {
console.log(`Attribute: ${attr.name}`);
console.log(`Type: ${attr.type}`);
console.log(`Required: ${attr.isRequired}`);
if (attr.extraData?.length) {
console.log('Options:');
attr.extraData.forEach(option => {
console.log(` - ${option.value}`);
});
}
console.log('---');
});
})
.catch(error => console.error('Error:', error.message));
[
{
"id": 1,
"name": "Department",
"type": 3,
"apiId": "department",
"position": 1,
"isRequired": true,
"extraData": [
{
"id": 1,
"position": 1,
"value": "Sales"
},
{
"id": 2,
"position": 2,
"value": "Marketing"
},
{
"id": 3,
"position": 3,
"value": "Engineering"
}
],
"isEditable": true
},
{
"id": 2,
"name": "Employee ID",
"type": 1,
"apiId": "employee_id",
"position": 2,
"isRequired": true,
"extraData": null,
"isEditable": true
}
]
Custom Attributes
Get User Custom Attributes
Get a list of custom user attributes
GET
/
custom
/
attributes
/
users
curl --request GET \
--url 'https://YOURSITE.konstant.ly/openapi/v1/custom/attributes/users' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
from typing import List, Dict, Any
def get_user_attributes(api_key: str) -> List[Dict[str, Any]]:
url = "https://YOURSITE.konstant.ly/openapi/v1/custom/attributes/users"
headers = {"X-API-KEY": api_key}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
# Example usage
try:
attributes = get_user_attributes("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv")
for attr in attributes:
print(f"Attribute: {attr['name']}")
print(f"Type: {attr['type']}")
print(f"Required: {attr['isRequired']}")
if attr['extraData']:
print("Options:")
for option in attr['extraData']:
print(f" - {option['value']}")
print("---")
except Exception as e:
print(f"Error fetching user attributes: {str(e)}")
const axios = require('axios');
async function getUserAttributes(apiKey) {
try {
const response = await axios.get(
'https://YOURSITE.konstant.ly/openapi/v1/custom/attributes/users',
{
headers: {
'X-API-KEY': apiKey
}
}
);
return response.data;
} catch (error) {
console.error('Error fetching user attributes:', error.message);
throw error;
}
}
// Example usage
getUserAttributes('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv')
.then(attributes => {
attributes.forEach(attr => {
console.log(`Attribute: ${attr.name}`);
console.log(`Type: ${attr.type}`);
console.log(`Required: ${attr.isRequired}`);
if (attr.extraData?.length) {
console.log('Options:');
attr.extraData.forEach(option => {
console.log(` - ${option.value}`);
});
}
console.log('---');
});
})
.catch(error => console.error('Error:', error.message));
[
{
"id": 1,
"name": "Department",
"type": 3,
"apiId": "department",
"position": 1,
"isRequired": true,
"extraData": [
{
"id": 1,
"position": 1,
"value": "Sales"
},
{
"id": 2,
"position": 2,
"value": "Marketing"
},
{
"id": 3,
"position": 3,
"value": "Engineering"
}
],
"isEditable": true
},
{
"id": 2,
"name": "Employee ID",
"type": 1,
"apiId": "employee_id",
"position": 2,
"isRequired": true,
"extraData": null,
"isEditable": true
}
]
Retrieve all custom attributes configured for users on your platform.
Request Headers
API Key. Go to your Konstantly site > Settings > API and copy the value from there.
Response
Array of custom attribute objects with the following properties:Attribute ID
Attribute name
Attribute type:
- 1: text
- 2: date
- 3: single choice
- 4: multiple choice
- 5: user choice
- 6: yes/no
- 7: external link
- 8: number
Attribute API identifier
Display position order
Whether the attribute is mandatory
Whether the attribute can be modified
curl --request GET \
--url 'https://YOURSITE.konstant.ly/openapi/v1/custom/attributes/users' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
from typing import List, Dict, Any
def get_user_attributes(api_key: str) -> List[Dict[str, Any]]:
url = "https://YOURSITE.konstant.ly/openapi/v1/custom/attributes/users"
headers = {"X-API-KEY": api_key}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
# Example usage
try:
attributes = get_user_attributes("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv")
for attr in attributes:
print(f"Attribute: {attr['name']}")
print(f"Type: {attr['type']}")
print(f"Required: {attr['isRequired']}")
if attr['extraData']:
print("Options:")
for option in attr['extraData']:
print(f" - {option['value']}")
print("---")
except Exception as e:
print(f"Error fetching user attributes: {str(e)}")
const axios = require('axios');
async function getUserAttributes(apiKey) {
try {
const response = await axios.get(
'https://YOURSITE.konstant.ly/openapi/v1/custom/attributes/users',
{
headers: {
'X-API-KEY': apiKey
}
}
);
return response.data;
} catch (error) {
console.error('Error fetching user attributes:', error.message);
throw error;
}
}
// Example usage
getUserAttributes('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv')
.then(attributes => {
attributes.forEach(attr => {
console.log(`Attribute: ${attr.name}`);
console.log(`Type: ${attr.type}`);
console.log(`Required: ${attr.isRequired}`);
if (attr.extraData?.length) {
console.log('Options:');
attr.extraData.forEach(option => {
console.log(` - ${option.value}`);
});
}
console.log('---');
});
})
.catch(error => console.error('Error:', error.message));
[
{
"id": 1,
"name": "Department",
"type": 3,
"apiId": "department",
"position": 1,
"isRequired": true,
"extraData": [
{
"id": 1,
"position": 1,
"value": "Sales"
},
{
"id": 2,
"position": 2,
"value": "Marketing"
},
{
"id": 3,
"position": 3,
"value": "Engineering"
}
],
"isEditable": true
},
{
"id": 2,
"name": "Employee ID",
"type": 1,
"apiId": "employee_id",
"position": 2,
"isRequired": true,
"extraData": null,
"isEditable": true
}
]
Was this page helpful?
⌘I