How does one change a username via the API?

While using the API and making a put request to:
MYDISCOURSE/users/MYUSER?api_key=MYSYSTEMAPIKEY&api_username=system
with a json payload of:
{“username”:“helloworld”}
I am receiving a response with a code of 200 and a body that indicates the username has not been changed.

Try this endpoint instead:

curl -i -sS -X PUT "http://127.0.0.1:3000/u/blake/preferences/username.json"  \
-H "Content-Type: multipart/form-data;" \
-F "api_key=a66d01fbe98cc51b2747d8bfe99f81d7adca18317fbf3c43aa20f340d8e25bfe"  \
-F "api_username=system" \
-F "new_username=blake2"

And it will output:

{"id":1,"username":"blake2"}
4 Likes

I was wondering: is it safe to change the system username?

Looks like this is not confirmed yet.

Thank you @blake that was exactly what I needed. :slight_smile:

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.