Correct JSON API Request Godaddy Domain Purchase

1.3k views Asked by At

I already have a JSON but the api always bring me:

{
  "code": "INVALID_AGREEMENT_KEYS",
  "message": "End-user must read and consent to all of the following legal agreements: DNPA",
  "name": "ApiError"
}

I tried with:

{  
   "url": "http://www.secureserver.net/agreements/ShowDoc.aspx?pageid=reg_sa&pl_id=1",
   "agreementKey": "DNRA",
   "content": "..content.."
}

but it gives me this:

{
  "message": "request entity too large",
  "expected": 268149,
  "length": 268149,
  "limit": 102400,
  "type": "entity.too.large"
}

The Json is:

{
  "domain": "sistemasolutions.com",
  "consent": {
     "agreementKeys": [
      "DNRA"
    ],
    "agreedBy": "Luis Gonzalez",
    "agreedAt": "2016-12-24T07:37:43+00:00"
  },
  "period": 1,
  "nameServers": [
    " "
  ],
  "renewAuto": true,
  "privacy": false,
  "contactRegistrant": {
    "nameFirst": "Luis",
    "nameMiddle": "",
    "nameLast": "Gonzalez",
    "organization": "Inquid",
    "jobTitle": "CEO",
    "email": "[email protected]",
    "phone": "4491010645",
    "fax": " ",
    "addressMailing": {
      "address1": "1501 India Street",
      "address2": " ",
      "city": "San Diego",
      "state": "California",
      "postalCode": "92101",
      "country": "US"
    }
  },
  "contactAdmin": {
    "nameFirst": "Luis",
    "nameMiddle": "",
    "nameLast": "Gonzalez",
    "organization": "Inquid",
    "jobTitle": "CEO",
    "email": "[email protected]",
    "phone": "+1.7737374427",
    "fax": " ",
    "addressMailing": {
      "address1": "1501 India Street",
      "address2": " ",
      "city": "San Diego",
      "state": "California",
      "postalCode": "92101",
      "country": "US"
    }
  },
  "contactTech": {
    "nameFirst": "Luis",
    "nameMiddle": "",
    "nameLast": "Gonzalez",
    "organization": "Inquid",
    "jobTitle": "CEO",
    "email": "[email protected]",
    "phone": "+1.7737374427",
    "fax": " ",
    "addressMailing": {
      "address1": "1501 India Street",
      "address2": " ",
      "city": "San Diego",
      "state": "California",
      "postalCode": "92101",
      "country": "US"
    }
  },
  "contactBilling": {
    "nameFirst": "Luis",
    "nameMiddle": "",
    "nameLast": "Gonzalez",
    "organization": "Inquid",
    "jobTitle": "CEO",
    "email": "[email protected]",
    "phone": "+1.7737374427",
    "fax": " ",
    "addressMailing": {
      "address1": "1501 India Street",
      "address2": " ",
      "city": "San Diego",
      "state": "California",
      "postalCode": "92101",
      "country": "US"
    }
  }
}
2

There are 2 answers

0
Luis Gonzalez On BEST ANSWER

The problem was that my json were incorrect and the way to check how it should be is to use the POST method: /v1/domains/purchase/validate in: https://api.godaddy.com/v1/domains/purchase/validate

That is how I realised the wrong part was the date format

"consent": {
     "agreementKeys": [
      "DNRA"
    ],
    "agreedBy": "Luis Gonzalez",
    "agreedAt": "2016-12-24T07:37:43+00:00"
  },

which should be:

"consent": {
     "agreementKeys":["DNRA"],
    "agreedBy": "Luis Gonzalez",
    "agreedAt": "2016-09-22T14:01:54.9571247Z"
  },

And also phone formats were incorrect.

0
AtillaTaha On

The reason for this line is actually rather than formatting, it wants you to read and approve the contract when you set privacy true, since there is no endpoint in it, if you set privacy false, the problem will be solved.