REST API – Create user with custom meta
-
Hello, sorry if this is not in the correct tpoic tried to post it here https://www.ads-software.com/support/topic-tag/rest-api but couldn’t for some reason.
I’m looking for a way to create a user from my node app. So far I’ve identified 3 possible ways to do this :
1. Using the wp-rest api , tried a request like so as described in the documentation
https://developer.www.ads-software.com/rest-api/reference/users/#create-a-user passing an object for the meta.{ "username" : "test2", "email": "[email protected]", "password": "123456", "meta": { "messengerId": "11223344" } }
which failed to create my custom messengerId in wp_usersmeta table.
2. Using a node wrapper for the wp-cli command
However couldn’t identify a way to create a user and meta at the same time. There’s a command to create a user and a command to add meta knowing the id which I wouldn’t know before creating the said user. Need to do both at the same time or store the id from the first command. Not sure how to do this.3. Most dangerous option. Using node-mysql manually creating the user in the wp_users and wp_usermeta keeping in mind the way wordpress does it when creating the new user and the fields required.
Can anyone chime in on this? Ideally would like to do this using the REST api.
Thanks.
- The topic ‘REST API – Create user with custom meta’ is closed to new replies.