ArcGIS Rest API – Webhooks - Microsoft flow Survey123

1178
6
06-17-2019 06:18 AM
PaulSweeney3
Occasional Contributor III

I am trying to follow the instructions in the link below to automatically update a layer after submitting a survey in Survey123 

https://resources.esri.ca/getting-technical/webhooks-microsoft-flow-and-the-arcgis-rest-api-automati...

However i am failing at the final hurdle and receiving this error message

https://resources.esri.ca/getting-technical/webhooks-microsoft-flow-and-the-arcgis-rest-api-automati...

The execution of template action 'While_Loop' failed: the result of the evaluation of 'foreach' expression '@{body('Parse_Query_JSON')?['objectIds']}
' is of type 'String'. The result must be a valid array.

 Can anyone give me some idea as to what i am doing wrong? 

0 Kudos
6 Replies
COSPNWGuy
Occasional Contributor II

Hi Paul Sweeney,

I expect it is because when Flow autogenerated the schema when you uploaded a sample json, it takes a guess at the type of data (many times erroneously). All you need to do in your schema is delete the type or change it to integer.

0 Kudos
PaulSweeney3
Occasional Contributor III

Hi thanks for you response (I really should have posted an update here) i had eventually figured this out and this was exactly what i did i removed the types and it worked perfectly. This is a really useful tool for us now. 

0 Kudos
ILoveMap
New Contributor III

Hi Paul,

I'm having a similar problem with this same workflow. Would you mind showing me your HTTP query operation and following Parse JSON connector?

I'm a bit lost and getting the same error, so any help is appreciated....

 

0 Kudos
PaulSweeney3
Occasional Contributor III

Hi Chris 

See below. you only need a header as per my screen shot then a post 

then for each object id in th e query you need to apply the edit as per below 

FYI i have migrated to integromat as i find it more user friendly. 

0 Kudos
ILoveMap
New Contributor III

Hi Paul,

Thanks for the reply. With your help I was able to get my query to work but it looks like I'm running into the same issue as your original post described. When the last component (POST - Update Features) attempts to run. Any insights you may have on this would be appreciated.

 

{"error":{"code":400,"message":"Cannot perform operation. Invalid operation parameters.","details":["'features' parameter is invalid","Invalid JSON primitive: ."]}}

 

0 Kudos
PaulSweeney3
Occasional Contributor III

Hi Chris 

you need to look at the json in your Body , you have a comma after your colon Object ID:, you need to remove it. 

0 Kudos