How to add users to your WordPress installation remotely using the JSON API

If you’re an individual who runs a WordPress website that includes memberships, or a person who has created their own little social platform using WordPress, chances are, you’ll need to have users, and the ability to add them remotely at your will.

WordPress is a very powerful tool which includes various APIs that can help you when it comes to breaking down complex tasks, and improve your workflow. One very such API is the JSON API (which will ultimately help you in adding users remotely to your website).We’re basically going to install some plugins, navigate through some settings, and finally have a fluid and hassle free system that’ll let us achieve the functionality we’re looking for.

Let’s get started

Before we involve ourselves with the specifics, we need to install two very essential plugins, namely, the WordPress JSON API plugin and the JSON API User plugin. For this, head over to Plugins->Add New and just type the name of each of the above-mentioned plugins inside the search box. Go ahead and install these plugins. Head back to Plugins->Installed Plugins and activate both of them. Now we’re all set to tweak the settings.

The reason why we installed the above plugins is rather simple. While the JSON API plugin offers functionality that lets you fetch posts and comments, fetch pages etc., the JSON API User plugin is like an add-on to it, which lets you add users remotely too.

For the next step, head over to the Settings option in WordPress. Under this option, you would now see a newly created sub-option that says JSON API. In the JSON API settings, just activate the User Creation option and hit save. Now, right below this, you would see an API BASE URL which will be set to something default. What you have to now do is, just erase whatever’s written there and add a tough-to-guess phrase there. Once you’re done, save the settings.

Creating a new user

For creating a new user with the help of this plugin, you will be needing something called a nonce ID. Haven’t heard of it? Don’t worry, here’s how you can get one easily:
-> To get a nonce ID, type in the following URL in the address bar of your browser and add the necessary text.

You should now get something of the format similar to the one given below: {“status”:”ok”,”controller”:”user”,”method”:”register”,”nonce”:”THIS IS THE NONCE ID″}

You have now received a nonce ID generated just for you, and do take note that this ID will have to be created every time you would want to create a new user. <-

Next, paste the URL lying below in the address bar and make the necessary changes.http://add you domain name here/add the tough-to-guess phrase here/user/register/?username=add a username here&email=add an email address here&nonce=add your nonce ID here&display_name=add a display name here
Once you’re done, just open the URL, and you should now get a message that’ll confirm that the user has been added successfully.

Concluding

Phew. For the first time, things can get a little confusing, but as you get the hold of this method, you’d be creating new users for you own WordPress website almost instantly and remotely.
However, if you encounter any problem while carrying out the steps above, do let us know through a comment below or social media. We’ll help you out.