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.

UAPI from cPanel hook

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

  1. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    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. cPDavidN

    cPDavidN cPanel Developer
    Staff Member

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

    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
     
Loading...

Share This Page