Skip Navigation LinksHome Page > Forums > SpiraTest Forums > SpiraTest Issues & Questi... > Add Release with REST API...
Hi Spira Team,
I was trying to add a release using the REST API, however I was running into issues.I am able to run some POSTS like the projects/{project_id}/releases/search?number_rows={number_rows}&start_row={start_row}, so I think we have the right credentials.
However, for some reason I was not able to get the create release endpoint working: projects/{project_id}/releaseshttps://api.inflectra.com/Spira/Services/v5_0/RestServiceOperation.aspx?uri=projects%2f%7bproject_id%7d%2freleases&method=POSTMy guess is that I am not putting the correct request data? I am unsure which data is the required fields.I tried the following as request data:
{"OwnerId":33,"CreatorId":33,"ProjectId":12,"ReleaseStatusId":1,"ReleaseTypeId":4,"VersionNumber":"7.2.x","Name":"Release 7.2.x"}
Here's the error I am getting in the response:
<p>The server encountered an error processing the request. The exception message is 'An error occurred while updating the entries. See the inner exception for details.'. See server logs for more details. The exception stack trace is: </p> <p> at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter) at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options) at Inflectra.SpiraTest.Business.SpiraTestEntitiesEx.SaveChanges(SaveOptions options, Nullable`1 userId, Boolean updateHistory, Boolean sendNotification, Nullable`1 rollbackId) at Inflectra.SpiraTest.Business.SpiraTestEntitiesEx.SaveChanges(Nullable`1 userId, Boolean updateHistory, Boolean sendNotification, Nullable`1 rollbackId) at Inflectra.SpiraTest.Business.ReleaseManager.Insert(Int32 userId, Int32 projectId, Int32 creatorId, String name, String description, String versionNumber, String indentLevel, ReleaseStatusEnum releaseStatus, ReleaseTypeEnum releaseType, DateTime startDate, DateTime endDate, Decimal resourceCount, Decimal daysNonWorking, Nullable`1 ownerId, Boolean logHistory) at Inflectra.SpiraTest.Business.ReleaseManager.Insert(Int32 userId, Int32 projectId, Int32 creatorId, String name, String description, String versionNumber, Nullable`1 existingReleaseId, ReleaseStatusEnum releaseStatus, ReleaseTypeEnum releaseType, DateTime startDate, DateTime endDate, Decimal resourceCount, Decimal daysNonWorking, Nullable`1 ownerId, Boolean ignoreLastInserted, Boolean logHistory) at Inflectra.SpiraTest.Web.Services.v5_0.RestService.Release_Create2(String project_id, String parent_release_id, RemoteRelease remoteRelease) at SyncInvokeRelease_Create1(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</p>
Does this error look familiar? What fields may I be missing in order to successfully create a release?Please let me know when you have a chance. Thanks!
Hi Michael
You probably are missing all fields. There would be a more detailed error in the Event Log inside Spira?
Also feel free to log a help desk if you need more individualized support with this.
Regards
David
Hi David,
I found out what were the required fields were, the main parameters I was missing were the "EndDate" and "StartDate":
curl -X POST -d '{"StartDate":"/Date(1580351091911)/","ReleaseStatusId":1,"EndDate":"/Date(1580351091911)/","ReleaseTypeId":1,"Name":"temporary"}' -u [username]:[password] https://[company].spiraservice.net/services/v6_0/RestService.svc/projects/[project_id]/releases/[release_id]
Thanks!
And if you have any questions, please email or call us at +1 (202) 558-6885