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.

Disable backup accont with xmlapi

Discussion in 'cPanel Developers' started by danielati, Feb 22, 2016.

  1. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Hello,

    I have some accounts in cPanel and all accounts are enabled from backup legacy.

    Exist a way to disable the backup legacy from a specific account using xmlapi?

    I tried the following ways:
    $xmlapi->api1_query("cpanel_account","Backups","toggle_user_backup_state", array('user' => 'cpuser', 'legacy' => 0) );

    $args = array('user'=>'cpuser','BACKUPS'=>0);
    $xmlapi->xmlapi_query('modifyacct', $args);

    Thanks
     
  2. cPDavidN

    cPDavidN cPanel Developer
    Staff Member

    Joined:
    Mar 19, 2013
    Messages:
    42
    Likes Received:
    3
    Trophy Points:
    8
    cPanel Access Level:
    DataCenter Provider
    Hello,

    Thanks for contacting us. Please try this and let us know if it works:

    $xmlapi->xmlapi_query('toggle_user_backup_state', array( 'user' => 'cpuser', 'legacy' => 0 ) );

    Thanks,

    David Nielson
    cPanel developer
     
  3. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner

    Hello David,
    I tried and returned:

    <xml>
    <error>Unknown App Requested for this version (0) of the api: toggle_user_backup_state</error>
    </xml>


    Thanks,

    Daniela
     
    #3 danielati, Feb 22, 2016
    Last edited: Feb 22, 2016
  4. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    David,

    when I try from this way:
    "$xmlapi->api1_query("cpanel_account","Backups","toggle_user_backup_state", array('user' => 'cpuser', 'legacy' => 0) );"
    The returns is something like this:

    <cpanelresult>
    <module>Backups</module>
    <func>toggle_user_backup_state</func>
    <type>event</type>
    <source>internal</source>
    <apiversion>1</apiversion>
    <data>
    <result/>
    </data>
    <event>
    <result>1</result>
    </event>
    </cpanelresult>

    But nothing change in WHM.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    I've confirmed it works with the direct command:

    Code:
    whmapi1 toggle_user_backup_state user=username legacy=0
    Could you post the full script you are using in CODE tags for review?

    Thank you.
     
  6. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Hello Michael :)

    Follow the script....

    <?php
    include("xmlapi.php");

    $ip = "000.000.000.000";
    $xmlapi = new xmlapi($ip);

    $key = 'hash_code';

    $xmlapi = new xmlapi($ip);
    $xmlapi->hash_auth('whm_user',$key);

    $xmlapi->set_output('xml');
    $xmlapi->set_debug(1);
    Header("content-type:text/xml");

    //attempt 1
    //$args = array('user'=>'cpuser','BACKUPS'=>0);
    //print $xmlapi->xmlapi_query('modifyacct', $args);

    //attempt 2
    //print $xmlapi->api1_query("cpuser","Backups","toggle_user_backup_state", array('user' => 'cpuser', 'legacy' => 0) );
    //print $xmlapi->api1_query("cpuser","Backups","toggle_user_backup_state", array('user' => 'cpuser', 'legacy' => 1) );

    //attempt 3
    //print $xmlapi->xmlapi_query('toggle_user_backup_state', array( 'user' => 'cpuser', 'legacy' => 0 ) );

    ?>

    Thanks
     
    #6 danielati, Feb 24, 2016
    Last edited: Feb 24, 2016
  7. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Hello!

    Do you revew my code tags?

    When I try through in browser with the follow command (https://hostname.example.com:2087/c...up_state?api.version=1&user=username&legacy=0), it Works fine, but when I try in PHP using the xmlapi class, it not Works.

    Have you got something?

    Awaiting return....

    Thanks
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
  9. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner

    Hello Michael!

    Ticket ID: 7493837

    Thanks
     
  10. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Hello guys!
    The script work.
    Thank you for your help and the help of ticket support's. You helped me find the solution.
    Follow the correct line:

    print $xmlapi->xmlapi_query('toggle_user_backup_state', array( 'api.version' => 1, 'user' => "username", 'legacy' => 1 ) );

    It was enough to declare the version of the api in the arguments.

    Thanks a lot :) ;-)

    Daniela
     
    #10 danielati, Mar 18, 2016
    Last edited: Mar 18, 2016
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page