Quantcast
Channel: Piwik Forums - Support & Bugs
Viewing all articles
Browse latest Browse all 4243

Problem with UsersManager.addUser API (2 replies)

$
0
0
Hello,

I try to use the API of Piwik to creat new user with the method UsersManager.addUser.

<?php

define('PIWIK_INCLUDE_PATH', realpath('../stats'));
define('PIWIK_USER_PATH', realpath('../stats'));
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);
define('PIWIK_ENABLE_SESSION_START', false);

require_once PIWIK_INCLUDE_PATH . "/index.php";
require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";

Piwik_FrontController::getInstance()->init();

			$request = new Piwik_API_Request('
                                                method=UsersManager.addUser
                                                &userLogin=test
                                                &password=test
                                                &email=test@gmail.com
						&alias=alias
						&token_auth=55c770f00c299076bfedc869f7dd6d09
			');
			
$result =  $request->process();

echo $result;

?>

But it is not work but when I do a other request like :

			$request = new Piwik_API_Request('
						method=UsersManager.getUsersAccessFromSite
						&idSite=2
						&token_auth=55c770f00c299076bfedc869f7dd6d09
			');

It's work and I can see this user have the access "view".

The token_auth is the token of the main user when I had install piwik and I found it when I go on API in the top menu when I'm log on piwik.

Do you have any idea?

Viewing all articles
Browse latest Browse all 4243

Trending Articles