Based on this documentation, the idea is that a POST to Discourse end point /admin/users/sync_sso can be used to update details of the user when details are changed in Dashboard. The data sent should be basically the same that is sent for the log in process.
Also there is an endpoint that provides details on the status of the user such as: https://talk.openmrs.org/users/by-external/michael.json. This uses the external_id that we send it (the OpenMRS ID). There are some cases where the user name in Discourse is not the same because there can’t be . in the user ID in Discourse. But the official OpenMRS ID is still maintained in this external_id.
Take a look and in case of further questions, let’s just keep this topic going.
Yep, unfortunately the Discourse API’s are not yet very well documented (kind of like OpenMRS!) so it takes a lot of research to find what really needs to happen. But we’ll also see what answers come to your meta question.
At last I’ve chosen to imitate the normal login procedure. Go to the login URL and fetch the nonce (temporary credence for SSO login) and make a request to issue that login. As Discourse will sync the data during login, this will work magically.
And for efficiency, all the HTTP requests are just HEAD requests.