I have a REST request which gives me a large volume of data in the response. I am able to Platform.Function.ParseJSON which gives me an Array list.
The array size is close to 40 odd rows. Each row has 4+ fields. I need to insert this data to a DE.
I can use Platform.Function.InsertData but I think I need to loop through the 40 rows and call the Insert function each time.
Is there any way either SSJS or AMPScript support Bulk insert data into a Data Extension.
Greatly appreciate any feedback/guidance.
Thanks,
Raj
Best Answer
There are a few options for you to do this. There is:
For SOAP API
(docs) You would build your envelope containing multiple 'Objects' nodes - one for each row you want to add in. You can also shift this to be Upsert (updateAdd SaveAction) to make sure it does not throw an exception if the row already exists.
Example:
For WSProxy
(docs) This is basically a simplified way to do the above inside of SFMC SSJS. Same basic idea, just using JSON and other more native JS capabilities to do so.
Example:
REST API
This one I offer up as it sounds like you are already pulling in REST API functions so may be something to shift in without much issue:
Rows.Add
(docs) This one is add only though, so if there is an existing row, it could cause an issue - so will need to be considered.
Example: