Я пытался опубликовать новый дефект в Rally через Rest .net api с помощью следующего кода:
var api = new RallyRestApi("<myusername>", "<mypassword>", "https://community.rallydev.com");
var defect = new DynamicJsonObject();
defect["Name"] = "Sample Defect";
defect["Description"] = "Test posting defect without required field value";
defect["Project"] = "https://trial.rallydev.com/slm/webservice/1.29/project/5808130051.js";
defect["SubmittedBy"] = "https://trial.rallydev.com/slm/webservice/1.29/user/5797741589.js";
defect["ScheduleState"] = "In-Progress";
defect["State"] = "Open";
CreateResult creationResult = api.Create("defect", defect);
Но API выдает странное исключение:
System.Collections.Generic.KeyNotFoundException was unhandled
Message=The given key was not present in the dictionary.
Source=mscorlib
StackTrace:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Rally.RestApi.DynamicJsonObject.GetMember(String name)
at Rally.RestApi.DynamicJsonObject.TryGetMember(GetMemberBinder binder, Object& result)
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at Rally.RestApi.RallyRestApi.Create(String type, DynamicJsonObject obj)
at RallyIntegrationSample.Program.Main(String[] args) in D:\Projects\qTrace\References\Samples\RallyIntegrationSample\Program.cs:line 24
Проблема в том, что когда я извлек файл журнала трассировки в Rally, он показал, что именно неправильно в запросе на публикацию:
Rally.RestApi Post Response:
{
"CreateResult":
{
"_rallyAPIMajor":"1",
"_rallyAPIMinor":"29",
"Errors":["Validation error: Defect.Severity should not be null"],
"Warnings":[]
}
}
Вместо того, чтобы дать соответствующий объект CreateResult с соответствующей информацией об ошибках в его свойстве, RallyRest .Net Api выдает непредвиденное исключение.
Это ошибка в Rally rest .net api или я должен предпринять какие-либо дополнительные шаги для плавного получения CreatResult в случае каких-либо ошибок, возвращенных службой Rally?
Большое спасибо за вашу помощь.