Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

UAPI from cPanel hook

Discussion in 'cPanel Developers' started by sparek-3, Jul 23, 2015.

  1. sparek-3

    sparek-3 Well-Known Member

    Aug 10, 2002
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Is there a way to make a direct UAPI call from a cPanel hook, without having to connect via cURL?

    This may not be possible to do, I'm not sure if I'm missing something or not.

    I'm wanting to call the UAPI function cPGreyList::disable_domains in an Api2::AddonDomain::addaddondomain hook

    How do you call this without somehow obtaining the account's password to instantiate a cPanel connection with cURL?

    I can do it by using root and root's access hash, but this requires escalated privileges, which is not really ideal.

    Just wondering if I'm missing something.
  2. DavidN.

    DavidN. Active Member

    Mar 19, 2013
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    DataCenter Provider

    If you're writing this as a Perl module, you can 'use Cpanel::API' and invoke a UAPI function with Cpanel::API::execute('cPGreyList', 'disable_domains', { 'domains' => 'domain.tld' } );

    Unfortunately, hook scripts do not have access to this. If you have more questions, please feel free to ask. Thanks!

    David Nielson
    Integration Developer, cPanel
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice