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!

create an api whm object.

Discussion in 'cPanel Developers' started by Guda, May 22, 2015.

  1. Guda

    Guda Member
    PartnerNOC

    Joined:
    Aug 16, 2001
    Messages:
    20
    Likes Received:
    1
    Trophy Points:
    303
    Trying to create an whm api object in a custom module. Is this possible, this method would actually be used for a Account::Create hook rollback. If the hook fails I want to terminate the newly activated account.

    Looking to do something along the lines of.

    package Cpanel::MyModule;

    use Cpanel ();

    sub method {
    my ($params) = @_;

    my $cpanel = Cpanel->new;
    return $cpanel->api(method => 'terminateaccnt' );

    }

    1;
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,749
    Likes Received:
    1,885
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    The following document is a good place to get started if you want to use standardized hooks:

    Guide to Standardized Hooks

    You can implement a post account creation hook that terminates an account if certain criteria is not met.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Guda

    Guda Member
    PartnerNOC

    Joined:
    Aug 16, 2001
    Messages:
    20
    Likes Received:
    1
    Trophy Points:
    303
    lol, I know where the docs are.... I also know that I can implement a post account creation hook that terminates an account if certain criteria is not met. I mean geez... thats what got me here int he first place. You didnt answer any part of my question just lol.. I dont even know what kind of response it was you sent.. just.. totally dodging the question.

    anyways.. so again..

    1. I create an account.
    2. post account hook fails.
    3. i want to now terminate the account that was created prior to the account::create hook failure.

    according to your docs you can do this by defining a rollback action. So what exactly triggers the rollback definition to execute? return value from the hook? if so, then what kind of return value? do you have examples?

    Also, if I am creating a custom module to be put in in /usr/local/cpanel/Cpanel, what code would i use to create a dispatch object that I can use to access the api.
     
    cadomagenge likes this.
  4. Guda

    Guda Member
    PartnerNOC

    Joined:
    Aug 16, 2001
    Messages:
    20
    Likes Received:
    1
    Trophy Points:
    303
    this is resolved.
     
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,749
    Likes Received:
    1,885
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Would you mind sharing the resolution or letting us know the ticket number so we can update this thread for other users who encounter a similar issue?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

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