API response: {"errors":{"vmid":"property is missing and it is not optional"},"data":null}

Mick Vazovsky

New Member
Feb 10, 2021
9
0
1
44
This request to url (https://10.40.100.95:8006/api2/json/nodes/pve01/qemu) returns an error {"errors":{"vmid":"property is missing and it is not optional"},"data":null},
request for url (https://10.40.100.95:8006/api2/json/nodes), returned an array, what's wrong? in the documentation like everything is correct?

Code:
  var clients = new RestClient("https://10.40.100.95:8006/api2/json/nodes/pve01/qemu");
  clients.Timeout = 10000;
  var requests = new RestRequest(Method.POST);
  requests.AddHeader("Authorization", "PVEAPIToken=test@pve!ddf5959760540181d171d2e2a7adcba4=ad78e07e-a418-41a1-a201-3528154737f2");
  IRestResponse responses = clients.Execute(requests);
  var setting = new JsonSerializerSettings
       {
            NullValueHandling = NullValueHandling.Include
        };
  dynamic stuffs = JsonConvert.DeserializeObject(responses.Content, setting);
  Console.WriteLine(responses.Content.ToString());

{"errors":{"vmid":"property is missing and it is not optional"},"data":null}
 
Last edited:
Hey,

you're right, vmid is optional, but only for GET requests, you're doing POST and there it is required. In the docs(right under the path) there is a tab for GET and one for POST.