How to change user fields with API

You can create a user with custom fields via the API by passing in user_fields[1] like this:

curl -i -sS -X POST "http://localhost:3000/users"  \
-H "Content-Type: multipart/form-data;"  \
-H "Api-Key: d19b5a38ed13745f4c5..."  \
-H "Api-Username: system"  \
-F "name=cbbc7188c201b59ebc06"  \
-F "username=cbbc7188c201b59ebc06"  \
-F "email=cbbc7188c201b59ebc06@example.com"  \
-F "password=b6629ed30b4bc3de32ce452d171540b0"  \
-F "active=true"  \
-F "approved=true"  \
-F "user_fields[1]=a874d830b60"  \
-F "user_fields[2]=732418b131b"

image

And you can update them by sending a PUT request to /u/<username>.json

7 Likes