API request to return a user based on their external ID

Does anyone know how can I obtain the “external_id” for a user from the api? I added an external_id at the sso login, but now when I query users, I do not see any “external_id” in the user hash returned by the API. I’m trying to use the external_id as a way to identify users from my database when processing a webhook.

Yes, this can be done by sending an authenticated GET request to https://discourse.example.com/u/by-external/{external_id}.json

This route is documented here: Discourse API Docs.

2 Likes

And to get the inverse (ie obtain the external_id given a user_id) you can either:

Note that single_sign_on_record (and external_id) is NOT returned by a call to:
https://discourse.example.com/users/{username}.json

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.