Users.create method of REST API doesn't work

We have created an integration of our product with Rocket.Chat, integration assumes creating accounts via REST API and then logging user in. Have just deployed a test installation of Rocket.Chat, version 4.5.1, installed from snapd.
When attempting to use users.create method of REST API, we’re always getting this error:
userData.hasOwnProperty is not a function

We have rechecked that valid email, name, password and username are sent in, creating a new account via Register form works as expected.

Any idea how to proceed? Thanks.


Have you tried the curl command given as example? For instance:

curl -H “X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq”
-H “X-User-Id: aobEdbYhXfu5hkeqG”
-H “Content-type:application/json”
-d ‘{“name”: “name”, “email”: “email@user.tld”, “password”: “anypassyouwant”, “username”: “uniqueusername”}’

Try testing the command exactly how it is (changing token and user-id, of course). From there, you can try replicating this same request to the programming language you are using.

Hope I have helped!

1 Like

That actually did work, so I compared what this command does with what our code did, turned out users.create (as well as other Users endpoints) now requires parameters in JSON format while we were using plain POST (which, strangely enough, worked till at least 4.0.0).

Now the integration is up and running again, thank you so much!
Please close the call and/or mark as solved, I don’t seem to have permissions to do it :slight_smile:


indeed there was an update that made required explicit content-type.

Glad you worked it out!

I would like to invite you to our monthly Community Open Call :slight_smile: