API that catches HTTP Post encoded in CXML

I am trying to build an API endpoint that can catch an HTTP Post that is encoded in XML. The error I am getting is:Document input views only accept JSON-encoded data. I understand that there are snaps that allow me to conver the XML to JSON once the data is in the pipeline but I cant get the HTTP Post into my pipeline to begin with. Unfortunately, I do not have the luxury of converting the XML to JSON as this is data from over 100 different vendors.

Does anyone know if SnapLogic is able to handle an HTTP Post encoded in XML?

Thanks for any help in advance!

I don’t think we can send a XML encoded POST data to a Snaplogic pipeline API end point. It needs to be JSON encoded. If the POST data can be staged in a staging area, you could use the Multi File Reader Snap and then connect the XML Parser Snap to it and process it further.

Hope this helps.

1 Like

According to my esteemed colleague @akidave, we do allow POST data directly to XML Parser snap through a triggered pipeline which in your case would be the API end point. If your first snap in the pipeline is the XML Parser, you should be able to process it and your pipeline is a triggered pipeline, you should be able to send the XML encoded POST data to this triggered pipeline.

2 Likes

If you don’t know if the incoming request will be xml or json and you want your API to be capable of consuming both requests, here is a sample pipeline where you can do that.

image

In the binary router you are checking if the pipeline request is xml or json and after that deciding which branch to process.XMLToJson_2019_05_16.slp (6.7 KB)

2 Likes