I am using an API in which i faced an issue.
//CODE//
$data = array(
"unit" => "10",
"item_type" => "inventory",
"product_type" =>"goods",
"is_taxable" => "true",
"description" => "product description",
"purchase_account_id" => '123',
"inventory_account_id" => '1235',
"name" => 'hibiscus',
"rate" => '10',
);
$data_string = json_encode($data);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data_string));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded") );
//END CODE//
By this i received an erorr:
{"code":4,"message":"Invalid value passed for JSONString"}
Will you please let me know asap what i am doing wrong. I also searched about same issue but no luck.