Inflectra Customer Forums: REST API creating test sets (Thread) Hello, I'm a novice user of SpiraTeam as my organization have selected it as our main tool for requirements / test case generation. I've begun looking at the available REST API and am attempting to utilize it to create a simple test set. I'm a bit confused with all the elements in the request payload and would hope to get some guidance and clarity. I'm specifically looking at: POST: projects/{project_id}/test-sets?parent_test_set_folder_id={parent_test_set_folder_id} I've tried the following POST Request: http://hostname/SpiraTeam/Services/v4_0/RestService.svc/projects/284/test-sets?parent_test_set_folder_id=13242 Headers: Cache-Control: no-cache username: johndoe api-key: {187FC923-CE4F-4FCA-BEF0-73D7A37055F2} Accept: application/json Content-Type: application/json Post Body: {"ArtifactTypeId": 8, "ConcurrencyDate": "/Date(1432130443523-0700)/", "CustomProperties": [0], "ProjectId": 284, "AutomationHostId": null, "CountBlocked": 0, "CountCaution": 0, "CountFailed": 0, "CountNotApplicable": 0, "CountNotRun": 0, "CountPassed": 0, "CreationDate": "/Date(1432130413227-0700)/", "CreatorId": 968, "CreatorName": "John Doe", "Description": null, "ExecutionDate": null, "Folder": false, "IndentLevel": "AAJAAAs", "LastUpdateDate": "/Date(1432130443523-0700)/", "Name": "RESTAPI", "OwnerId": null, "OwnerName": null, "PlannedDate": null, "ProjectName": "Test Project", "RecurrenceId": null, "RecurrenceName": null, "ReleaseId": null, "ReleaseVersionNumber": null, "TestRunTypeId": null, "TestSetId": null, "TestSetStatusId": 3, "TestSetStatusName": "Completed"} What is a valid request body? I'm receiving the following error. Any help pointing me in the right direction would be greatly appreciated. I don't have access to the server logs so I can not view more details to see where the issue is. Request Error The server encountered an error processing the request. The exception message is 'Expecting state 'Element'.. Encountered 'Text' with name '', namespace ''. '. See server logs for more details. The exception stack trace is: at System.Runtime.Serialization.XmlObjectSerializerReadContext.HandleMemberNotFound(XmlReaderDelegator xmlReader, ExtensionDataObject extensionData, Int32 memberIndex) at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.GetJsonMemberIndex(XmlReaderDelegator xmlReader, XmlDictionaryString[] memberNames, Int32 memberIndex, ExtensionDataObject extensionData) at ReadRemoteArtifactCustomPropertyFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString[] ) at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns) at ReadArrayOfRemoteArtifactCustomPropertyFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString , CollectionDataContract ) at System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns) at ReadRemoteTestSetFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString[] ) at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns) at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName) at System.ServiceModel.Dispatcher.SingleBodyParameterDataContractMessageFormatter.ReadObject(Message message) at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc rpc) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) en-US(C) Copyright 2006-2024 Inflectra Corporation.support@inflectra.com/Computers/Software/Project_Management//Computers/Software/Quality_Assurance/KronoDesksupport@inflectra.comhttp://www.inflectra.com/kronodesk/forums/threads120/Support/Forum/spirateam/issues-questions/1347.aspxthreadId=1347D W (dkwang@directv.com)REST APIREST API creating test sets Hello, I'm a novice user of SpiraTeam as my organization have selected it as our main tool for requirements / test case generation. I've begun looking at the available REST API and am attempting to utilize it to create a simple test set. I'm a bit confused with all the elements in the request payload and would hope to get some guidance and clarity. I'm specifically looking at: POST: projects/{project_id}/test-sets?parent_test_set_folder_id={parent_test_set_folder_id} I've tried the following POST Request: http://hostname/SpiraTeam/Services/v4_0/RestService.svc/projects/284/test-sets?parent_test_set_folder_id=13242 Headers: Cache-Control: no-cache username: johndoe api-key: {187FC923-CE4F-4FCA-BEF0-73D7A37055F2} Accept: application/json Content-Type: application/json Post Body: {"ArtifactTypeId": 8, "ConcurrencyDate": "/Date(1432130443523-0700)/", "CustomProperties": [0], "ProjectId": 284, "AutomationHostId": null, "CountBlocked": 0, "CountCaution": 0, "CountFailed": 0, "CountNotApplicable": 0, "CountNotRun": 0, "CountPassed": 0, "CreationDate": "/Date(1432130413227-0700)/", "CreatorId": 968, "CreatorName": "John Doe", "Description": null, "ExecutionDate": null, "Folder": false, "IndentLevel": "AAJAAAs", "LastUpdateDate": "/Date(1432130443523-0700)/", "Name": "RESTAPI", "OwnerId": null, "OwnerName": null, "PlannedDate": null, "ProjectName": "Test Project", "RecurrenceId": null, "RecurrenceName": null, "ReleaseId": null, "ReleaseVersionNumber": null, "TestRunTypeId": null, "TestSetId": null, "TestSetStatusId": 3, "TestSetStatusName": "Completed"} What is a valid request body? I'm receiving the following error. Any help pointing me in the right direction would be greatly appreciated. I don't have access to the server logs so I can not view more details to see where the issue is. Request Error The server encountered an error processing the request. The exception message is 'Expecting state 'Element'.. Encountered 'Text' with name '', namespace ''. '. See server logs for more details. The exception stack trace is: at System.Runtime.Serialization.XmlObjectSerializerReadContext.HandleMemberNotFound(XmlReaderDelegator xmlReader, ExtensionDataObject extensionData, Int32 memberIndex) at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.GetJsonMemberIndex(XmlReaderDelegator xmlReader, XmlDictionaryString[] memberNames, Int32 memberIndex, ExtensionDataObject extensionData) at ReadRemoteArtifactCustomPropertyFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString[] ) at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns) at ReadArrayOfRemoteArtifactCustomPropertyFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString , CollectionDataContract ) at System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns) at ReadRemoteTestSetFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString[] ) at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns) at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName) at System.ServiceModel.Dispatcher.SingleBodyParameterDataContractMessageFormatter.ReadObject(Message message) at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc rpc) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) Thu, 21 Jan 2016 01:44:19 -05002016-01-25T21:47:32-05:00/Support/Forum/spirateam/issues-questions/1347.aspxmessageId=2454David J (support1@inflectra.com) Hi Damon I would trim down the REST body to only have the fields that are needed, some of them ar Hi Damon I would trim down the REST body to only have the fields that are needed, some of them are read-only and others are NULL can be omitted: {"CreationDate": "/Date(1432130413227-0700)/", "CreatorId": 968, "LastUpdateDate": "/Date(1432130443523-0700)/", "Name": "RESTAPI", "TestSetStatusId": 3 } If that doesn't work, please send us a help desk ticket and we can debug for you. Regards Adam Mon, 25 Jan 2016 20:02:44 -05002016-01-25T20:02:44-05:00/Support/Forum/spirateam/issues-questions/1347.aspx#reply2454messageId=2455D W (dkwang@directv.com) Hello Adam, Thank You for your suggestion. I've stripped down the payload and it appears to be Hello Adam, Thank You for your suggestion. I've stripped down the payload and it appears to be working for me. Your response is much appreciated. Mon, 25 Jan 2016 21:47:32 -05002016-01-25T21:47:32-05:00/Support/Forum/spirateam/issues-questions/1347.aspx#reply2455