How to set user's location string with Discourse API

It looks like there’s an endpoint to set a user’s info, including their location.

However, I can’t figure out:

  1. How to pass the user ID instead of the username?

  2. When I post a new location to, I’m getting a 404 error on return… not sure why. I’m using the same code that I used to post other things to the API. So I’m thinking that endpoint is wrong, even though it seems like that’s what in the API code. Am I just mis-reading the API code? [Edit: I tried adding .json to the endpoint, no luck]

Thank you,

See How to reverse engineer the Discourse API while you execute that operation in the user interface.

1 Like

Thanks Jeff, that was what I needed… being able to spy on the XHR requests directly is clever!

For others who might need the info: I was able to PUT to /u/username.json and update the custom fields that way. And it appears you can only make the call with a username, not with a user ID (too bad).