I have a working REST API Connection to proxmox. I can create and clone an LXC container just fine using the API.
After cloning a container, I am trying to use the REST API to set the containers IP Address, but it's not working. My NodeJS code is below.
The response I get from the above from the sever is
I am sure I am hitting the correct API endpoint, because if I change the field name from net0 to something not recognised by the API for that endpoint it gives me an error
Can someone provide an example of changing an LXC container IP address using a REST API call.
After cloning a container, I am trying to use the REST API to set the containers IP Address, but it's not working. My NodeJS code is below.
Code:
let formBody = await this.getFormBody({net0: "name=eth0,bridge=vmbr99,ip=192.168.22.1/20,gw=192.168.16.1"})
const proxmoxResponse = await fetch(`https://cloud1.xxxxx.com:8006/api2/json/nodes/cloud1/lxc/${vmid}/config/`, {
method: "PUT",
headers: {
Authorization: "PVEAPIToken=simon@pam!xxxxxx-automation=xxxxxxxxxxxxxxxxxx",
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
Accept: "application/json"
},
body: formBody
})
const responseData = await proxmoxResponse.json()
console.log("issueIpV4: ", responseData)
The response I get from the above from the sever is
Code:
{ data: null }
I am sure I am hitting the correct API endpoint, because if I change the field name from net0 to something not recognised by the API for that endpoint it gives me an error
Code:
{
data: null,
errors: {
ffnet0: 'property is not defined in schema and the schema does not allow additional properties'
}
Can someone provide an example of changing an LXC container IP address using a REST API call.
Last edited: