从a360锻造桶下载revit文件

时间:2016-10-13 11:57:07

标签: oauth autodesk revit autodesk-forge autodesk-data-management

如何从我创建的Autodesk A360存储桶下载文件?该文件是Revit项目文件,我使用2脚OAuth进行授权。

2 个答案:

答案 0 :(得分:1)

您需要使用3腿认证来访问A360中的文件,因为您需要获得您正在访问其帐户的用户的批准 - 该用户是第3站。 如果您尝试从OSS上自己应用程序的私人存储桶访问文件,则无需用户批准,因为存储桶属于您的应用而非用户。

作为旁注,如果尝试使用Data Management API访问BIM 360文件(如果您正在谈论的话),那么暂时您需要使用2腿认证,但您的应用需要我们手动批准。

奥古斯托的网络广播涵盖了双腿与三足认证: Introduction to oAuth and Data Management API

答案 1 :(得分:0)

在我将v1更改为v2时尝试创建存储桶后,我没有获得存储桶密钥...

见下文

public static string GetBucket(string accessToken,string bucketKey,string policy)         {

        // (1) Build request 
        var client = new RestClient();
        client.BaseUrl = new System.Uri(baseApiUrl);

        // Set resource/end point
        var request = new RestRequest();
        request.Resource = "oss/v1/buckets";
        request.Method = Method.GET;


        // Add headers  
        request.AddHeader("Authorization", "Bearer " + accessToken);
        request.AddHeader("Content-Type", "application/json"); // MH: skipping this works. 

        // Add JSON body. in simplest form. 
        request.AddJsonBody(new { bucketKey = bucketKey, policy = policy });


        // (2) Execute request and get response
        IRestResponse response = client.Execute(request);
        //TaskDialog.Show("create bucket", response.StatusDescription);

        // Save response. This is to see the response for our learning.
        m_lastResponse = response;

        TaskDialog.Show("response", m_lastResponse.ToString());

        // Get the key = bucket name 
        string key = "";
        if (response.StatusCode == HttpStatusCode.OK)
        {
            JsonDeserializer deserial = new JsonDeserializer();
            OssBucketsResponse bucketsResponse = deserial.Deserialize<OssBucketsResponse>(response);
            key = bucketsResponse.key;
        }




        return key; // the bucket name 
    }