OVH Community

Welcome to your community space. Ask questions, search for information, post content, and interact with other OVH Community members.

Problem api post renew domain


#1

Hello, I have a problem with the ovh api, I would like to integrate in our CRM the possibility of renewing domains directly using the API, following the guides I am trying this script to renew the service linked to a domain but I receive an error.

{“message”:"[services] ServiceId Data is not an array for an array type"}

require DIR . ‘/vendor/autoload.php’;
use \Ovh\Api;

$ovh = new Api( $applicationKey,
                $applicationSecret,
                $endpoint,
                $consumer_key);

//$result = $ovh->get('/service/14991863/renew', array(
//    'includeOptions' => false, // Include service's option(s) (type: boolean)
//));

try {
    $result = $ovh->post('/service/14991863/renew', array(
    'dryRun' => false, // Indicates if renew order is generated (type: boolean)
    'duration' => 'P1Y', // Renew duration (type: string)
    'services' => '[14991863]', // List of services to renew (type: long[])
));
} catch (GuzzleHttp\Exception\ClientException $e) {
    $response = $e->getResponse();
    $responseBodyAsString = $response->getBody()->getContents();
    echo $responseBodyAsString;
}