3

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":[]}
            ]
}
Joshua Foxworth
  • 1,236
  • 1
  • 22
  • 50

1 Answers1

2

A few things to check here:

  • Did you connect your Forge app to your BIM360 account?

  • Did you provision access for your Forge app to the BIM Docs projects?

  • If you run into issues trouble-shoot per this great read here

Also see here and here for details on all the steps above.

Bryan Huang
  • 5,247
  • 2
  • 15
  • 20
  • 2
    I am still really confused as to what is happening here - especially with respect to where one platform begins and another ends. BIM 360 is "Construction Management Software", so how is it even related to connecting to Fusion 360 files? If there is a difference between standard Fusion 360 docs and BIM360 docs, then how do I access the standard Fusion docs? To my knowledge, I don't have a BIM 360 account and I don't understand why I need one to access the files of other users through a forge account API? – Joshua Foxworth Mar 29 '19 at 05:08
  • 1
    To round that out ... I just want to access a user's Fusion 360 files and I can't seem to get anyone to answer the question as to how that is done. – Joshua Foxworth Mar 29 '19 at 05:47
  • 1
    You are doing a 2 legged token, Hubs endpoint with this kind of token will give you only BIM 360 Docs results, which you don't have enabled, but also you don't need. So, do a 3 legged authentication, with that kind of token you will be able to access the Fusion Files, now to access the ones from the User, the User will be the one will need to login which is basically authorizing the developer(in this case you) to have access to their data, there is no other way around per security reasons. You cannot specify a user ID for Fusion files. – Jaime Rosales Mar 29 '19 at 17:48
  • Any new information on this? It is not working when testing with Postman using 3-legged authorization Getting exactly the same response. – Dido Nenov Oct 20 '22 at 15:10