2016-09-27 25 views
1

我試圖通過V1 API創建新的Story資產。我收到一個錯誤:VersionOne .NET SDK創建新資產

「未處理的異常:VersionOne.SDK.APIClient.ConnectionException:錯誤寫 到輸出流---> System.Net.WebException:遠程服務器返回一個ER ROR:(400 )錯誤的請求---> VersionOne.SDK.APIClient.APIException:Violation'Re quired'AttributeDefinition'Super'Story」

我設置我的連接器和創建像這樣的資產:

 V1Connector connector = V1Connector 
      .WithInstanceUrl("xxx") 
      .WithUserAgentHeader("NewApp", "1.0") 
      .WithAccessToken("xxx") 
      .UseOAuthEndpoints() 
      .Build(); 

     IServices services = new Services(connector); 

     Oid projectId = services.GetOid("Scope:02284"); 
     IAssetType storyType = services.Meta.GetAssetType("Story"); 
     Asset newStory = services.New(storyType, projectId); 
     IAttributeDefinition nameAttribute = storyType.GetAttributeDefinition("Name"); 
     newStory.SetAttributeValue(nameAttribute, "My New Test Story"); 
     services.Save(newStory); 

發生錯誤在最後一行。我一直試圖弄清楚這一點,我還沒有想出一個解決方案。有人有建議嗎?

這裏是我試圖效仿的鏈接:https://community.versionone.com/VersionOne_Connect/Developer_Library/Get_an_SDK/.NET_SDK/Creating_Assets

回答

1

Violation'Required'AttributeDefinition'Super'Story異常被拋出,因爲你正試圖創建一個故事的資產不填充所需字段,'超'。組織中的某個人將此設爲必需屬性。

查看您的VersionOne項目管理員或使用有效值填充此屬性。爲了確定是否還有其他必填字段,請執行元查詢,並且需要在其旁邊帶有'*'的任何屬性。正如你在這個PNG中看到的,Name和Scope是我唯一需要的屬性。

enter image description here

當你看到你的元數據,你會看到超是一個史詩的關係。

有跡象表明,你可以瞭解VersionOne的元數據

1)http://community.versionone.com/VersionOne_Connect/Developer_Library/Learn_the_API/Meta_API

2)http://YourVersionOneInstance/help/api

BTW兩個地方,一個故事元查詢網址有這樣

https://YourVersionOneInstance/meta.v1/Story?xsl=api.xsl的形狀