103
Views
2
Comments
Solved
Return expose API response in JSON or XML
Application Type
Reactive

Is it possible to have an exposed API to return the response in either JSON or XML based on a parameter? 

Example:

Https:Example/get?type=JSON - return response in JSON

Https:Example/get?type=XML - return response in XML

2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi @Shum Chin Ning ,

you could define the output of your REST method as a simple text field, and fill it with either JSON or XML dependant on the requested format.

See attached OML for the general idea.

Dorine

QDR_ExposeInDesiredFormat.oml
UserImage.jpg
Shum Chin Ning

Thanks Dorine

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.