curl --request PATCH \
--url 'https://YOURSITE.konstant.ly/openapi/v1/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv' \
--header 'Content-Type: application/json' \
--data '{
"email": "j.wunderliebb@mycompany.tld",
"bio": "An updated information about me: I'\''ve transferred to London!",
"occupation": "Associate",
"location": "London",
"timezone": "Europe/London"
}'
import requests
def update_user(api_key: str, user_id: str, update_data: dict) -> None:
url = f"https://YOURSITE.konstant.ly/openapi/v1/users/{user_id}"
headers = {
"X-API-KEY": api_key,
"Content-Type": "application/json"
}
response = requests.patch(url, headers=headers, json=update_data)
if response.status_code == 400:
error_data = response.json()
print("Validation errors:")
for field, errors in error_data.get('errors', {}).items():
print(f"{field}: {', '.join(errors)}")
raise ValueError(error_data.get('message', 'Invalid request'))
if response.status_code == 404:
raise ValueError(f"User {user_id} not found")
response.raise_for_status()
# Example usage
update_data = {
"email": "j.wunderliebb@mycompany.tld",
"bio": "An updated information about me: I've transferred to London!",
"occupation": "Associate",
"location": "London",
"timezone": "Europe/London"
}
try:
update_user("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", "1234567890", update_data)
print("User updated successfully")
except Exception as e:
print(f"Failed to update user: {str(e)}")
const axios = require('axios');
async function updateUser(apiKey, userId, updateData) {
try {
await axios.patch(
`https://YOURSITE.konstant.ly/openapi/v1/users/${userId}`,
updateData,
{
headers: {
'X-API-KEY': apiKey,
'Content-Type': 'application/json'
}
}
);
} catch (error) {
if (error.response?.status === 400) {
console.error('Validation errors:');
const errors = error.response.data.errors || {};
Object.entries(errors).forEach(([field, messages]) => {
console.error(`${field}: ${messages.join(', ')}`);
});
throw new Error(error.response.data.message || 'Invalid request');
}
if (error.response?.status === 404) {
throw new Error(`User ${userId} not found`);
}
throw error;
}
}
// Example usage
const updateData = {
email: "j.wunderliebb@mycompany.tld",
bio: "An updated information about me: I've transferred to London!",
occupation: "Associate",
location: "London",
timezone: "Europe/London"
};
updateUser('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', '1234567890', updateData)
.then(() => console.log('User updated successfully'))
.catch(error => console.error('Failed to update user:', error.message));
{
"status": 400,
"message": "Validation failed",
"errors": {
"email": ["Invalid email format"]
}
}
{
"status": 404,
"message": "Not found"
}
Users
Update User
Edit user’s personal information
PATCH
/
users
/
{userId}
curl --request PATCH \
--url 'https://YOURSITE.konstant.ly/openapi/v1/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv' \
--header 'Content-Type: application/json' \
--data '{
"email": "j.wunderliebb@mycompany.tld",
"bio": "An updated information about me: I'\''ve transferred to London!",
"occupation": "Associate",
"location": "London",
"timezone": "Europe/London"
}'
import requests
def update_user(api_key: str, user_id: str, update_data: dict) -> None:
url = f"https://YOURSITE.konstant.ly/openapi/v1/users/{user_id}"
headers = {
"X-API-KEY": api_key,
"Content-Type": "application/json"
}
response = requests.patch(url, headers=headers, json=update_data)
if response.status_code == 400:
error_data = response.json()
print("Validation errors:")
for field, errors in error_data.get('errors', {}).items():
print(f"{field}: {', '.join(errors)}")
raise ValueError(error_data.get('message', 'Invalid request'))
if response.status_code == 404:
raise ValueError(f"User {user_id} not found")
response.raise_for_status()
# Example usage
update_data = {
"email": "j.wunderliebb@mycompany.tld",
"bio": "An updated information about me: I've transferred to London!",
"occupation": "Associate",
"location": "London",
"timezone": "Europe/London"
}
try:
update_user("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", "1234567890", update_data)
print("User updated successfully")
except Exception as e:
print(f"Failed to update user: {str(e)}")
const axios = require('axios');
async function updateUser(apiKey, userId, updateData) {
try {
await axios.patch(
`https://YOURSITE.konstant.ly/openapi/v1/users/${userId}`,
updateData,
{
headers: {
'X-API-KEY': apiKey,
'Content-Type': 'application/json'
}
}
);
} catch (error) {
if (error.response?.status === 400) {
console.error('Validation errors:');
const errors = error.response.data.errors || {};
Object.entries(errors).forEach(([field, messages]) => {
console.error(`${field}: ${messages.join(', ')}`);
});
throw new Error(error.response.data.message || 'Invalid request');
}
if (error.response?.status === 404) {
throw new Error(`User ${userId} not found`);
}
throw error;
}
}
// Example usage
const updateData = {
email: "j.wunderliebb@mycompany.tld",
bio: "An updated information about me: I've transferred to London!",
occupation: "Associate",
location: "London",
timezone: "Europe/London"
};
updateUser('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', '1234567890', updateData)
.then(() => console.log('User updated successfully'))
.catch(error => console.error('Failed to update user:', error.message));
{
"status": 400,
"message": "Validation failed",
"errors": {
"email": ["Invalid email format"]
}
}
{
"status": 404,
"message": "Not found"
}
Update an existing user’s information.
Request Headers
string
required
API Key. Go to your Konstantly site > Settings > API and copy the value from there.
URL Parameters
string
required
User API ID
Request Body
string
required
User’s email address (must be unique)
string
Full name of the user (only if changing)
string
User password (only if changing)
string
Role alias or identifier (only if changing)
string
Optional bio description
string
Optional job title (only if changing)
string
Optional location (only if changing)
string
Timezone in TZ format (only if changing)
boolean
API management flag (only if changing)
object
Complete set of custom user attributes (overwrites current values)
Response
On success, returns HTTP 200 status code.Error Responses
object
object
curl --request PATCH \
--url 'https://YOURSITE.konstant.ly/openapi/v1/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv' \
--header 'Content-Type: application/json' \
--data '{
"email": "j.wunderliebb@mycompany.tld",
"bio": "An updated information about me: I'\''ve transferred to London!",
"occupation": "Associate",
"location": "London",
"timezone": "Europe/London"
}'
import requests
def update_user(api_key: str, user_id: str, update_data: dict) -> None:
url = f"https://YOURSITE.konstant.ly/openapi/v1/users/{user_id}"
headers = {
"X-API-KEY": api_key,
"Content-Type": "application/json"
}
response = requests.patch(url, headers=headers, json=update_data)
if response.status_code == 400:
error_data = response.json()
print("Validation errors:")
for field, errors in error_data.get('errors', {}).items():
print(f"{field}: {', '.join(errors)}")
raise ValueError(error_data.get('message', 'Invalid request'))
if response.status_code == 404:
raise ValueError(f"User {user_id} not found")
response.raise_for_status()
# Example usage
update_data = {
"email": "j.wunderliebb@mycompany.tld",
"bio": "An updated information about me: I've transferred to London!",
"occupation": "Associate",
"location": "London",
"timezone": "Europe/London"
}
try:
update_user("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", "1234567890", update_data)
print("User updated successfully")
except Exception as e:
print(f"Failed to update user: {str(e)}")
const axios = require('axios');
async function updateUser(apiKey, userId, updateData) {
try {
await axios.patch(
`https://YOURSITE.konstant.ly/openapi/v1/users/${userId}`,
updateData,
{
headers: {
'X-API-KEY': apiKey,
'Content-Type': 'application/json'
}
}
);
} catch (error) {
if (error.response?.status === 400) {
console.error('Validation errors:');
const errors = error.response.data.errors || {};
Object.entries(errors).forEach(([field, messages]) => {
console.error(`${field}: ${messages.join(', ')}`);
});
throw new Error(error.response.data.message || 'Invalid request');
}
if (error.response?.status === 404) {
throw new Error(`User ${userId} not found`);
}
throw error;
}
}
// Example usage
const updateData = {
email: "j.wunderliebb@mycompany.tld",
bio: "An updated information about me: I've transferred to London!",
occupation: "Associate",
location: "London",
timezone: "Europe/London"
};
updateUser('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', '1234567890', updateData)
.then(() => console.log('User updated successfully'))
.catch(error => console.error('Failed to update user:', error.message));
{
"status": 400,
"message": "Validation failed",
"errors": {
"email": ["Invalid email format"]
}
}
{
"status": 404,
"message": "Not found"
}
Was this page helpful?
⌘I