How can one update a user based on external_id?

All accounts are created via SSO, so every user has an external_id. There is a mention that it is possible in another thread: How can I update users via API using the user id (not username)? - #2 by blake

You will first need to lookup the user’s Discourse user_id, then make an update request using that. This should help with the first bit:


Thank you. I was hoping to avoid making 2 api requests to update the user as I have been having problems with hitting the rate limit. Fortunately, I think I have a solution. If I configure the user_event webhook, I should be able to locally store a user’s discourse id and Discourse username when the user signs into Discourse through SSO. Then I can use the stored Discourse username when making updates to Discourse.