Rest Api - return XML

Hi
Is there any way to instruct the Rest api to return XML instead of JSON

Hello,

You just have to set the “Accept” HTTP header to “application/xml”, for instance:

curl http://localhost:8042/patients

[
“6eeded74-75005003-c3ae9738-d4a06a4f-6beedeb8”,
“6fb47ef5-072f4557-3215aa29-f99515c1-6fa22bf0”
]

curl http://localhost:8042/patients -H ‘Accept: application/xml’

<?xml version="1.0" encoding="utf-8"?> 6eeded74-75005003-c3ae9738-d4a06a4f-6beedeb8 6fb47ef5-072f4557-3215aa29-f99515c1-6fa22bf0

HTH,

Sébastien-

Excellent , thank you

This seems to be a problem
eg:
{
   "HttpError" : "Not Found",
   "HttpStatus" : 404,
   "Message" : "Unknown resource",
   "Method" : "GET",
   "OrthancError" : "Unknown resource",
   "OrthancStatus" : 17,
   "Uri" : "/patients -H 'Accept: application/xml'"
}

This seems to be a problem
{
“HttpError” : “Not Found”,
“HttpStatus” : 404,
“Message” : “Unknown resource”,
“Method” : “GET”,
“OrthancError” : “Unknown resource”,
“OrthancStatus” : 17,
“Uri” : “/patients -H ‘Accept: application/xml’”
}

The “-H ‘Accept: application/xml’” is not part of the URL. It is a command-line argument that is specific to curl, and that allows to set some HTTP header. Please use a proper HTTP client.