The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Webdisk user is not getting created.

Discussion in 'cPanel Developers' started by testpgm, Jul 20, 2010.

  1. testpgm

    testpgm Member

    Joined:
    May 25, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Hai all,
    I have been using the function WebDisk::addwebdisk for adding the webdisk user.
    I have passed the parameters as:
    [domain] => dom.com
    [homedir] => /home/aaa/public_html/dom
    [password] => xxxx
    [username] => yyy
    But am getting the result as:
    [error] => No username provided for web disk account creation

    [event] => SimpleXMLElement Object
    (
    [result] => 1
    )
    Please help. The users are not getting created. The result is getting as 1. But not adding user. Please help me to find where is the error.
    Thanks.
     
  2. kuldeep_

    kuldeep_ Well-Known Member

    Joined:
    Apr 24, 2010
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    Check cPanel error logs, see if you find any thing in there.

    You can check logs at
    HTML:
    /usr/local/cpanel/logs/error_log
     
  3. testpgm

    testpgm Member

    Joined:
    May 25, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    No errors are getting in the logs

    Hi...
    Am not getting any error messages in the logs in cPanel.
    Its blank. Is there any other way to find where the error is?

    Thanks
     
  4. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi testpgm,

    From your output I presume you're use making your API2 WebDisk::addwebdisk request via the xml-api.

    I'm not sure that you'll be able to make the addwebdisk function call via the xml-api. The reason why is that the xml-api binary requires a 'user' parameter for the API1 and API2 call. It is used for knowing which cPanel account on the system to perform the action for. And since the function itself also requires a parameter named 'user', you would never be able to pass the new 'user' name to addwebdisk.

    Simply put, its a design conflict; API2 calls were designed before xml-api. Using the xml-api as a proxy to these pre-existing functions is not 100% backwards compatible. In most cases this is not an issue because API calls that create a new user, of any sort, usually take some other literal parameter key, like 'username', instead of 'user' so there's no conflict. Unfortunately, this particular function is an exception.

    I will ask my colleagues , but I doubt there's a work around.

    Regards,
    -DavidN

    Also, you can use the API Tracer in our developer downloads section to watch which parameters are received and returned by API calls. You can get the tracer here:
    http://sdk.cpanel.net/utils/CustomEventHandler-Dumper.tar.gz

    Inside the tarball is a README. You'll need root to install it.
    NOTE: NEVER place this tracer on a production machine, as it records all data for API requests, which is likely to contain sensitive information.

    Here's a forum thread on the API Tracer:
    http://forums.cpanel.net/f42/looking-up-cpanel-api-call-parameters-130545.html
     
  5. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Okay,

    After conversation, there are two ways to resolve this issue:

    1) if you use port 2082/2083 and are authenticated as the cPanel user that will be affected, the 'user' parameter of your URL request will not be digested by the xml-api, but simply passed to WebDisk::addwebdisk function.

    2) if you use port 2086/2087 you can specify 'cpanel_xmlapi_user' or 'cpanel_jsonapi_user' (depending on if you're using the XML or JSON request/output interface). This will allow you pass the cPanel user to the xml-api binary and the 'user' parameter will not be digested but pushed to the function.

    Cheers,
    -David

    PS. If you're using the xml-api PHP client class that we have in our developer download section, then you need to make a few modifications, namely the api2_query method

    ex. modification for the end of api2_query method of the xmlapi.php client class
    Code:
    $module_type = 'cpanel_xmlapi_module';
    $func_type = 'cpanel_xmlapi_func';
    $api_type = 'cpanel_xmlapi_apiversion';
    $cpuser = 'cpanel_xmlapi_user';              // Adding to resolve 'user' key conflict
    
    if ( $this->get_output() == 'json' ) {
    	$module_type = 'cpanel_jsonapi_module';
    	$func_type = 'cpanel_jsonapi_func';
    	$api_type = 'cpanel_jsonapi_apiversion';
    	$cpuser = 'cpanel_jsonapi_user';     // Adding to resolve 'user' key conflict
    }
    		
    $args[$cpuser] = $user;                        // Modified to resolve 'user' key conflict
    $args[$module_type] = $module;
    $args[$func_type] = $function;
    $args[$api_type] = '2';
    return $this->xmlapi_query('cpanel', $args);
    
     
  6. testpgm

    testpgm Member

    Joined:
    May 25, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for the reply. I will check it out.
     
  7. testpgm

    testpgm Member

    Joined:
    May 25, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Hai all,
    I have tried as you said. The "cpanel_xmlapi_user'" has been used instead of "user" in 2087. Also we have modified the end of api2_query method of the xmlapi.php client class with the code provided. Now the error message is not being shown and the result is returning a value 1. But still the user is not getting created. This is the result we have got.

    SimpleXMLElement Object
    ( [apiversion] => 2
    [data] => SimpleXMLElement Object
    ( [domain] => xyz.com
    [login] => abc@xyz.com
    [user] => abc
    )
    [event] => SimpleXMLElement Object
    ( [result] => 1
    )
    [func] => addwebdisk
    [module] => WebDisk
    )

    Please help....
     
Loading...

Share This Page