cancel
Showing results for 
Search instead for 
Did you mean: 

PUTing a XML String

mike_korcynski
New Contributor III

I have a pipeline that goes through some work manipulating data, then starts using a XML Generator Snap to make a bunch of XML documents that need to get PUT to a REST API. Simplified, example of a document.

    [ {"xml":"<?xml version="1.0" encoding="UTF-8"?><import-record type-id="14417"><native><field name="title"><text>Some Title</text></field></native></import-record>"}] 

Based on that document in the REST PUT, I set the HTTP entity to $xml, and then I inspect whats’s being PUT on the other side, instead of seeing the XML document as the body of the PUT I’m getting an array of 1 string with the XML document. How do I get this just to PUT the doucment directly. Example of what I’m getting on the receiving side below:

["<?xml version=\"1.0\" encoding=\"UTF-8\"?><import-record type-id..."]

Overview of Pipeline in case it helps to talk about it:

35

1 ACCEPTED SOLUTION

robin
Former Employee

@mike.korcynski, check the Batch Size setting in the Snap - if it isn’t blank (for example, it has a value of 1), you’ll see the kind of behavior you’re describing:

image

image

If you leave it blank, it should not wrap the body in an array (also, be mindful of the correct Content-Type header value required by the targeted API):

image

image

The setting in question is described further on the REST PUT documentation page:

image

View solution in original post

2 REPLIES 2

robin
Former Employee

@mike.korcynski, check the Batch Size setting in the Snap - if it isn’t blank (for example, it has a value of 1), you’ll see the kind of behavior you’re describing:

image

image

If you leave it blank, it should not wrap the body in an array (also, be mindful of the correct Content-Type header value required by the targeted API):

image

image

The setting in question is described further on the REST PUT documentation page:

image

mike_korcynski
New Contributor III

I had the Content-Type set correctly, but Batch size I had set to 1, setting it back to blank solved the problem. Thanks, I appreciate the help.