Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    3

    Default Api 1 Documentation Error in Mysql module, adduserdb function

    Hi,
    there's an error in the documentation of the API 1: in module Mysql, in the function adduserdb the parameter perm_list is describe as follow:

    perms_list (string)
    A comma-separated list of permissions to grant to the user (e.g., "all" or "alter,drop,create,delete,insert,update,lock" ).
    from ApiMysql < ApiDocs/Api1 < TWiki

    this isn't true, the list is SPACE-separated.

    The correct form must be:
    Code:
     	 perms_list (string)
      	A space-separated list of permissions to grant to the user (e.g., "all" or "alter drop create delete insert update lock" ).
    I spent a lot of time to find it, please correct it.

    Thank's for your work.

  2. #2
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default

    Hi Elia,

    You're correct. I've informed Documentation and it should be corrected shortly.

    Thanks and sorry for the inconvenience,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    3

    Default Re: Api 1 Documentation Error in Mysql module, adduserdb function

    I have just the opposite problem: while documentation now says its a space-separated list, for me only works a comma-separated list.

    I've tested it with versions 11.28.83 and 11.26

    EDITED:
    I was wrong, none of them work with cPanel 11.26. But after some trial and error, I've found it works using + as separator with both versions.
    Last edited by dgarciag; 03-04-2011 at 01:34 AM.

  4. #4
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default Re: Api 1 Documentation Error in Mysql module, adduserdb function

    Hi dgraciag,

    How are you making your request? Via the XML-API? are you using a browser and manually placing the url in the address bar, or are you using a script based client. Please provide reproduction steps, as I was able to perform the call as documented:


    Tested on 11.28.83-STABLE_51164

    Output from debug mode on XML-API PHP client class. NOTE the "pluses" you see in the URL arg-2 are encoded SPACES!
    Code:
    URL: https://10.1.1.1:2083/xml-api/cpanel
    DATA: cpanel_xmlapi_user=dave&cpanel_xmlapi_module=Mysql&cpanel_xmlapi_func=adduserdb&cpanel_xmlapi_apiversion=1&arg-0=clidbb&arg-1=uclidbb&arg-2=create+index+drop&api.version=1
    
    
    RESPONSE:
     <?xml version="1.0" ?>
    <cpanelresult><module>Mysql</module><func>adduserdb</func><type>event</type><source>internal</source><apiversion>1</apiversion><data><result></result></data>  <event>
        <result>1</result>
      </event>
    </cpanelresult>
    URL: https://10.1.4.102:2083/xml-api/cpanel
    DATA: cpanel_xmlapi_user=dave&cpanel_xmlapi_module=MysqlFE&cpanel_xmlapi_func=listdbs&cpanel_xmlapi_apiversion=2&api.version=1
    Authentication Header: Authorization: Basic ZGF2ZTpjcDE=
    
    
    RESPONSE:
     <?xml version="1.0" ?>
      <cpanelresult>
        <apiversion>2</apiversion>
        <data>
          <db>clidbb</db>
          <size>0</size>
          <sizemeg>0.00</sizemeg>
          <usercount>1</usercount>
          <userlist>
            <db>clidbb</db>
            <user>uclidbb</user>
          </userlist>
        </data>
        <event>
          <result>1</result>
        </event>
        <func>listdbs</func>
        <module>MysqlFE</module>
      </cpanelresult>
    Code:
    mysql -e 'select * from mysql.db where user = "uclidbb";'
    +-----------+--------+---------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+
    | Host      | Db     | User    | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Create_tmp_table_priv | Lock_tables_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Execute_priv |
    +-----------+--------+---------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+
    | localhost | clidbb | uclidbb | N           | N           | N           | N           | Y           | Y         | N          | N               | Y          | N          | N                     | N                | N                | N              | N                   | N                  | N            | 
    +-----------+--------+---------+-------------+-------------+-------------+-------------+-------------+-----------+------------+-----------------+------------+------------+-----------------------+------------------+------------------+----------------+---------------------+--------------------+--------------+
    Regards,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

  5. #5
    Registered User
    Join Date
    Feb 2011
    Posts
    3

    Default Re: Api 1 Documentation Error in Mysql module, adduserdb function

    I'm constructing the url myself and fetching it with CURL, using json calls in fast mode.
    You are right about url encoding, I wrongly assumed CURL do it for me.

    Anyway it's also working fine with '&arg-2=select,insert,drop'.

    Thanks for your time

Similar Threads & Tags
Similar threads

  1. XML-API function "setacls" documentation error
    By MSTF in forum cPanel Developers
    Replies: 3
    Last Post: 03-04-2011, 08:16 AM
  2. XML-API function "setacls" documentation error
    By MSTF in forum New User Questions
    Replies: 1
    Last Post: 03-02-2011, 07:49 AM
  3. API Documentation Feedback
    By cPanelMatt in forum cPanel Developers
    Replies: 1
    Last Post: 10-19-2009, 08:15 PM
  4. Cpanel API Documentation
    By sam@v2web.com in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 09-16-2006, 10:19 AM
  5. PHP cPanel Addon Module Documentation
    By Edude in forum cPanel Developers
    Replies: 2
    Last Post: 03-21-2005, 12:42 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube