Create Group API does not work
AnsweredHi
When using the Create Group API I get this message:
-
Ahh, I see the problem — per the Create Group API documentation, the name is a body parameter, not a query string parameter. You'll need to move that into the POST body as JSON, e.g.
{"name": "Beer"}
Does that work for you?
-
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.box.com/2.0/groups'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"name\": \"Box Employees\", \"provenance\": \"Google\", \"external_sync_identifier\": \"Google-Box-Users\", \"description\": \"All box Users\", \"invitability_level\": \"admins_and_members\", \"member_viewability_level\": \"admins_only\"}"); $headers = array(); $headers[] = 'Authorization: Bearer Em90kUhK96fiAlTTqNEPrb9tJEI4GntE'; $headers[] = 'Content-Type: application/x-www-form-urlencoded'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch);
its show empty result on curl function
Please sign in to leave a comment.
Comments
5 comments