[pve-devel] way to get all vm configs?

Stefan Priebe - Profihost AG s.priebe at profihost.ag
Fri Dec 6 12:08:11 CET 2013


Am 06.12.2013 11:26, schrieb Dietmar Maurer:
>>> yeah but still how do arrays and hashes be encoded? The key and values
>>> are url encoded - sure but how are values of type array encoded?
>>
>> Oh, I guess easiest way would be to add the ability to post 'JSON' data (use
>> application/json instead of application/x-www-form-urlencoded)
>>
>> see HTTPServer::extract_params()
> 
> For testing, you can simply pass a JSON encoded string:
> 
> commands => "JSON_STRING"
> 
> You can the simple encode the string inside you API call.

Thanks, works fine here.

What is the correct way to call a path then and pass params to it?

Do i have to use this part out of pvesh? But which method to use?

    my ($handler, $info) = PVE::API2->find_handler($method, $dir,
$uri_param);
    if (!$handler || !$info) {
        die "no '$cmd' handler for '$dir'\n";
    }

    my ($node, $remip) = check_proxyto($info, $uri_param);
    return proxy_handler($node, $remip, $dir, $cmd, $args) if $node;

    my $data = $handler->cli_handler("$cmd $dir", $info->{name}, $args,
[], $uri_param, $read_password);

    return if $nooutput;

    warn "200 OK\n"; # always print OK status if successful

Stefan



More information about the pve-devel mailing list