February 8, 2023, 7:59pm
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:
Where I got a bit confused was by not seeing a json payload but instead it’s some formdata. The payload was:
I only wish to update one user_field value,
It’s URL encoded:
And decoded, it reads as:
(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
February 8, 2023, 10:01pm
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
If I monitor my browser when editing a user, I can see it
PUTing the following:
I am using the following code to make my PUT api call:
' Add some Headers
' Add some form body parameters
Every time I make the API call, sure enough, the
bio_raw value gets updated to the current timestamp (as a test).
But for some reason the
user_fields value is not updating at all. No errors, it just doesn’t update.
I’ve tried both URL-encoding it as
user_fields%5B8%5D and also tried as plain text
user_fields but neither have any effect.
Am I missing something obvious here?
February 8, 2023, 10:20pm
Yes, yes I was.
Prevents the editing of the user_field when the API call is performed by the user.
Of course it does
If I rework my API call and perform it by
system, it works fine
March 10, 2023, 10:20pm
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.