cPanel::APIClient::Response::WHM1
This class represents a response to a WHM API v1 call.
Returns an error message, or undef if the API call succeeded. Note that this accommodates the case of a malformed API response and will give appropriate generic error messages in those cases.
This method is how you should determine whether an API call succeeded.
Returns the API payload.
This “reduces” the API payload when the raw payload from the API is a single-member hash whose only value is an array reference. So if the API’s raw data is:
data
{ payload => [ 'foo', 'bar' ] }
… then the return from this accessor will be:
[ 'foo', 'bar' ]
This “reduction” only happens for this particular pattern; it doesn’t happen, for example, when the single-member hash’s value is any other data type.
Like get_data() but gives the verbatim data structure. Intended for use in proxying situations; application logic should usually prefer get_data().
get_data()
Interprets the API response as from the batch API call and returns a list of instances of this class that represents the elements of that response.
batch
Returns a reference to an array of two-member arrays, thus:
[ [ info => 'Hey, by the way …' ], [ warn => 'Hey, this might cause a problem …' ], ]
The first value of each two-member array is either info or warn, and the value is the actual message. Note that error messages are not part of this structure; for that, use get_error().
info
warn
get_error()
This follows a pattern from CJT1 and CJT2.
Copyright 2020 cPanel, L. L. C. All rights reserved. http://cpanel.net
This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install cPanel::APIClient, copy and paste the appropriate command in to your terminal.
cpanm
cpanm cPanel::APIClient
CPAN shell
perl -MCPAN -e shell install cPanel::APIClient
For more information on module installation, please visit the detailed CPAN module installation guide.