I’m using Realm and I would like to delete an App User programmatically.
I’m trying to do so by using Realm Administration API, especially these methods:
Well unfortunately there is not much to say. I’m running the curl command in order to delete one of the following Realm App User, using the id column for <user_id>:
Hey @Julien_Chouvet - a few things to note:
a) the DELETE method isn’t going to return anything - I just tried the following which successfully deleted my user:
Project ID and Group ID are indeed the same thing and used interchangeably. If you’re using the project ID where your app is located, it shouldn’t cause any issues.
If you’re looking for much easier user management, we just introduced it in our new CLI - you can download it via: npm i -g mongodb-realm-cli@beta
after logging in via the CLI, you can run
realm-cli users delete which will provide a list of users that you can select to delete:
Thanks for your help but unfortunately it’s still not working
I tried again with your curl command but it did not work (but still working with GET). Is there somewhere some logs produced by the DELETE request that I can use to find what is going wrong?
Actually I want to use this REST method on my iOS app to allow a user to remove its account. I first tried directly to do the DELETE from the app but it didn’t work that’s why I’m trying with curl.
So, is there another way to delete a user that I can use from my app? Is it possible to do it from a Realm function or with a Trigger?
Hey Julien - you should be able to do this in a system function or trigger as well. We don’t typically recommend that you do admin API calls from the client, but you could do something like this by calling a system function that executes this API call.
Hey Julien - interesting that the GET works perfectly. The app id you’re using should be the second string in your URL when you’re in Realm, not the app id used for connecting via the SDKs. Does that work in your case?
Yes this is the one i’m actually using in my request. In the code below I used the app id <my_app_id> in order to retrieve the ‘internal’ app id thanks to this part of the code: