The createQrCodeHandler creates a qr code for the input body and returns the reponse to users
curl -X DELETE
"https://divsly-backend.vercel.app/api/v1/profile/delete-user/123" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const deleteUser = (userId) => {
return fetch(`https://divsly-backend.vercel.app/api/v1/profile/delete-user/${userId}`, {
method: 'DELETE',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
})
.then(response => response.json())
.catch(error => {
console.error('Error:', error);
throw error; // Ensure errors propagate to the caller
});
};
const axios = require('axios');
const deleteUser = (userId) => {
return axios.delete(`https://divsly-backend.vercel.app/api/v1/profile/delete-user/${userId}`, {
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
})
.then(response => response.data)
.catch(error => {
console.error('Error:', error.response?.data || error.message);
throw error; // Ensure errors propagate to the caller
});
};
$$userId = 123;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://divsly-backend.vercel.app/api/v1/profile/delete-user/" . $userId);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer YOUR_ACCESS_TOKEN'
));
# Python Requests
import requests
def delete_user(user_id, access_token):
url = f"https://divsly-backend.vercel.app/api/v1/profile/delete-user/{user_id}"
headers = {
"Authorization": f"Bearer {access_token}"
}
response = requests.delete(url, headers=headers)
return response.json()
{
"error": false,
"data": {
// Deleted user data from deleteProfileQuery
"id": 123,
"email": "user@example.com",
// ... other user fields returned by Prisma
}
}
{
"data": {
"message": "Unauthorized",
}
}
{
"data": {
"message": "Forbidden Access!",
}
}
{
"error": true,
"message": “Error deleting user”
}