from API Tokens in WHM · cPanel & WHM Developer Portal we get this code:
documentation in API Tokens in WHM · cPanel & WHM Developer Portal say: " Specify either the root user or a reseller user in line 2. "
but: is possible allow execute ONLY THIS COMMAND:

to users NOT reseller ?
my target is execute the command
but just $COMMON_USER_cPanel
not is reseller.
is possible?
Code:
<?PHP
$user = "root";
$token = "MYAPITOKEN";
$query = "https://127.0.0.1:2087/json-api/listaccts?api.version=1";
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
$header[0] = "Authorization: whm $user:$token";
curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
curl_setopt($curl, CURLOPT_URL, $query);
$result = curl_exec($curl);
$http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($http_status != 200) {
echo "[!] Error: " . $http_status . " returned\n";
} else {
$json = json_decode($result);
echo "[+] Current cPanel users on the system:\n";
foreach ($json->{'data'}->{'acct'} as $userdetails) {
echo "\t" . $userdetails->{'user'} . "\n";
}
}
curl_close($curl);
but: is possible allow execute ONLY THIS COMMAND:

to users NOT reseller ?
my target is execute the command
Code:
su - $COMMON_USER_cPanel -s /bin/bash -c 'ubic restart ea-tomcat85'
not is reseller.
is possible?