Announcement

Collapse
No announcement yet.

Problems to create a mysql user

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems to create a mysql user

    Hi,



    I'm trying to implement a simple API call, using the apikey, to create a mysql user.

    The following code works:
    <code>
    $input = array(
    'domain' => 'domain.exemple.com,
    'account_action' => 'querySiteworxAccountDetails'
    );


    $params = array( 'apikey' => '-----BEGIN INTERWORX API KEY-----
    ....
    -----END INTERWORX API KEY-----',
    'ctrl_name' => '/nodeworx/siteworx',
    'action' => 'querySiteworxAccountDetails',
    'input' => $input );

    $client = new Zend_XmlRpc_Client(
    'https://domain.exemple.com:2443/nodeworx/xmlrpc-api' ); $result = $client->call( 'iworx.route', $params ); </code>

    I can get the info of the account.

    ...but the same apikey doesn't work to create a mysql user (and I also don't know how to associate it to a specific account) <code> $input = array( 'name' => 'test', 'password' => 'test', 'confirm_password' => 'test'
    );
    $api_controller = '/siteworx/mysql/user';
    $action = 'add';
    $params = array( 'apikey' => '-----BEGIN INTERWORX API KEY-----
    ....
    -----END INTERWORX API KEY-----',
    'ctrl_name' => $api_controller,
    'action' => $action,
    'input' => $input );
    $result = $client->call( 'iworx.route', $params ); </code>

    How can I make this work, and what am I doing wrong?

    Regards,

  • #2
    Hey Paulo -

    It's not you

    Unfortunately, the API key only authenticates you as the NodeWorx account it's associated with, which means that SiteWorx actions aren't possible.

    There's a way to do it, but I've found a bug as I'm working on it. I'll have a tutorial for how to do it soon. If you can, log a support ticket and I'll patch your server when I figure this out

    Tim

    Comment


    • #3
      Hi Tim,

      Consider it done (ticket submitted ;-)) ...

      There is a manual or tutorial for the command line management of nodeworx/ siteworx ?

      Regards

      Comment


      • #4
        What's the ticket ID? Nothing looks connected

        Comment


        • #5
          Ha, NM - just hadn't been processed by the ticket queue yet, I retract my statement

          Comment


          • #6
            :-) you're too fast for me ... eheheh

            Comment


            • #7
              OK, just for everyone else finding this later...

              Paulo's been patched, the change will be in the next release of InterWorx (current build is 266)

              There was a complete oversight; it was not possible to execute SiteWorx controller actions using a NodeWorx API key. Additionally, the documentation was not particularly clear in this regard.

              There will be a new $key format (see www.interworx.com/api) which will be an array including the API key and the domain as parameters.

              Paulo, thanks for reporting and helping with the fix.

              Tim

              Comment


              • #8
                I used this code:
                Code:
                $key = array('email'=>'nodeworxadmin','password'=>'hispassword');
                $action         = 'list';
                $input2 = array();
                $api_controller = '/siteworx/users';
                $params = array( 'apikey'    => $key,
                                 'ctrl_name' => $api_controller,
                                 'action'    => $action,
                                 'input'     => $input2 );
                include ('../Zend/XmlRpc/Client.php');
                $client = new Zend_XmlRpc_Client( 'https://mydomain:2443/xmlrpc' );
                $result = $client->call( 'iworx.route', $params );
                but in result is always:
                payload - Authentication Error (SiteWorx)

                I tried api key too, but it is same.
                Please help.
                Software Development
                Profesionální redakční systém
                Aplicus

                Comment


                • #9
                  I tried:
                  $api_controller = '/nodeworx/users';

                  and it works.
                  Soo something is wrong with '/siteworx/users'

                  please help.
                  Software Development
                  Profesionální redakční systém
                  Aplicus

                  Comment


                  • #10
                    Hi standus - I believe the problem here is you're using the nodeworx login information as authentication to a siteworx action. Rather than

                    $key = array('email'=>'nodeworxadmin','password'=>'hispas sword');

                    you should use

                    $key = array('email'=>'siteworxadmin','password'=>'hispas sword',domain=>'thedomain');

                    Does that help?

                    Paul
                    Paul Oehler
                    InterWorx-CP | http://interworx.com
                    InterWorx Control Panel

                    Comment


                    • #11
                      Ohh I found answer:
                      $params = $key; if($siteworxDomain) { $params = [ 'apikey' => $key, 'domain' => $siteworxDomain]; } $this->_key = $params;
                      Last edited by standus; 07-02-2018, 07:26 AM.
                      Software Development
                      Profesionální redakční systém
                      Aplicus

                      Comment

                      Working...
                      X