Issue with create node.js app API DIRECTADMIN

feerdispzoo

Verified User
Joined
Jan 17, 2022
Messages
189
Hi,
I want create node.js app for user via API,. but the problem is:

GuzzleHttp\Exception\ClientException #403​

Client error: `POST http://xxxxxx:2222/CMD_API_APP_INSTALL` resulted in a `403 Forbidden` response:
error=1&text=You%20cannot%20execute%20that%20command&details=The%20request%20you%27ve%20made%20cannot%20be%20executed%20 (truncated...)


1) Request POST send from user level
2) Domain is set as default
3) User is not in cagefs
4) from directadmin panel I can setup node js app without any issue. This is my code:


// Request URL for installing the Node.js app
$url = 'http://xxxxxxxxx:2222/CMD_API_APP_INSTALL';

// Request data to install the Node.js app
$requestDataAppInstall = [
'domain' => $domain,
'app' => 'nodejs',
'type' => 'npm',
'path' => '/',
'version' => '14.20.1', // Specify the desired Node.js version
];

// HTTP request to install the Node.js app using Guzzle
$responseAppInstall = $client->post($url, [
'headers' => [
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => 'Basic ' . $userAuthString, // Use the user's authentication string
],
'form_params' => $requestDataAppInstall,
]);

// Process the response as needed
$responseBodyAppInstall = (string) $responseAppInstall->getBody();


For the update above, in the same way I can create user, extra domain, email account etc, but the problem is only with node.js app

node.js app is installed via CloudLinux selector
 
Last edited:
Back
Top