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

    Default cpanel api error please help

    I am use perl Cpanel::PublicAPI and get the following error message

    The server was not able to find the document (./-api/cpanel) you requested.
    Please check the url and try again. You might also want to report this
    error to your web hosting provider.

    may I ask what is actually wrong with this

    Great Thanks

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

    Default Re: cpanel api error please help

    Hi Andy,

    Since all remote API calls to cPanel start either as json-api/cpanel or xml-api/cpanel, I assume is misconfigured in your code. Or it's possible that you've found a bug in Cpanel::PublicAPI. Please provide an example so we can pinpoint the problem.

    Best 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

  3. #3
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Sep 2007
    Posts
    139

    Default Re: cpanel api error please help

    Basically, u just need to set the output to xml, like the following:

    my $xml_add_database = $cp->cpanel_api1_request('cpanel', { 'module' => 'Mysql', 'func' => 'adddb' }, [ "$db_name" ], 'xml');



    It doesn't have a return type set by default so it is not using xml-api as part of the url and just trying to use -api.

  4. #4
    Registered User
    Join Date
    Aug 2011
    Posts
    3

    Default Re: cpanel api error please help

    here is my code :
    just copy from the instruction
    =====================================

    #!/usr/bin/perl -w
    use lib ("test");
    use cPanel::PublicAPI;
    my $cp = cPanel::PublicAPI->new('user' => 'waylinks', 'pass' => 'np55cg55');
    $cp->cpanel_api1_request('cpanel',
    {
    'module' => 'Mysql',
    'func' => 'adduserdb',
    },
    [ 'waylinks_db', 'waylinks_ttttt', 'ALL' ]
    );

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

    Default Re: cpanel api error please help

    I found the error there should be a 'xml' follow the parameters

    Great tks

  6. #6
    Registered User
    Join Date
    Oct 2011
    Posts
    4
    cPanel/Enkompass Access Level

    Website Owner

    Default Re: cpanel api error please help

    Quote Originally Posted by cPanelDavidN View Post
    Since all remote API calls to cPanel start either as json-api/cpanel or xml-api/cpanel, I assume is misconfigured in your code. Or it's possible that you've found a bug in Cpanel::PublicAPI.
    It's either a bug in the module or in the documentation. The latter states in cpanel_api1_request():

    $format - The format for the xml-api to respond in. The valid values here are “xml”, “json” or “ref” (perl hash reference). This will default to returning a perl hash reference when the value is undef.
    If no $format is specified, it appears the mod should default to JSON (by looking at sub _init_serializer) and hashes. But, in PublicAPI.pm, line 437, $CFG{'serializer'} is used before it's initialized (in line 440), so instead of being defaulted it's left blank. Looks like someone didn't check their code with warnings enabled.

    So, either swap the order (preferred) or change the docs to make $format required.

    Matt

Similar Threads & Tags
Similar threads

  1. Error While integrating WHM using cPanel API
    By manigandan in forum cPanel Developers
    Replies: 5
    Last Post: 02-01-2011, 02:38 PM
  2. Error While integrating WHM using cPanel API
    By manigandan in forum New User Questions
    Replies: 2
    Last Post: 01-31-2011, 02:53 AM
  3. Error While integrating WHM using cPanel API
    By manigandan in forum Database Discussions
    Replies: 2
    Last Post: 01-31-2011, 02:53 AM
  4. api file_get_contents() error
    By danny0n in forum cPanel Developers
    Replies: 5
    Last Post: 07-13-2010, 12:40 PM
  5. Error detection in API 1
    By k_shehadeh in forum cPanel Developers
    Replies: 1
    Last Post: 05-28-2009, 02:27 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube