I develop website using Laravel 5.5 and Guzzle 6.3.
I encountered a problem when trying to guzzle post nested arrays when trying to do create folder to BOX using API.
$url = $this->api_url . "/folders";
$headers = [
'Authorization' => 'Bearer ' . $this->access_token,
];
$client = new Client();
$response = $client->post($url, [
'headers' => $headers,
'form_params' => [
'name' => $name,
'parent' => [
'id' => $parent_id
]
]
]);
It shows me errors like this:
Entity body should be a correctly nested resource attribute name/value pair
I also already tried using shell_exec
curl so it run curl from command prompt and it gives me same error like this
But when I tried to run from cygwin the curl works fine.
I also can do upload using multipart request nested array works fine.
I don't know why I'm getting with this nested array issue when the nested array works fine with multipart request.
Reference for box documentation POST is here.