Hi everyone,
I'm trying to get some data from an API via http action and then put that data into a sharepoint list.
So far, the http action returns the correct data and my next step is to put the body from the output into a parse json action (schema is from a former run) so I can use it in a create element action (which is inside a apply to each loop). Unfortunately, the flow always fails at the loop with the following error:
The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('parse_JSON')?['body']?['items']' is of type 'Null'. The result must be a valid array.
I checked the inputs and outputs for the parse json action and there is data in it. So I don't get why the loop gets no data?
I'll show you some screenshots below.
The inputs

The outputs:

The schema:
{
"type": "object",
"properties": {
"statusCode": {
"type": "integer"
},
"headers": {
"type": "object",
"properties": {
"Date": {
"type": "string"
},
"Connection": {
"type": "string"
},
"Access-Control-Expose-Headers": {
"type": "string"
},
"Cache-Control": {
"type": "string"
},
"Pragma": {
"type": "string"
},
"Set-Cookie": {
"type": "string"
},
"Vary": {
"type": "string"
},
"X-AspNet-Version": {
"type": "string"
},
"Request-Context": {
"type": "string"
},
"X-Powered-By": {
"type": "string"
},
"CF-Cache-Status": {
"type": "string"
},
"Server": {
"type": "string"
},
"CF-RAY": {
"type": "string"
},
"Content-Type": {
"type": "string"
},
"Content-Length": {
"type": "string"
},
"Expires": {
"type": "string"
}
}
},
"body": {
"type": "object",
"properties": {
"page": {
"type": "integer"
},
"itemsInPage": {
"type": "integer"
},
"totalPages": {
"type": "integer"
},
"prevLink": {
"type": "string"
},
"nextLink": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"TicketID": {
"type": "integer"
},
"TicketTitle": {
"type": "string"
},
"TicketNumber": {
"type": "string"
},
"TicketPriority": {
"type": "string"
},
"TicketImpact": {
"type": "string"
},
"TicketStatus": {
"type": "string"
},
"TicketSource": {
"type": "string"
},
"TicketType": {
"type": "string"
},
"EndUserID": {
"type": "integer"
},
"EndUserEmail": {
"type": "string"
},
"EndUserFirstName": {
"type": "string"
},
"EndUserLastName": {
"type": "string"
},
"EndUserPhone": {
"type": "string"
},
"TicketResolvedDate": {},
"TicketCreatedDate": {
"type": "string"
},
"TechnicianFirstCommentDate": {
"type": "string"
},
"FirstResponseDueDate": {},
"ClosedTicketDueDate": {},
"FirstComment": {
"type": "string"
},
"LastEndUserComment": {
"type": "string"
},
"LastEndUserCommentTimestamp": {
"type": "string"
},
"LastTechnicianComment": {
"type": "string"
},
"LastTechnicianCommentTimestamp": {
"type": "string"
},
"OnSiteDurationSeconds": {
"type": "integer"
},
"OnSiteDurationMinutes": {
"type": "integer"
},
"OffSiteDurationSeconds": {
"type": "integer"
},
"OffSiteDurationMinutes": {
"type": "integer"
},
"OnSLADurationSeconds": {
"type": "integer"
},
"OnSLADurationMinutes": {
"type": "integer"
},
"OffSLADurationSeconds": {
"type": "integer"
},
"OffSLADurationMinutes": {
"type": "integer"
},
"TotalDurationSeconds": {
"type": "integer"
},
"TotalDurationMinutes": {
"type": "integer"
},
"CustomerID": {
"type": "integer"
},
"CustomerName": {
"type": "string"
},
"CustomerBusinessNumber": {},
"TechnicianContactID": {
"type": "integer"
},
"TechnicianFullName": {
"type": "string"
},
"TechnicianEmail": {
"type": "string"
},
"ContractID": {
"type": "integer"
}
},
"required": [
"TicketID",
"TicketTitle",
"TicketNumber",
"TicketPriority",
"TicketImpact",
"TicketStatus",
"TicketSource",
"TicketType",
"EndUserID",
"EndUserEmail",
"EndUserFirstName",
"EndUserLastName",
"EndUserPhone",
"TicketResolvedDate",
"TicketCreatedDate",
"TechnicianFirstCommentDate",
"FirstResponseDueDate",
"ClosedTicketDueDate",
"FirstComment",
"LastEndUserComment",
"LastEndUserCommentTimestamp",
"LastTechnicianComment",
"LastTechnicianCommentTimestamp",
"OnSiteDurationSeconds",
"OnSiteDurationMinutes",
"OffSiteDurationSeconds",
"OffSiteDurationMinutes",
"OnSLADurationSeconds",
"OnSLADurationMinutes",
"OffSLADurationSeconds",
"OffSLADurationMinutes",
"TotalDurationSeconds",
"TotalDurationMinutes",
"CustomerID",
"CustomerName",
"CustomerBusinessNumber",
"TechnicianContactID",
"TechnicianFullName",
"TechnicianEmail",
"ContractID"
]
}
},
"totalItemCount": {
"type": "integer"
}
}
}
}
}