Rank 3: Container
Hello, I'm having trouble figuring out how to retrieve specific user account information from the admin app. It seems that the 'users.get(id)' function only works on the server side. Am I missing something?
Votes
0
Replies
23
Participants
Unknown
Messages
24
Rank 3: Container
Hello, I'm having trouble figuring out how to retrieve specific user account information from the admin app. It seems that the 'users.get(id)' function only works on the server side. Am I missing something?
hi @hamed , can you elaborate more on your issue - are you using cloud or hosting on your own? what SDK are you using? Are you getting any kind of error? Have you updated the scope with your API key? If you provide as much details of what you've done already it'll help others troubleshoot 🙂
Rank 3: Container
In the admin app, I've encountered a situation where I need to retrieve specific user preferences. However, I've found that using "account.get" or "account.getPrefs" only provides me with the information of the currently logged-in user. I know that on the server side, I can provide a user ID to these methods to retrieve the desired user's preferences. My question is, how can I receive the server-side response back on the client side?
Admin
You can use the server SDK in an Appwrite function
Rank 3: Container
I'm not certain how to retrieve a response from the server SDK within an Appwrite function. If you have any insights or information on how to accomplish this, I would greatly appreciate it.
You're not missing anything and it's intended.
Users shouldn't be allowed to get information about other users. This is for privacy reasons.
What you can do is use Appwrite Functions.
Then you can execute this function from your Flutter SDK on your Flutter app.
Think of this as building your own endpoints to extend the Appwrite API.
Rank 3: Container
Thank you for your detailed explanation. I understand the approach, but the part I'm struggling with is how to retrieve the function's response back to the client side after it successfully executes. I truly appreciate your assistance and guidance in this matter.
Admin
Have you read through this? https://appwrite.io/docs/functions#writingYourOwnFunction
Rank 3: Container
Absolutely, Well I'll definitely consider shifting user preferences to the database instead of keeping them within the account.
Moderator
I think this should be allowed with permissions and some fields, like other users names. Lots of users need to have a duplicated collection with each user ID and names (like me). I think it doesn't makes sense needing to do that since we have the users API. A solution to prevent duplicate is basically using a function, but is not at all worthy since it will consume a lot of resources for each request, also you're losing the caching layer when using this method
Moderator
@hamed Can I mark this as solved, or do you need additional assistance?
I think wrapping it in a function is still better. It suggests to users that this is a valid way to use the User API, which it really isn't 😅
I actually believe the duplicate collection way is also valid
Tell you what @D5 , I think you'll change your mind when you see the new functions 😉😉 (after we iron out the bugs after release
Moderator
Hope yes
Moderator
[SOLVED] User Account Info Retrieval
😈 Once the release works 🤞 I'm thinking the new functions should be able to solve this problem with user info retrieval.
It's much less effort to maintain a ton of functions
You can have them in the same repo as your app, they support path and query params, and they auto deploy with new push
Rank 3: Container
I'm really looking forward to giving it a shot
, In fact, I've written a lot of code to work around this issue
😅 I'd like to also appologize for the state of this release at launch
Looking forward to what you'll build