Overview
You are looking for instructions on how to Delete a Cognito user for your Totogi Tenant using the GraphQL API.
Solution
In order to make the requests through the API, the information below is required.
- The Provider ID.
- An Access Token using the credentials of the Tenant Admin User.
In order to delete an existing Cognito user, one should use the deleteUser mutation API call. With this method, one can update an existing Cognito user passing some of the parameters mentioned in the API definition.
Below is an example payload to delete a Cognito user with some important specifications:
- Only the user ID and Provider ID are inputs. The remaining will be used to update the user details. If you don't want to update any of the fields pass the same value to the mutation API call.
- The request handles different possible results such as what to return if the UserNotFound or an UserIsReadOnly scenario.
- Delete operation is permanent
mutation deleteUser{
deleteUser(input: {
providerId : "<provider ID>",
userId : "<email ID>"
}
)
{
... on DeleteUserPayload {
userId
providerId
}
... on UserNotFound {
providerId
userId
errorCode
errorMessage
}
... on UserIsReadOnly {
errorCode
errorMessage
}
}
}
Below is an example of the output of the deleteUser operation if the deletion was successful: