Can rest api return xml

Hi,

Is there a way to return and xml string that is not encapsulated in a message json object when cashing the rest api in frappe.

I’m trying to integrate with a telephony system which requires xml as a input after calling a url which I want to host as frappe app. My only challenge is that when I’m returning the xml it gets converted as json message object.

Anyway around this?

Regards
Hemant

@hpema108,

currently it is not possible, you can create a custom api’s to change the response from json to xml

Hi Makarand,

I did create a custom method in my app, is this what you mean? How else do I create a custom api in frappe? Cause my custom method still returns json.

Regards

@hpema108

This Javascript based method might help:

http://goessner.net/download/prj/jsonxml/

Hi @saidsl

This service or custom method I wrote is being called by the telecoms company, I dont have access to there applications to use the javascript. I am building the api to return contact information from my customer database that they require to route a call to the mobile. So trying to build a sort of voip service for my erpnext instance.

If there is not other option right now then I will need to maybe do this outside of erpnext for now.

Thanks for the assist.

regards
Hemant

The default response is json build_response('json')

build_response currently allows json, csv, download, etc.

xml can be added.
By default frappe can keep on serving JSON.
If a header is specified with request, the response can be xml

Have not tested this yet but @rmehta made some changed to the develop branch I think…

regards
Hemant