Jump to content

PHP REST API get error when try to add New Users


Sakura Hana

Recommended Posts

Dear all,
I got some problem with php-sample.
I want to add users, but there were something went wrong.
Please help me!!
Here is code that I used:

<!DOCTYPE html><?php    require_once "vendor/autoload.php";    require_once "autoload.dist.php";    require_once "client/JasperClient.php";    require_once "client/User.php";?><?php    $client = new JasperJasperClient(                        "localhost", // Hostname                        8080, // Port                        "jasperadmin", // Username                        "jasperadmin", // Password                        "/jasperserver-pro", // Base URL                        "organization_1"                    ); // Organization (pro only)       $newUser = new JasperUser("BI_User",                // username                           "superSTRENGTHpassw0rd",      // password                           "clever@email.com",           // email                           "Business Intelligence User", // description                           "organization_1",             // parent organization                           "true"                        // enabled                     );                        $role = new JasperRole("ROLE_USER", NULL, "false");    $newUser->addRole($role);       try {        $client->putUsers($newUser);    }    catch (Exception $e) {        printf("Could not add new user: %s", $e->getMessage());    }   ?>[/code]


And here is the error message:

Could not add new user: Unexpected HTTP code returned: 400 Body of response: Apache Tomcat/6.0.26 - Error report HTTP Status 400 - type Status reportmessage description The request sent by the client was syntactically incorrect ().Apache Tomcat/6.0.26[/code]
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...