Hi!
I am building a script to bulk-handle the deprovisioning from our company Jira platform (using Python and REST API).
Using the 'Delete User' API from the REST API library I receive an error to say 'the user cannot be deleted as they have created issues and their records would be lots etc etc'
ref: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-post
When I use the 'disable user' option from the User Management API, which I'm told requires the same level of access (Site admin privliges and an API token), I receive "{"code":401,"message":"Unauthorized"}"
I think it's just this bit i need to get working so was hoping someone could take a look at the code I'm using and let me know if there's something I'm missing here?
my code for the 'Deactivate User' API call:
def disableUser():
global account_Id
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <my_api_token>"
}
payload = json.dumps( {
"message": "On 6-month suspension"
} )
response = requests.request(
"POST",
url,
data=payload,
headers=headers)
print(response.text)
Just to add, I can successfully execute all other calls from the REST API library, it seems to only be an issue when using the User Management API format with the 'Bearer' token (shown above) that returns the 401 error.
Please help!
many thanks,
Mike