如何使用 NET Core 2.1.1 修复 BIM 360 的内部服务器错误
How to fix Internal Server Error for BIM 360 using NET Core 2.1.1
我正在尝试将 BIM 360 中的 Companies
从一个帐户(源)复制到另一个帐户(目标)。以下代码在目标帐户内创建一个公司,其属性与源帐户相同。
dynamic createdTargetCompany = await Autodesk.Forge.Client.Configuration.Default.ApiClient.CallApiAsync(
"https://developer.api.autodesk.com/hq/v1/accounts/" + targetAccountId + "/companies",
Method.POST,
new Dictionary<string, string>(),
Deserialize.DeserializeObject(sourceCompanyInfo.Content, "Company"),
targetHeaderParams,
new Dictionary<string, string>(),
new Dictionary<string, FileParameter>(),
new Dictionary<string, string>(),
"application/json");
createdTargetCompany
变量包含状态代码 InterServerError
以及以下消息:
"{\"code\":2000,\"message\":\"ERROR: duplicate key value violates unique constraint \"companies_pkey\"\nDETAIL: Key (id)=(15bf4765-73b8-4940-aec4-0bcbeeec2bae) already exists.\n\"}"
我不确定 DETAIL: Key (id)
是什么。知道是什么原因造成的以及如何解决吗?
根据我在上述问题中发布的代码,Deserialize.DeserializeObject(sourceCompanyInfo.Content, "Company"),
方法现在不再获取来源的帐户 ID 和公司 ID。删除此功能现在会在目标帐户中创建公司。
非常感谢有关此问题的评论。
我正在尝试将 BIM 360 中的 Companies
从一个帐户(源)复制到另一个帐户(目标)。以下代码在目标帐户内创建一个公司,其属性与源帐户相同。
dynamic createdTargetCompany = await Autodesk.Forge.Client.Configuration.Default.ApiClient.CallApiAsync(
"https://developer.api.autodesk.com/hq/v1/accounts/" + targetAccountId + "/companies",
Method.POST,
new Dictionary<string, string>(),
Deserialize.DeserializeObject(sourceCompanyInfo.Content, "Company"),
targetHeaderParams,
new Dictionary<string, string>(),
new Dictionary<string, FileParameter>(),
new Dictionary<string, string>(),
"application/json");
createdTargetCompany
变量包含状态代码 InterServerError
以及以下消息:
"{\"code\":2000,\"message\":\"ERROR: duplicate key value violates unique constraint \"companies_pkey\"\nDETAIL: Key (id)=(15bf4765-73b8-4940-aec4-0bcbeeec2bae) already exists.\n\"}"
我不确定 DETAIL: Key (id)
是什么。知道是什么原因造成的以及如何解决吗?
根据我在上述问题中发布的代码,Deserialize.DeserializeObject(sourceCompanyInfo.Content, "Company"),
方法现在不再获取来源的帐户 ID 和公司 ID。删除此功能现在会在目标帐户中创建公司。
非常感谢有关此问题的评论。