How to have swagger response model documentation and a json-format response
In trying to have a well documented api with swagger the only way (that I see) to have the response-object documented is to use: a Message Definition (with example values and documentation) based on the Response-object (e.g. AnimalResponse) a Microflow that is called by the Published-REST-webservice that returns an object (e.g. AnimalResponse). an Export Mapping based on the Message Definition an Published Webservice with a Response of Type AnimalResponse and an Export mapping. Swagger now knows the model-information via the Export-mapping defined. If I use this, I cannot find any way to define JSON as the result-type. I now have a XML-result. What can I do to have a well documented api with model-info and a JSON-result?
Have you tried using an “Export to JSON” action, and then returning that variable as the content of your HttpResponse in the flow that returns the message?
Thanks for your answer.
In this solution the export of the data is done twice. The first time in the microflow and the second time in the Export-definition in the PublishedWebservice. And the output is still XML.
I found a solution. I added the HttpResponse as a parameter to the microflow and added a HttpHeader to this with the Key=‘Content-Type’ and Value=’application/json’. This works. The advantage is having only one Export.
I think it would be nice/beter to have the Content-Type [XML, JSON] option in the Published Webservice.
Just what I was looking for. Thank you for posting the solution. It shouldn't be necessary to do it that way, but it works :-)