Search code examples
godaddy-api

How to register domain using godaddy api


At me a problem, prompt please as I can register the domain through godaddy api. I use the query:

Curl -X GET "https://api.godaddy.com/v1/orders?periodStart=1&periodEnd=2&domain=example.guru&paymentProfileId=1111111&parentOrderId=1&offset=0&limit=25&sort=-createdAt" -H "accept: application/json" -H "X-Market-Id: en-US" -H "Authorization: sso-key [key]:[secret]"

but in return I get 200 with:

"orders":[],"pagination":{"first":"https://api.godaddy.com/v1/orders?periodStart=1&periodEnd=2&domain=example.guru&paymentProfileId=111111111&parentOrderId=1&offset=0&limit=25&sort=-createdAt","last":"https://api.godaddy.com/v1/orders?periodStart=1&periodEnd=2&domain=example.guru&paymentProfileId=111111111&parentOrderId=1&offset=0&limit=25&sort=-createdAt","total":0}}

Please help me with my problem


Solution

  • The request must be:

    curl -X POST -v "https://api.godaddy.com/v1/domains/purchase" -H "accept: application/json" -H "X-Shopper-Id: 158392404" -H "Content-Type: application/json" -H "Authorization: sso-key [key]:[secret]" -d "{ \"consent\": { \"agreedAt\": \"[date]\", \"agreedBy\": \"[your ip]\", \"agreementKeys\": [\"DNRA\"] }, \"contactAdmin\": { \"addressMailing\": { \"address1\": \"[your address1]\", \"address2\": \"\", \"city\": \"[your city]\", \"country\": \"[your country, ex - US]\", \"postalCode\": \"[postcode]\", \"state\": \"[state]\" }, \"email\": \"[email]\", \"fax\": \"\", \"jobTitle\": \"\", \"nameFirst\": \"[name]\", \"nameLast\": \"[nameLast]\", \"nameMiddle\": \"\", \"organization\": \"\", \"phone\": \"[ex: +1.111 111 11111]\" }, \"contactBilling\": { \"addressMailing\": { \"address1\": \"\", \"address2\": \"\", \"city\": \"\", \"country\": \"\", \"postalCode\": \"\", \"state\": \"\" }, \"email\": \"\", \"fax\": \"\", \"jobTitle\": \"\", \"nameFirst\": \"\", \"nameLast\": \"\", \"nameMiddle\": \"\", \"organization\": \"\", \"phone\": \"\" }, \"contactRegistrant\": { \"addressMailing\": { \"address1\": \"\", \"address2\": \"\", \"city\": \"\", \"country\": \"\", \"postalCode\": \"\", \"state\": \"\" }, \"email\": \"\", \"fax\": \"\", \"jobTitle\": \"\", \"nameFirst\": \"\", \"nameLast\": \"\", \"nameMiddle\": \"\", \"organization\": \"\", \"phone\": \"\" }, \"contactTech\": { \"addressMailing\": { \"address1\": \"\", \"address2\": \"\", \"city\": \"\", \"country\": \"\", \"postalCode\": \"\", \"state\": \"\" }, \"email\": \"\", \"fax\": \"\", \"jobTitle\": \"\", \"nameFirst\": \"\", \"nameLast\": \"\", \"nameMiddle\": \"\", \"organization\": \"\", \"phone\": \"\" }, \"domain\": \"[domain]\", \"nameServers\": [ \"ns02.ote.domaincontrol.com\" ], \"period\": 1, \"privacy\": false, \"renewAuto\": true}"
    

    The main thing is that the data coincide with the payment method and the opportunity was activated "good as gold"