# How to set user's location string with Discourse API

**URL:** <https://meta.discourse.org/t/how-to-set-users-location-string-with-discourse-api/146301>\
**Category:** Development\
**Created:** [March 31, 2020, 3:43pm UTC](https://meta.discourse.org/t/how-to-set-users-location-string-with-discourse-api/146301 "2020-03-31T15:43:29Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pnoeric](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pnoeric/32/177144_2.png) [@pnoeric](https://meta.discourse.org/u/pnoeric)\
**Post date:** [March 31, 2020, 3:43pm UTC](https://meta.discourse.org/t/how-to-set-users-location-string-with-discourse-api/146301/1 "2020-03-31T15:43:29Z")

</div>

It looks like there’s [an endpoint to set a user’s info](https://github.com/discourse/discourse_api/blob/master/lib/discourse_api/api/users.rb#L32), 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 `mydiscourse.com/u/my_user_name`, 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](https://github.com/discourse/discourse_api/blob/master/lib/discourse_api/api/users.rb#L32). Am I just mis-reading the API code? [Edit: I tried adding `.json` to the endpoint, no luck]

Thank you,  
E

---

_[View the full topic](https://meta.discourse.org/t/how-to-set-users-location-string-with-discourse-api/146301)._
