Trouble creating user with custom user fields with the API

When I try to create a user via API with “user_fields[1]”. which is the customer field.

When I do the testing via postman, it works fine.

but When I tried it via code. it never works. so wired.

here is my payload

{

"name": "asdsd",
"email": "sd1sf@asasas.com",
"password": "b366202d-fcc4-46da-9fed-cd57348f2ad2",
"username": "wED18oxlz3",
"active": true,
"approved": false,
"user_fields[1]": "huhsdsd",
"user_fields[2]": "huhsdsdhuhsdsdhuhsdsd"

},

same payload works on postman.

I belive it related with the format of user_fields[1] .

I have finally solved by myself.

1 make sure using.

‘Content-Type’: ‘multipart/form-data’,

as the header

2 make sure your form data is a JSON string . not an object.

I use nodejs, and. I need qs.Stringify my params.

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