curl --request DELETE \
--url 'https://YOURSITE.konstant.ly/openapi/v1/groups/123/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def remove_user_from_group(api_key: str, group_id: int, user_id: str) -> bool:
url = f"https://YOURSITE.konstant.ly/openapi/v1/groups/{group_id}/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.delete(url, headers=headers)
if response.status_code == 404:
raise ValueError("Group or user not found")
response.raise_for_status()
return True
# Example usage
try:
if remove_user_from_group("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", 123, "1234567890"):
print("User removed from group successfully")
except Exception as e:
print(f"Failed to remove user from group: {str(e)}")
const axios = require('axios');
async function removeUserFromGroup(apiKey, groupId, userId) {
try {
await axios.delete(
`https://YOURSITE.konstant.ly/openapi/v1/groups/${groupId}/users/${userId}`,
{
headers: { 'X-API-KEY': apiKey }
}
);
return true;
} catch (error) {
if (error.response?.status === 404) {
throw new Error('Group or user not found');
}
throw error;
}
}
// Example usage
removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, '1234567890')
.then(() => console.log('User removed from group successfully'))
.catch(error => console.error('Failed:', error.message));
<?php
function removeUserFromGroup($apiKey, $groupId, $userId) {
$ch = curl_init();
$url = "https://YOURSITE.konstant.ly/openapi/v1/groups/{$groupId}/users/{$userId}";
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-KEY: ' . $apiKey
]
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
throw new Exception('Error: ' . curl_error($ch));
}
curl_close($ch);
if ($httpCode === 404) {
throw new Exception("Group or user not found");
}
return $httpCode === 200;
}
// Example usage
try {
if (removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, '1234567890')) {
echo "User removed from group successfully\n";
}
} catch (Exception $e) {
echo "Failed to remove user from group: " . $e->getMessage() . "\n";
}
?>
{}
{
"status": 404,
"message": "Not found"
}
Groups
Remove User from Group
Remove a user from a group
DELETE
/
groups
/
{groupId}
/
users
/
{userId}
curl --request DELETE \
--url 'https://YOURSITE.konstant.ly/openapi/v1/groups/123/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def remove_user_from_group(api_key: str, group_id: int, user_id: str) -> bool:
url = f"https://YOURSITE.konstant.ly/openapi/v1/groups/{group_id}/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.delete(url, headers=headers)
if response.status_code == 404:
raise ValueError("Group or user not found")
response.raise_for_status()
return True
# Example usage
try:
if remove_user_from_group("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", 123, "1234567890"):
print("User removed from group successfully")
except Exception as e:
print(f"Failed to remove user from group: {str(e)}")
const axios = require('axios');
async function removeUserFromGroup(apiKey, groupId, userId) {
try {
await axios.delete(
`https://YOURSITE.konstant.ly/openapi/v1/groups/${groupId}/users/${userId}`,
{
headers: { 'X-API-KEY': apiKey }
}
);
return true;
} catch (error) {
if (error.response?.status === 404) {
throw new Error('Group or user not found');
}
throw error;
}
}
// Example usage
removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, '1234567890')
.then(() => console.log('User removed from group successfully'))
.catch(error => console.error('Failed:', error.message));
<?php
function removeUserFromGroup($apiKey, $groupId, $userId) {
$ch = curl_init();
$url = "https://YOURSITE.konstant.ly/openapi/v1/groups/{$groupId}/users/{$userId}";
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-KEY: ' . $apiKey
]
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
throw new Exception('Error: ' . curl_error($ch));
}
curl_close($ch);
if ($httpCode === 404) {
throw new Exception("Group or user not found");
}
return $httpCode === 200;
}
// Example usage
try {
if (removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, '1234567890')) {
echo "User removed from group successfully\n";
}
} catch (Exception $e) {
echo "Failed to remove user from group: " . $e->getMessage() . "\n";
}
?>
{}
{
"status": 404,
"message": "Not found"
}
Remove a specific user from a group.
Request Headers
API Key. Go to your Konstantly site > Settings > API and copy the value from there.
URL Parameters
The unique identifier of the group
User API ID to remove from the group
Response
Returns an empty response on success.Error Responses
curl --request DELETE \
--url 'https://YOURSITE.konstant.ly/openapi/v1/groups/123/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def remove_user_from_group(api_key: str, group_id: int, user_id: str) -> bool:
url = f"https://YOURSITE.konstant.ly/openapi/v1/groups/{group_id}/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.delete(url, headers=headers)
if response.status_code == 404:
raise ValueError("Group or user not found")
response.raise_for_status()
return True
# Example usage
try:
if remove_user_from_group("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", 123, "1234567890"):
print("User removed from group successfully")
except Exception as e:
print(f"Failed to remove user from group: {str(e)}")
const axios = require('axios');
async function removeUserFromGroup(apiKey, groupId, userId) {
try {
await axios.delete(
`https://YOURSITE.konstant.ly/openapi/v1/groups/${groupId}/users/${userId}`,
{
headers: { 'X-API-KEY': apiKey }
}
);
return true;
} catch (error) {
if (error.response?.status === 404) {
throw new Error('Group or user not found');
}
throw error;
}
}
// Example usage
removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, '1234567890')
.then(() => console.log('User removed from group successfully'))
.catch(error => console.error('Failed:', error.message));
<?php
function removeUserFromGroup($apiKey, $groupId, $userId) {
$ch = curl_init();
$url = "https://YOURSITE.konstant.ly/openapi/v1/groups/{$groupId}/users/{$userId}";
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-KEY: ' . $apiKey
]
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
throw new Exception('Error: ' . curl_error($ch));
}
curl_close($ch);
if ($httpCode === 404) {
throw new Exception("Group or user not found");
}
return $httpCode === 200;
}
// Example usage
try {
if (removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, '1234567890')) {
echo "User removed from group successfully\n";
}
} catch (Exception $e) {
echo "Failed to remove user from group: " . $e->getMessage() . "\n";
}
?>
{}
{
"status": 404,
"message": "Not found"
}
Was this page helpful?
⌘I