Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

How to add nested JSON into Download Payload

markashman
8 - Asteroid

I am working on an API workflow and for one of the calls I need to pass the following into the body

 

{

"start": 0,
"limit": 5,
"queries": [

{
"field": "valueString",
"values": [arrayOfStrings],
"matchType": 7
}

]

}

 

The indentation is not important.

I can ad start & finish tags into the payload directly:

markashman_0-1676478460415.png

But not sure how I add the three nested tags.

 

Appreciate any help

 

Thanks

3 REPLIES 3
apathetichell
19 - Altair

Hi,

 

I'd strongly recommend assembling the entire payload body in some combination of formula tool/summary tool/formula tool - and then feeding it as a single value into your download tool's payload body.

 

basically think of it this way - each record in a download tool is an api tool - not a nested value for your api tool. 30 records in your api body are 1 call  - 1 download tool. 3000 records are 1 call  - 1 download tool- and 10 records means 10 calls. That's probably not what you want - at least on your initial call.

markashman
8 - Asteroid

Interesting, I have no objection to assembling the payload externally and insert in 1 block, though it does add complexity as 3 of the values are variables which will change dynamically based on a loop. However, I still have no idea how to assemble the nest JSON for injection into the payload, as formula/summary etc do not nest far as I can tell.

apathetichell
19 - Altair

summarize nests. it concatenates - you use /n in concatenation... so basically you need to transpose (or otherwise assign your key name in formula so you have:

 

'"'+[insert_key_name]+'": "'+[insert_value_here]+'"' then you use summarize in \n mode to get list of keynames:key values - yeah? you can also see if what you have works with json build.

 

you do not need to include the [ and the ] in your payload - those should be auto-generated. make sure to hard code content_type in your header.

Labels