Hi,
I'm developing a plugin for both WHM and cPanel. The WHM admin can edit plugin global and individual cPanel user settings in WHM, cPanel users can edit only their plugin settings. After reviewing the cPanel & WHM documentation, it seems NVData should be used for saving plugin data.
On the WHM side, I'd like to query cPanel UAPI Personalization::get through the WHM API. However, piping JSON into whmapi1 with uapi_cpanel as the command, results in an error:
I've tried passing the names parameter various ways, but always results in the error below. I understand the error, just wondering if there is a way around this.
"Can't use string XXX as an ARRAY ref while \"strict refs\" in use at /usr/local/cpanel/Cpanel/API/Personalization.pm line 111.\n"
One example of many attempts:
Questions:
1) Is there a way to query UAPI Personalization::get through the WHM API?
2) If #1 is possible, is there a way to use the WHM API batch command with #1? This would be used to query #1 for all cPanel users in one batch command to the WHM API.
3) Since UAPI Personalization::get requires JSON input, is there a way to perform this function with the UAPI batch command?
I'm developing a plugin for both WHM and cPanel. The WHM admin can edit plugin global and individual cPanel user settings in WHM, cPanel users can edit only their plugin settings. After reviewing the cPanel & WHM documentation, it seems NVData should be used for saving plugin data.
On the WHM side, I'd like to query cPanel UAPI Personalization::get through the WHM API. However, piping JSON into whmapi1 with uapi_cpanel as the command, results in an error:
Code:
echo '{"names":["test","test2"]}' | whmapi1 --input=json uapi_cpanel cpanel.function=get cpanel.module=Personalization cpanel.user=xyz
---
metadata:
command: uapi_cpanel
reason: "API failure: uapi_cpanel does not support nested data structures\n"
result: 0
version: 1
"Can't use string XXX as an ARRAY ref while \"strict refs\" in use at /usr/local/cpanel/Cpanel/API/Personalization.pm line 111.\n"
One example of many attempts:
Code:
whmapi1 uapi_cpanel cpanel.function=get cpanel.module=Personalization cpanel.user=xyz names=["test","test2"]
---
data:
uapi:
data: ~
errors:
- "Can't use string (\"[test,test2]\") as an ARRAY ref while \"strict refs\" in use at /usr/local/cpanel/Cpanel/API/Personalization.pm line 111.\n"
messages: ~
metadata: {}
status: 0
warnings: ~
metadata:
command: uapi_cpanel
reason: OK
result: 1
version: 1
1) Is there a way to query UAPI Personalization::get through the WHM API?
2) If #1 is possible, is there a way to use the WHM API batch command with #1? This would be used to query #1 for all cPanel users in one batch command to the WHM API.
3) Since UAPI Personalization::get requires JSON input, is there a way to perform this function with the UAPI batch command?