Skip Navigation LinksHome Page > Forums > SpiraTeam Forums > SpiraTeam Issues & Questi... > Spira API, deleted or no ...
Is there a way to understand through API that task/incident was deleted from the system? To distinguish it from the situation when user doesn't have permissions to that project.
It should return an HTTP 404 (Not Found) and the message:
Unable to locate requested task
vs. 301 (Unauthorized), etc. for other cases.
Let me add more details.
Initially we have only ticket name, for example: TK:10000 or IN:20000
So, we use this API to extract ticket's project_id first: https://eti.spiraservice.net/services/v6_0/RestService.svc/system/artifact-types/3/120631/project-id
Only after that using additionally project_id value for ticket we can use following APIs to extract ticket details:
When we use API to extract project_id there are only 2 cases of HTTP response: 200 or 400
In case of error HTTP 400 we receive following error text, which do not give information if ticket was deleted or user have no access to ticket/project: "The server encountered an error processing the request. The exception message is 'Incident 17730 doesn't exist in the system.'. See server logs for more details. The exception stack trace is:
at Inflectra.SpiraTest.Business.IncidentManager.RetrieveById(Int32 incidentId, Boolean includeResolutions, Boolean includeDeleted, Boolean includeTestRunSteps) at Inflectra.SpiraTest.Web.Services.v6_0.RestService.System_GetProjectIdForArtifact(String artifact_type_id, String artifact_id) at SyncInvokeSystem_GetProjectIdForArtifact(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)"
Maybe there is another API we should use to check if ticket was deleted or user has no access to ticket/project taking into account that we initially have ticket type (IN, TK) and ticket number only?
And if you have any questions, please email or call us at +1 (202) 558-6885