私は PHP cURL を使用する初心者であり、oAuth を使用する Box.com API 2.0 を利用しようとしています。ユーザーに関する基本情報を返そうとしています。これが私のコードです:
$box_1 = curl_init("https://api.box.com/2.0/users/me");
curl_setopt($box_1, CURLOPT_HTTPHEADER, "Authorization: Bearer token_was_here");
curl_setopt($box_1, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($box_1, CURLOPT_POSTFIELDS, "fields=id,name,login");
$box_curl1 = curl_exec($box_1);
curl_close($box_1);
これを実行すると、次のエラーが発生します。{"type":"error","status":400,"code":"bad_request","context_info":{"errors":[{"reason":"invalid_parameter","name":"entity-body","message":"Invalid value 'fields=id,name,login'. Entity body should be a correctly nested resource attribute name\/value pair"}]},"help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Bad Request","request_id":"request_id_was_here"}
4 行目を削除すると、まったく応答がありません。