1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

[API Plesk] How to add a subdomain (alias domen)?

Discussion in 'Plesk for Linux - 8.x and Older' started by gcc4, Jul 12, 2010.

  1. gcc4

    gcc4 Guest

    0
     
    HI!

    I found:
    http://forum.parallels.com/pda/index.php/t-81079.html


    Can you please tell how to add a subdomain to an existing domain?
    http://search.cpan.org/~nrg/API-Plesk-1.09...omainAliases.pm

    try:
    Code:
    #!/usr/bin/perl
    
    
    
    use API::Plesk;
    
    #use API::Plesk::Response;
    
    use API::Plesk::DomainAliases;
    
    use Data::Dumper;
    
    
    my ($plesk_ver, $plesk_user, $plesk_pass, $plesk_url) = qw(1.5.0.0 user pass https://s.s.com/login_up.php3);
    
    
    my ($domain, $username, $ftp_user, $ftp_pass, $ip, $dom_template) = ($ARGV[0], $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5]);
    
    
    my $plesk_client = API::Plesk->new('api_version'=>$plesk_ver,'username'=>$plesk_user,'password'=>$plesk_pass,'url'=>$plesk_url,'debug'=>'1','request_debug'=>'1' );
    
    #print Dumper $plesk_client;
    
     my $res = $plesk_client->DomainAliases->create(
        domain_name  => 'v.com',
     );
    
    #    my $res = $plesk_client->Func_Module->operation_type(%params);
    
     print Dumper $res;
    
    
    #   print $res->is_success;
        
       # my $a = $res->get_data; # return arr ref of answer blocks
       
    #   print $a;
        
    
    $res->is_success ? my $userid = $res->get_data->[0]{'id'} : print $res->get_error_string, " \n";
    
    print $userid;
    

    I return:
    Code:
    plesk_query: blank request 
    
    what's wrong?


    what is the possibility to add a subdomain of an existing domain?

    through the API? (perl,php,etc)
    be an example?
     
  2. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,568
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    Do you mean Parallels Small Business Panel or Parallels Plesk Panel?
     
  3. gcc4

    gcc4 Guest

    0
     
    Excuse me, please:
    'Parallels Plesk Panel' hosting

    (...there is a accaunt someone wrote...)
     
  4. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,568
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
  5. gcc4

    gcc4 Guest

    0
     
    Code:
    .........
    <domain_id>1</domain_id>
    .........
    
    I have a domain, but I do not know what his ID, how do you know what ID from a specific domain?
     
  6. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,568
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    You can find domain ID if you put mouse pointer over domain name and you will see ID in browser's status bar.
     
  7. gcc4

    gcc4 Guest

    0
     
    I brought a mouse in firefox3
    was there ID .....

    but as you can see more?
     
  8. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,568
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    Look at browser status bar. You will see dimain@8 or domain@17 there. It is domain ID (8,17).
     
  9. gcc4

    gcc4 Guest

    0
     
    Code:
    <?php
    
    $host="s.com";
    $login="name";
    $passwd="111111";
    $port=8443;
    
    $data = <<<EOF
    <packet version="1.4.2.0">
    <mail>
    <create>
    <filter>
    <domain_id>308</domain_id>
    <mailname>
    <name>test2.domain.com</name>
    <cp_access>
    <enabled>true</enabled>
    </cp_access>
    </mailname>
    </filter>
    </create>
    </mail>
    </packet>
    EOF;
    
    function write_callback($ch, $data) {
    echo $data;
    return strlen($data);
    }
    
    function sendCommand($data, $login, $passwd, $host, $port=8443) {
    $script = "login.php";
    $url = "https://$host:$port/$script";
    $headers = array(
    "HTTP_AUTH_OP: $operator",
    "HTTP_AUTH_LOGIN: $login",
    "HTTP_AUTH_PASSWD: $passwd",
    "HTTP_PRETTY_PRINT: TRUE",
    "Content-Type: text/xml",
    );
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_HTTPHEADER, &$headers);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_WRITEFUNCTION, write_callback);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    $result = curl_exec($ch);
    if (!$result) {
    echo "\n\n-------------------------\ncURL error number:".curl_errno($ch);
    echo "\n\ncURL error:".curl_error($ch);
    }
    curl_close($ch);
    return;
    }
    sendCommand($data, $login, $pass, $host, $port);
    
    ?>


    my username and password 100% correct

    why not work?
     
  10. gcc4

    gcc4 Guest

    0
     
    show you you have it working? what could be the problem?

    Can there be a problem with different versions of the API plesk??

    developers test your API? why not write more examples?

    (Although I'll try to still be my problem)
     
  11. gcc4

    gcc4 Guest

    0
     
    show you how to work through the API? what to do with this error?
     
  12. taghij

    taghij New Pleskian

    3
    20%
    Joined:
    Aug 7, 2014
    Messages:
    2
    Likes Received:
    0
    I'm trying to create a subdomain using C# in Parallels Plesk Panel 11.
    Which username and Password should i enter for the requests I'm sending?!
    What ever username and password I enter I receive " You have entered incorrect username or password. " error...
    Can I interact with the panel as a normal user? or do I need a special authority from the administrators?
    My current access level to the panel is OWNER
     
Loading...