Forum Discussion
Hi Suman,
Good day, you can use the HTTP Request Header “Range” by calling first the Marketo API Get Export Lead Job Status to get the file size and if requested export file is ready for download “Complete” state
Base from the file size you can then use Range as part of the GET request header in a multipart request or single request
Multipart request
Single request
Hope this helps 😀
Thanks,
EmEm
- bojanvelevski4 years agoValued Contributor
Hey @darshthakkar,
I suppose you can remove the curly brackets from your final string, but if you want to go and make this solution totally dynamic, than I suggest to remove the brackets on an object level with the following expression:
$group.map(x=>x.toString().substring(1,x.toString().length-1)).toString()
What we’re doing here is first we’re mapping/iterating through the array and turning every object in it into a string:
[{ "name": "John", "age": 33 }, { "name": "Jack", "age": 23 }, { "name": "Jill", "age": 43 }]
will become:
[ "{name=John, age=33}" "{name=Jack, age=23}" "{name=Jill, age=43}" ]
In the same iteration we’re removing the first and last character which are the object curly brackets. The rest is clear, just concatenate the strings in the array:
[ "name=John, age=33" "name=Jack, age=23" "name=Jill, age=43" ]
End result:
name=John, age=33,name=Jack, age=23,name=Jill, age=43
With this we’re excluding any possibility of removing a curly brackets which are in the values of the JSON objects and should not be excluded.
Sample:
[ { "name": "John{test}", "age": 33 }, { "name": "Jack{test}", "age": 23 }, { "name": "Jill{test}", "age": 43 } ]
Result while replacing curly brackets on final string:
name=Johntest, age=33,name=Jacktest, age=23,name=Jilltest, age=43
Result while removing curly brackets on object level with mapping:
name=John{test}, age=33,name=Jack{test}, age=23,name=Jill{test}, age=43
Regards,
Bojan - darshthakkar4 years agoValued Contributor
Thank you @bojanvelevski for the detailed solution and steps.
I was planning to use column.replace() instead of column.replaceAll() however I see your point, for removing the opening {, column.replace() would have worked seamlessly but for ending }, column.replace() might have removed the first occurrence of } instead of the actual end }.Thank you again for the explanation, really means a lot to me. I will try the above-mentioned steps and keep you posted on how it goes…
- darshthakkar4 years agoValued Contributor
@bojanvelevski: Let’s assume that I’ve to remove all the existing { }, should we be using the column.replaceAll() then?
Really appreciate your help and insights into this one.
Thanks!
Regards,
DT- bojanvelevski4 years agoValued Contributor
Yes, there’s no need for further complications, replaceAll will do the job.
Related Content
- 2 years ago