Force Route to Return XML  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Force Route to Return XML

Postby SBarnes » Thu Aug 06, 2020 4:30 pm

Is there a way to force a specific route in ServiceStack to by default return XML rather than it needing to be specified in the request?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Force Route to Return XML

Postby Scott.Pearce » Thu Aug 06, 2020 5:07 pm

I did a bit of research, and played around with the plugin code, but as far as I can tell you can't. You can of course set a default for ALL routes via "DefaultContentType" in the ServiceStack config (line 703 in the REST API plugin).

Try posing the question here, or maybe if you search those forums you will turn up something I missed.

EDIT:

One thing about mythz at ServiceStack is that he is usually pretty responsive if he sees a good use case for a feature request.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Force Route to Return XML  Topic is solved

Postby SBarnes » Thu Aug 06, 2020 5:11 pm

Thanks Scott,

In the end I also figured that was the case myself, so I changed it to return a HttpResult and because the XML wasn't that hard put it in as a string and then added a header for the content type and the platform I am talking to was happy with that, not a pretty solution but it works.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Force Route to Return XML

Postby SBarnes » Mon Jan 18, 2021 6:40 pm

Hi Scott,

I just found this https://docs.servicestack.net/formats whilst looking for something else, without having tried it, it appears you can do it.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to REST API

Who is online

Users browsing this forum: No registered users and 2 guests

cron