guzzle / guzzle

Guzzle, an extensible PHP HTTP client

Home Page:https://docs.guzzlephp.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error {"class":"Client::BadRequest","message":"The input provided isn't valid: 'duration' is a required property"}

ysilvela opened this issue · comments

Guzzle version(s) affected: x.y.z
PHP version: x.y.z (hint: php --version) 7.4
cURL version: x.y.z (hint: php -i | grep cURL) support enabled and 7.87.0

Description
When I call to /order/cart/{cartid}/vps function I always obtain error: The input provided isn't valid: 'duration' is a required property but I send this property well:

$this->ovh->post('/order/cart/' .$cartId .'/vps', array('' => '{"duration":"P1M","planCode":"' .$vpsid .'","pricingMode":"default","quantity":1}'));

How can I obtain the valids durations?

How to reproduce
Calling '/order/cart/{cartid}/vps'

Possible Solution
N/A

Additional context
I only execute composer 'require ovh/ovh' to install de SDK

SOLVED:

Wrong format. Correct is:

        $result = $this->ovh->post('/order/cart/' .$cartId .'/vps', 
            array(
                "duration"=> "P1M",
                "planCode"=> trim($vpsid) ,
                "pricingMode"=>"default",
                "quantity"=>1,
                "vps_datacenter" => "GRA",
                "vps_os" => "Ubuntu 19.10"
                
            )
        );