Skip Navigation LinksHome Page > Forums > SpiraTeam Forums > SpiraTeam Issues & Qu... > RestAPI: Content-Type hea...
Using the v6.0 RestAPI, and trying to GET data from Spira in json-format, the API requires that the Content-Type header is set to application/json.
Clearly, it should be the Accept header that should be conveyed with the application/json value.
Example:
curl --user <username>:<password> -H "Accept: application/json" https://spiraservice.net/Services/v6_0/RestService.svc/projects/9/releases returns a 400 Bad request error
while:
curl --user <username>:<password> -H "Content-Type: application/json" https://spiraservice.net/Services/v6_0/RestService.svc/projects/9/releases returns a 200 OK with the requested data.
Why does it matter?
Trying to send a GET request with a Content body (required to set the content-header) using a .NET HttpClient, throws:
ProtocolViolationException {"Cannot send a content-body with this verb-type."}
Getting Microsoft to change this behavior is probably not possible, but the Spira API should correctly handle the Accept header instead of the Content-Type header here.
It is because we are using a Microsoft WCF to implement the web service layer and we have to dynamically support both JSON and XML, so we need to use the Content-Type header to know which to use.
So unfortunately we're also limited by Microsoft as well ;-)
And if you have any questions, please email or call us at +1 (202) 558-6885