In Logic Apps I have an API that returns multiple records in the following format:
{
"meta": {
"pagination": {
"recordStart": 0,
"pageSize": 25,
"next": "eNoNzttugjAfufhyYTZ0PdTjmtav6pr6sFIFZ39AVovz9A7AsXYQ"
},
"status": 200
},
"data": [
{
"items": [
{
"size": 131783,
"attachmentcount": 3,
"subject": "Statement - Mr Big Statement in USD",
"displaytoaddresslist": [],
"displayfrom": "Microsoft Outlook",
"displayfromaddress": "email@bob.com",
"id": "eN_LwK3S1",
"smash": "4da34cc873f844bc242397",
"displayto": "people",
"receiveddate": "2023-03-24T11:48:00+0000",
"status": "ARCHIVED"
},
{
"size": 122681,
"attachmentcount": 1,
"subject": "Statement - Joe Bloggs Statement in USD",
"etc": "etc"
}
]
}
]
}
My aim is to insert each record returned into a SQL Server DB for archiving. I've tried experimenting with loading records directly into a stored procedure, but my attempts to extract a field directly (i.e. subject, size, etc) fail every time.
Examples I've tried include: @body('Parsed JSON')['items'][0]['subject'] @body('Submit Mimecast API')['data']['items'][0]['size']
Can anyone help please? Starting to think I might need a For Loop to do this, but unsure of the best approach.
Any advice would be very much appreciated.
Thanks