I am trying to use the GET hubs API endpoint. I am running Laravel on the back end and using Guzzle to send requests. This has worked fine with getting the three legged token and user profile. However, when I send the GET request for a user's hubs with Guzzle, it returns a 200 status with no content.
I tried sending a regular curl and got the response that I did not have permission to access that API. I am not sure if this is a setting on my end, or something that has to be addressed in my forge settings?
Curl:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer '.$obj->access_token,
'x-user-id:'.$userObj->userId
));
$response = curl_exec ($ch);
$err = curl_error($ch); //if you need
curl_close ($ch);
Response:
{"warnings":[{ "Id":null,
"HttpStatusCode":"403",
"ErrorCode":"BIM360DM_ERROR",
"Title":"Unable to get hubs from BIM360DM US.",
"Detail":"You don't have permission to access this API",
"AboutLink":null,
"Source":[],
"meta":[]},
{"Id":null,
"HttpStatusCode":"403",
"ErrorCode":"BIM360DM_ERROR",
"Title":"Unable to get hubs from BIM360DM EMEA.",
"Detail":"You don't have permission to access this API",
"AboutLink":null,
"Source":[],
"meta":[]}
]
}