title: GODADDY DOMAIN API for Purchase is getting 400 Bad Request client error
body: <p>[03-Jul-2019 09:27:28 UTC] error printed :Client error: <code>POST https://api.godaddy.com/v1/domains/purchase</code> resulted in a <code>400 Bad Request</code> response:
  {"code":400,"message":"parsing body body from \"\" failed, because invalid character 'd' looking for beginning of value"}</p>
  
  <p>Only on Purchase route, rest all routes are working fine ex: domain, available </p>
  
  <p>WHM OS Version : CENTOS 6.10 KVM [server]  v78.0.13
  Language: PHP 7.0
  client to hit API Used: Guzzle Client</p>
  
  <p>Here is my Guzzle code:-</p>
  
  <pre><code>try { $contactRegistrant = [ "nameFirst" =&gt; $row ['user_first_name'], "nameMiddle" =&gt; $row ['user_middle_name'], "nameLast" =&gt; $row ['user_last_name'], "organization" =&gt; $row ['user_organization'], "jobTitle" =&gt; $row ['user_job'], "email" =&gt; $row ['user_email'], "phone" =&gt; $row ['user_phone'], "fax" =&gt; "", "addressMailing" =&gt; [ "address1" =&gt; $row ['user_address1'], "address2" =&gt; '', "city" =&gt; $row ['user_city'], "state" =&gt; $row ['user_state'], "postalCode" =&gt; $row ['user_postal_code'], "country" =&gt; $row ['user_country'] ] ];
  
  
  
  
  
  $form_params = [ 
            "domain" =&gt; $domain,
            "consent" =&gt; [ 
                    "agreementKeys" =&gt; [ 
                            $agreement-&gt;key 
                    ],
                    "agreedBy" =&gt; $agreedBy,
                    "agreedAt" =&gt; "2017-08-17T05:46:12Z" 
            ],
            // "period"=&gt;1,
            "nameServers" =&gt; [
                    $nameServer1,
                    $nameServer2 
            ],
            // "renewAuto"=&gt; 'true',
            // "privacy"=&gt; 'true',
            "contactRegistrant" =&gt; $contactRegistrant,
            "contactAdmin" =&gt; $contactRegistrant,
            "contactTech" =&gt; $contactRegistrant,
            "contactBilling" =&gt; $contactRegistrant 
    ];
  
  
  
    $headers = [ 
            'Authorization' =&gt; "sso-key $AKEY:$SKEY",
            'Content-Type' =&gt; 'application/json',
            'X-Shopper-Id' =&gt; '?????????' 
    ];
    $url = 'v1/domains/purchase';
    //https://developer.godaddy.com/doc/endpoint/domains#/v1/purchase
  
    // Hitting the GODADDY REST API Using Guzzel CLIENT 
    $client = new GuzzleHttp\Client ( [ 
            'base_uri' =&gt; 'https://api.godaddy.com',
            'verify' =&gt; true 
    ] );
  
    $responce = $client-&gt;post ( $url, [ 
            'headers' =&gt; $headers,
            'form_params' =&gt; $form_params 
    ] );
  
    error_log ( 'godaddy response:' . json_encode ( $responce ) );
    return $responce-&gt;getBody ();
  } catch ( Exception $e ) {
    error_log ( 'error printed :' . $e-&gt;getMessage () );
  }
  </code></pre>