OVHcloud Community

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

Why do I get this response on OVH API?


#1

I’m trying to use the OVH API to allow me to create a new domain. So I got the Application Key (AK) the Application Secret (AS) and the Consumer Key (CK) for “GET/” “PUT/” “POST/” and “DELETE/”.

Here is the code that I’m trying to use:

$client = new Api($this->applicationKey, $this->applicationSecret, $this->apiEndpoint, $this->consumerKey);

    $result = $client->post('/domain/zone/' . $this->zoneName . '/record', [
        'fieldType' => 'A', 
        'subDomain' => $subdomain,
        'target' => $elementIp,
        'ttl' => 0,
    ]);

    $client->post('/domain/zone/' . $this->zoneName . '/refresh');

In this code $subdomain and $elementIp are strings. jbbatteryportugal.com/
Now the problem is that when I try this I receive this response: {“message”:“This call has not been granted”,“httpCode”:“403 Forbidden”,“errorCode”:“NOT_GRANTED_CALL”}

Can someone let me know what I do wrong please ?

EDIT: I finaly found my problem. I use docker and when I changed the AK, AS and CK I didn’t restart the container. Now it works very well.