使用 Autodesk Forge 验证和创建存储桶 API
Authenticating and Creating a Bucket with Autodesk Forge API
我正在学习 Autodesk Forge API。通过一个简单的 C# 应用程序,我可以使用 Forge API 进行身份验证。
var responseString = await
"https://developer.api.autodesk.com/authentication/v1/authenticate"
.PostUrlEncodedAsync(new
{
client_id = Client_ID.Text,
client_secret = Client_Secret.Text,
grant_type = "client_credentials",
scope = "data:read data:write bucket:create bucket:read"
})
.ReceiveJson();
虽然我已明确指定 bucket:read 范围 bucket:read,但进一步调用以检查存储桶是否存在失败并出现错误:-
Http code 403 (Forbidden) with the message "Only the bucket creator is allowed to access this API"
当我尝试创建另一个具有相同名称的存储桶时,它失败了:-
Http Code 409 (Conflict) with the message "Bucket already exists"
有人可以帮我解决这里遗漏的问题吗?
是的,问题是您的存储桶键在所有应用程序和区域中应该是全局唯一的。您可以在 https://developer.autodesk.com/en/docs/data/v2/reference/http/buckets-POST/ 查看文档以了解详细信息,尤其是 Bucket Key 的描述。
我正在学习 Autodesk Forge API。通过一个简单的 C# 应用程序,我可以使用 Forge API 进行身份验证。
var responseString = await
"https://developer.api.autodesk.com/authentication/v1/authenticate"
.PostUrlEncodedAsync(new
{
client_id = Client_ID.Text,
client_secret = Client_Secret.Text,
grant_type = "client_credentials",
scope = "data:read data:write bucket:create bucket:read"
})
.ReceiveJson();
虽然我已明确指定 bucket:read 范围 bucket:read,但进一步调用以检查存储桶是否存在失败并出现错误:-
Http code 403 (Forbidden) with the message "Only the bucket creator is allowed to access this API"
当我尝试创建另一个具有相同名称的存储桶时,它失败了:-
Http Code 409 (Conflict) with the message "Bucket already exists"
有人可以帮我解决这里遗漏的问题吗?
是的,问题是您的存储桶键在所有应用程序和区域中应该是全局唯一的。您可以在 https://developer.autodesk.com/en/docs/data/v2/reference/http/buckets-POST/ 查看文档以了解详细信息,尤其是 Bucket Key 的描述。