Rest api to create project

Thursday, July 21, 2016
Avatar
when I use rest api to create project

url: http://localhost/SpiraTest/Services/v4_0/RestService.svc/projects
headers: 
{
Content-Type : application/json
accept:  application/json
username: bbbb8264
api-key: {992790F0-EDB3-46AE-879D-6884D82A0E49}
}

but get error message:

The server encountered an error processing the request. The exception message is 'Object reference not set to an instance of an object.'. See server logs for more details. The exception stack trace is:

at Inflectra.SpiraTest.Web.Services.v4_0.RestService.Project_Create(RemoteProject remoteProject, String existing_project_id) at SyncInvokeProject_Create(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.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

How can I fix it? I'm sorry to post question for two times.

2 Replies
Thursday, July 21, 2016
Avatar
inflectra.jimx
re: bbbb8264 Thursday, July 21, 2016
Hi Woody

You need to actually POST a project definition in JSON. Something like:

{"Active":true,
"CreationDate":"\/Date(-62135578800000-0500)\/",
"Description":"The description of my project",
"Name":"My New Project"}

Regards

Jim.
Friday, July 22, 2016
Avatar
re: inflectra.jimx Thursday, July 21, 2016
The contents of json file can't be found in doc (https://www.inflectra.com/SpiraDemo/Services/v4_0/RestServiceOperation.aspx?uri=projects&method=GET).
However, You tell me and it finally worked.
Thanks a lot.

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Thursday, July 21, 2016
  • Last Reply: Friday, July 22, 2016
  • Replies: 2
  • Views: 4045