whostmgr hooks metadata
In Cpanel Hooks i can get the full json payload using stdin. and this includes information about the event its category and stage and name for example:
Is there a way to do the same in Whostmgr hooks specifically with the account operations like create / modify / terminate / restore ? I have seen similar output in this thread but with a different event. Is this something enabled with specific events only ? In Whostmgr hook the only way to get the value by get the argv result unlike Cpanel hook which i can get its result using stdin
u'context': {u'category': u'Cpanel', u'stage': u'post', u'event': u'Api2::SubDomain::addsubdomain', u'point': u'main', u'escalateprivs': 1}}
Is there a way to do the same in Whostmgr hooks specifically with the account operations like create / modify / terminate / restore ? I have seen similar output in this thread but with a different event. Is this something enabled with specific events only ? In Whostmgr hook the only way to get the value by get the argv result unlike Cpanel hook which i can get its result using stdin
-
I made it work thanks 0 -
I made it work thanks
Hello, I'm happy to see you were able to obtain the data. Could you let us know the specific solution you found? Thank you.0 -
The hook wont be able to receive the data as input unless you made it listen to the correct event so instead of listening to `createacct` which from whmapi1 you need to listen to `Accounts::Create` otherwise the hook will receive the data as parameters which has a different json structure. So the question might be why the Hook accepts any kind of event even if its not correct ? and How can I get the correct event name? As you can see in the link mentioned in my question Kenneth Power said that the correct event is Accounts::SiteIP::set and not setsiteip. and both worked same as my case with createacct and Accounts::Create but each one of them returns a different json structure. 0 -
Hello, You can find the corresponding API function by turning on debug mode under the "Development" tab in "WHM >> Tweak Settings", performing the specific action you want to hook into via cPanel or WHM, and then watching the output from /usr/local/cpanel/logs/error_log. Here's an example of the output you will see when creating an account: [2017-03-13 12:02:11 -0500] info [whostmgr5] ---debug_hooks--- [2017-03-13 12:02:11 -0500] info [whostmgr5] msg: No hooks found for traversed context [2017-03-13 12:02:11 -0500] info [whostmgr5] context: Whostmgr::Accounts::Create [2017-03-13 12:02:11 -0500] info [whostmgr5] stage: pre [2017-03-13 12:02:12 -0500] info [whostmgr5] ---debug_hooks--- [2017-03-13 12:02:12 -0500] info [whostmgr5] msg: No hooks found for traversed context [2017-03-13 12:02:12 -0500] info [whostmgr5] context: Whostmgr::Accounts::Create [2017-03-13 12:02:12 -0500] info [whostmgr5] stage: post
Thus, in this case it shows that you should use "Accounts::Create". Thank you.0
Please sign in to leave a comment.
Comments
4 comments