powered by Jive Software

Trouble adding user with API

I have User Service API enabled and whenever I go to my url it doesn’t add the user to my database. I’m using IP address to access it.

I’m trying to add user to database by accessing this URL through cURL.

http://139.60.141.325:9090/plugins/userService/userservice?type=add&secret=rCSwAxYh&username=test&password=test&name=woah&email=neaksdf@aol.com

It’s just not adding the user to the database whenever I go to the URL.

There isn’t anything wrong with my cURL script either.

<?php
$url = "http://139.60.162.235:9090/plugins/userService/userservice?type=add&secret=rCSA5xYh&username=hi&password=no&name=woah&email=neaksdf@aol.com";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
?>

What version of Openfire do you use? User Service plugin is deprecated. You should use REST API plugin instead, if your Openfire version is 4.1.1 or newer.

I just installed the plugin on the same server and I’m having issues. Openfire and my hostname (xmpp.datatron.app) are on the same server. https://xmpp.datatron.network/api.php is my page that I’m trying to operate the api from. This code below is in api.php. It’s not showing any error whenever I load the api.php. It’s just not sending the request to the server.

<?php

include "vendor/autoload.php";

# Create the Openfire Rest api object
$api = new Gidkom\OpenFireRestApi\OpenFireRestApi;

# Set the required config parameters
$api->secret = "TWvMWEDFzJCmOOPkE";
$api->host = "xmpp.datatron.app";
$api->port = "9091";  # default 9090

$result = $api->addUser('Username', 'Password', 'Real Name', 'johndoe@domain.com');

# Check result if command is succesful
if($result['status']) {
    # Display result
    print_r($result['data']);
} else {
    # Something went wrong
    echo 'Error: ';
    echo $result['data'];
}


?>