[英]How to fix Internal Server Error for BIM 360 using NET Core 2.1.1
I am trying to copy Companies
inside BIM 360 from one account (Source) to another account (Target). 我正在尝试将BIM 360内的
Companies
从一个帐户(源)复制到另一帐户(目标)。 The following code creates a Company inside of the Target account with the same properties as the Source account. 以下代码在目标帐户内创建一个公司,该公司具有与源帐户相同的属性。
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");
The createdTargetCompany
variable contains status code InterServerError
with the following message: 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\\"}"
“ {\\” code \\“:2000,\\” message \\“:\\”错误:重复的键值违反了唯一约束\\\\“ companies_pkey \\\\” \\ nDETAIL:键(id)=(15bf4765-73b8-4940-aec4- 0bcbeeec2bae)已经存在。\\ n \\“}”
I am unsure what the DETAIL: Key (id)
is. 我不确定
DETAIL: Key (id)
是什么。 Any ideas what's causing this and how to fix it? 有什么想法会导致此问题以及如何解决?
From the code I posted in the question above, the Deserialize.DeserializeObject(sourceCompanyInfo.Content, "Company"),
method now no longer gets the Source's Account Id and Company Id. 从我在上述问题中发布的代码,
Deserialize.DeserializeObject(sourceCompanyInfo.Content, "Company"),
方法现在不再获取源的帐户ID和公司ID。 Removing this feature now creates the Companies in the Target account. 现在,删除此功能将在目标帐户中创建公司。
Many thanks to the comments posted regarding this issue. 非常感谢就此问题发表的评论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.