Closed Saneesh closed 6 years ago
Sorry, it was the issue in my argument, the correct format is:
$client = new GuzzleHttp\Client([
'base_uri' => 'https://api.gndf.io',
]);
$data = [
'created' => 2
];
$response = $client->post('/api/v1/tables/3453e53wsttwt/decisions', [
'auth' => ['45grt3tetegter', 'dfg34tedrgtdgdfgdfgdfg'],
'headers' => [
'Content-Type' => 'application/json',
'X-Application' => '4tergdrfsfwrfesf3453rfg'
],
//'debug' => TRUE,
'body' => json_encode($data)
]);
$body = $response->getBody()->getContents();
dd($body);
Hi All, My cURL is looks like this for a test rule.
$ curl -u CLIENT_ID:CLIENT_SECRET -H 'X-Application: <applicaiton id>' https://api.gndf.io/api/v1/tables/<some alphanumeric>/decisions \ -d '{"created":8}'
with cURL in PHP it works fine.
But, when I call this from Laravel(GuzzleHttp) the following error is showing.
{"meta":{"code":422,"error":"validation","error_message":"Validation failed"},"data":{"created":["validation.present"]}}
What could be the reason?
Regards, Saneesh