For now I think your best option is to make two api requests. One to fetch the user by id in order to get the username, and the second request to update by username.
There is an option to update a user by external_id
but I don’t think this can be used without single-sign-on enabled, but this way Discourse stores the id of the user of your application instead of the other way around.