Hi, I’m dealing with a none flexible system that doesn’t work with webhook as it needs the metadata url, oauth url etc. For Oauth I can workaround using an existing idp just to get token, I’m planning to use the same webhook to serve as both query handler as well as return the metadata when no query is provided.
I found a sample from petstore but overwhelm just to workout what’s the essential bit to incorporate into the code node. I find it tough to workout the correct response for the metadata, for defining just Id and Rel as the schema.
Hi @engowen, I am not sure I fully understand your requirements. Are you simply trying to mock the responses from the Swagger pages you have linked in n8n? Where does metadata come into play here?
The dashboard that the webhook calling from is a bespoke system, it checked the endpoint (EntityType) response against the metadata to ensure the payload contains only the valid json tag (Property), take ie. MS Dynamics Odata metadata as example. I don’t need the petstore sample anymore.
I intend to return the following xml when no query is provided in GET request to mock a $metadata response, and expected in xml format.
Using XML To JSON Converter I’d tried converting the xml to json then using the XML node to convert it back but it introduced \n and return with “data” property eventhough I left the property name as blank.
Thanks @BramKn for the pointer, but this kinda confirm n8n doesn’t response in XML natively. So taking your advice I’d moved to HTML node but encountered the same json output
Sorry I have no idea what you actually want to do with the XML. But n8n is json based and will probably never have native xml outputs. It will always be in a json value as text.
It shouldnt be a problem though, so can you explain your usecase?
Thanks @BramKn , you’d given me hope by sharing your HTML response using “Respond to Webhook” node with Text output that responding to XML is possible. @jan please consider updating sample xml workflow to use Respond to Webhook with Response Header, Content-Type : application/xml, as the sample didn’t return native xml but xml wrapped within json array.
I just gave the example workflow a run and it appeared to work for me but… to be complete I have just updated it to use respond to webhook instead though as it is nicer way to handle things. This change should be live in a couple of minutes.