I’ve been trying to reverse engineer the updating of a user_field value.
I did this by following the steps in Reverse engineer the Discourse API, I edited a test user and made a note of what was occurring in the network tab of the browser.
I can see that I need to PUT to this url: https://example.com/u/my-username-here.json
Where I got a bit confused was by not seeing a json payload but instead it’s some formdata. The payload was: user_fields%5B1%5D=some+dji%2C+some+Autel&user_fields%5B5%5D=%40UKDroneClub&user_fields%5B6%5D=%40iKiteFlyer&user_fields%5B8%5D=test&timezone=Europe%2FLondon&default_calendar=none_selected
I only wish to update one user_field value,
It’s URL encoded: user_fields%5B8%5D=test
And decoded, it reads as: user_fields[8]=test
(8 = the id of the user_field I want to update)
How would I convert this form data value in to a json payload so I can then PUT it?
I’m not sure what I’m doing wrong here but I am able to update the About Me section of a users profile via an API call, but I cannot update any of the user_fields.
If I monitor my browser when editing a user, I can see it PUTing the following: