Hello.
I am trying to integrate Proxmox API into a PHP based tool we have, and I have been able to create a virtual machine, start it up and create a user.
I want to add the created user to the created VM as an administrator of that machine.
$fields = array(
'user' => "{$username}@pve",
'role' => "Administrator",
'path' => "/qemu/{$vmID}"
);
$vmCreationURL = $this->proxmoxHost . "access/acl";
$response = $this->makeRequest($vmCreationURL, $fields);
The make request function makes a post request using curl, it's the same function I use to make the request for creating a VM or starting it up, as well as creating a user. It handles token addition to the request and other stuff such as parsing the response.
Just as an example, this is the logic for creating a new user:
$fields = array(
'userid' => "{$username}@pve",
'password' => $password
);
$vmCreationURL = $this->proxmoxHost . "access/users";
$response = $this->makeRequest($vmCreationURL, $fields);
Exactly the same formate, just the endpoint changes.
When I do the request to that acl endpoint, I get the following error:
POST value: user=user26%40pve&role=Administrator&path=%2Fqemu%2F10055
Request sent to https://[MY HOST]/api2/json/access/acl
HTTP code: 501
Response header HTTP/1.1 501 Method 'POST /access/acl' not implemented
Cache-Control: max-age=0
Connection: close
Date: Tue, 19 Mar 2019 17:26:42 GMT
Pragma: no-cache
Server: pve-api-daemon/3.0
Content-Length: 13
Content-Type: application/json;charset=UTF-8
Expires: Tue, 19 Mar 2019 17:26:42 GMT
Response Body {"data":null}
Is this the correct URL to post that information to? Am I using the wrong URL, wrong parameters or what am I missing?
Thank you.
I am trying to integrate Proxmox API into a PHP based tool we have, and I have been able to create a virtual machine, start it up and create a user.
I want to add the created user to the created VM as an administrator of that machine.
$fields = array(
'user' => "{$username}@pve",
'role' => "Administrator",
'path' => "/qemu/{$vmID}"
);
$vmCreationURL = $this->proxmoxHost . "access/acl";
$response = $this->makeRequest($vmCreationURL, $fields);
The make request function makes a post request using curl, it's the same function I use to make the request for creating a VM or starting it up, as well as creating a user. It handles token addition to the request and other stuff such as parsing the response.
Just as an example, this is the logic for creating a new user:
$fields = array(
'userid' => "{$username}@pve",
'password' => $password
);
$vmCreationURL = $this->proxmoxHost . "access/users";
$response = $this->makeRequest($vmCreationURL, $fields);
Exactly the same formate, just the endpoint changes.
When I do the request to that acl endpoint, I get the following error:
POST value: user=user26%40pve&role=Administrator&path=%2Fqemu%2F10055
Request sent to https://[MY HOST]/api2/json/access/acl
HTTP code: 501
Response header HTTP/1.1 501 Method 'POST /access/acl' not implemented
Cache-Control: max-age=0
Connection: close
Date: Tue, 19 Mar 2019 17:26:42 GMT
Pragma: no-cache
Server: pve-api-daemon/3.0
Content-Length: 13
Content-Type: application/json;charset=UTF-8
Expires: Tue, 19 Mar 2019 17:26:42 GMT
Response Body {"data":null}
Is this the correct URL to post that information to? Am I using the wrong URL, wrong parameters or what am I missing?
Thank you.