# API-verzoek om een gebruiker te retourneren op basis van hun externe ID

**URL:** <https://meta.discourse.org/t/api-request-to-return-a-user-based-on-their-external-id/163413>\
**Category:** SSO\
**Tags:** discourseconnect, rest-api\
**Created:** [8 september 2020 om 19:55 UTC](https://meta.discourse.org/t/api-request-to-return-a-user-based-on-their-external-id/163413 "2020-09-08T19:55:24Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![rossinboulder](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@rossinboulder](https://meta.discourse.org/u/rossinboulder)\
**Post date:** [8 september 2020 om 20:13 UTC](https://meta.discourse.org/t/api-request-to-return-a-user-based-on-their-external-id/163413/3 "2020-09-08T20:13:51Z")

</div>

And to get the inverse (ie obtain the external\_id given a user\_id) you can either:

- Use the [Discourse Ruby API](https://github.com/discourse/discourse_api) and call the method: user\_sso(user\_id)

- Send an [authenticated get request](https://docs.discourse.org/#tag/Users/paths/~1admin~1users~1%7Bid%7D.json/get) to:  
[https://discourse.example.com/admin/users/{id}.json](https://discourse.example.com/admin/users/%7Bid%7D.json)  
and look for hash key [“single\_sign\_on\_record”][“external\_id”]

Note that single\_sign\_on\_record (and external\_id) is NOT returned by a call to:  
[https://discourse.example.com/users/{username}.json](https://discourse.example.com/users/%7Busername%7D.json)

---

_[View the full topic](https://meta.discourse.org/t/api-request-to-return-a-user-based-on-their-external-id/163413)._
