重命名 BIM360 文件时出错
Error on rename BIM360 file
我正在尝试使用此端点重命名 BIM360 帐户上的文件 link
但是每次请求return这条消息:
{
"jsonapi":{
"version":"1.0"
},
"errors":[
{
"id":"8b976b03-ed82-425b-819d-e0e62f931182",
"status":"400",
"code":"BAD_INPUT",
"title":"One or more input values in the request were bad",
"detail":"Request input is invalid for this operation."
}
]
}
使用的方法:
public async Task RenameFile(string newFileName, string projectId, string itemId)
{
if (string.IsNullOrEmpty(projectId) || string.IsNullOrEmpty(itemId) ||
string.IsNullOrEmpty(newFileName)) return;
var body = JObject.FromObject(new {
jsonapi = new
{
version = "1.0"
},
data = new
{
type = "items",
id = itemId,
attributes = new
{
displayName = newFileName
}
}
});
var client = new RestClient(BaseUrl);
var request = new RestRequest("/data/v1/projects/{project_id}/items/{item_id}", Method.PATCH);
request.AddHeader("Authorization", "Bearer " + TokenBim360.AccessToken);
request.AddUrlSegment("project_id", projectId);
request.AddUrlSegment("item_id", itemId);
request.AddParameter("application/vnd.api+json", body.ToString(Formatting.None), ParameterType.RequestBody);
var response = await client.ExecuteTaskAsync(request);
}
最奇怪的是相同的代码在 A360 中工作正常...
我做错了什么?
不幸的是,用于在 BIM 360 上更新名称的 PATCH 仅适用于文件夹。无法从 API 更新文件名。您没有做错任何事,只是功能不可用。我会和工程团队谈谈,因为这个请求也来自其他开发人员,考虑在下一个版本中添加。
我正在尝试使用此端点重命名 BIM360 帐户上的文件 link
但是每次请求return这条消息:
{
"jsonapi":{
"version":"1.0"
},
"errors":[
{
"id":"8b976b03-ed82-425b-819d-e0e62f931182",
"status":"400",
"code":"BAD_INPUT",
"title":"One or more input values in the request were bad",
"detail":"Request input is invalid for this operation."
}
]
}
使用的方法:
public async Task RenameFile(string newFileName, string projectId, string itemId)
{
if (string.IsNullOrEmpty(projectId) || string.IsNullOrEmpty(itemId) ||
string.IsNullOrEmpty(newFileName)) return;
var body = JObject.FromObject(new {
jsonapi = new
{
version = "1.0"
},
data = new
{
type = "items",
id = itemId,
attributes = new
{
displayName = newFileName
}
}
});
var client = new RestClient(BaseUrl);
var request = new RestRequest("/data/v1/projects/{project_id}/items/{item_id}", Method.PATCH);
request.AddHeader("Authorization", "Bearer " + TokenBim360.AccessToken);
request.AddUrlSegment("project_id", projectId);
request.AddUrlSegment("item_id", itemId);
request.AddParameter("application/vnd.api+json", body.ToString(Formatting.None), ParameterType.RequestBody);
var response = await client.ExecuteTaskAsync(request);
}
最奇怪的是相同的代码在 A360 中工作正常...
我做错了什么?
不幸的是,用于在 BIM 360 上更新名称的 PATCH 仅适用于文件夹。无法从 API 更新文件名。您没有做错任何事,只是功能不可用。我会和工程团队谈谈,因为这个请求也来自其他开发人员,考虑在下一个版本中添加。