Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Godaddy api authorization error

I am trying to develop client application for GoDaddy based on their API that they provide here https://developer.godaddy.com And I have a problem with simple example, I am trying to use the next PHP code to check if domain available:

use GuzzleHttp\Client;
try {
    $client = new Client([
        'base_uri' => 'https://api.godaddy.com',
    ]);

    $responce = $client->get(
        '/v1/domains/available?domain=example.guru',
        [
            'headers' => [
                'Authorization' => "sso-key $myKey:$mySecret",
                'X-Shopper-Id' => "$myID",
                'Accept' => 'application/json',
            ]
        ]
    );
    echo $responce->getBody();
} catch (Exception $e) {
    echo $e->getMessage();
}

And all the time I get error: "Client error: 401". Same problem I have with using cURL library. I didn't find any online support. I need help with it, can someone explain how I should authorize at their api service? Maybe I need to send any other http headers or additional params?

like image 824
Network_SPY Avatar asked Aug 29 '15 10:08

Network_SPY


People also ask

Can I host an API on GoDaddy?

Overview. The GoDaddy API allows developers to interact with the GoDaddy system in the same way we do. The API can be used by anyone who wants to manage their domains and account or create their own experience for registering, purchasing, and managing domains.

Is GoDaddy API free?

GoDaddy API is offered to all users free of charge. You will need an API Key and Secret to authenticate and authorize your requests.

Where is shopper ID GoDaddy?

The Customer Number in the report is the shopper ID of each sub-account, you can call this API (https://developer.godaddy.com/doc/endpoint/shoppers#/v1/get) to retrieve further information.


1 Answers

Are the key and secret you're using for production? When I go through the process, by default it creates a TEST key/secret, which I think are meant to go against https://api.ote-godaddy.com

If you are using production keys, try doing a manual Curl request from the command like; something like:

curl -H 'Authorization: sso-key {KEY}:{SECRET}' -H 'Content-Type: application/json' https://api.godaddy.com/v1/domains/available?domain=example.guru'

Let us know how it works out!

like image 178
Brian Clifton Avatar answered Oct 20 '22 03:10

Brian Clifton