-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no support for optional settings in GET request #8
Comments
The workaround for this is to add such arguments to the query string: $pve2->get("/cluster/resources?type=vm");
$pve2->get("/nodes/localhost/storage/local/content?content=vztmpl");
$pve2->get("/nodes/localhost/bootlog?limit=3&start=5");
$pve2->get("/nodes/localhost/rrd?cf=average"); But yes, this should be handled internally. |
@CpuID - Want me to tackle this one, or do you have it covered? |
My gut feeling is just appending to the ->get() call first parameter makes sense here? I can understand the elegance of having it natively supported for example as a second optional array parameter to function get (), but it feels like it may blow out logic wise...? Chances are the only thing you would do within the get() function is append to action_path before sending to ->action() anyway...? |
@danhunsaker - I'll let you tackle it if you like :) |
make it as the put function , in my own script , i just used the same logic of put postfields before sending the request . any way if is implemented it will be a good option . |
Addresses GitHub Issue CpuID#8 - Set parameters as CURLOPT_POSTFIELDS, which cURL will automatically translate into the URL query string. This lets us pass the ?params versus ¶ms logic off to cURL, which makes the code easier to maintain. - Allow all parameters passed to be empty by making the argument optional on GET, POST, and PUT. This is mostly for consistency. Signed-off-by: Daniel Hunsaker <[email protected]>
Addresses GitHub issue CpuID#8 - cURL appears to not (or at least to no longer) actually support turning POSTFIELDS into query string parameters, so we have to build the query string ourselves. This update does just that. Signed-off-by: Daniel Hunsaker <[email protected]>
@naja7host, @CpuID - I've submitted a PR for this (#12) if you would be willing to check it out. I'll merge it in a few days if there's no feedback suggesting otherwise. |
i have tested it , work like a charm :) edit : not working the paramaitre |
it not working , because the class send the first request $action_path before the the switch case . so the get parametre is set later , and it should build with the $action_path before it sended . moving the line to the end of switch case , do the trick . curl_setopt($prox_ch, CURLOPT_URL, "https://{$this->hostname}:{$this->port}/api2/json{$action_path}"); |
is still not working , any one tested the optional settings in GET request ? |
Addresses GitHub Issue CpuID#8 - Set parameters as CURLOPT_POSTFIELDS, which cURL will automatically translate into the URL query string. This lets us pass the ?params versus ¶ms logic off to cURL, which makes the code easier to maintain. - Allow all parameters passed to be empty by making the argument optional on GET, POST, and PUT. This is mostly for consistency. Signed-off-by: Daniel Hunsaker <[email protected]>
Addresses GitHub issue CpuID#8 - cURL appears to not (or at least to no longer) actually support turning POSTFIELDS into query string parameters, so we have to build the query string ourselves. This update does just that. Signed-off-by: Daniel Hunsaker <[email protected]>
some GET request support additional setting , but in the class no support for this .
GET exemple with additional setting
pvesh get /cluster/resources -type vm
pvesh get /nodes/localhost/storage/local/content -content vztmpl
pvesh get /nodes/localhost/bootlog -limit 3 -start 5
pvesh get /nodes/localhost/rrd -cf average
The text was updated successfully, but these errors were encountered: