Select to view content in your preferred language

Push Images via REST, Integromat, and Survey123

1770
4
02-08-2019 08:18 AM
joerodmey
MVP Alum

Looking to extract images from a feature service and push them to another feature service all by using REST and Integromat. This is a survey123 feature service, so the trigger would be a new record added.

4 Replies
by Anonymous User
Not applicable

Hi Joe,

Yes, this should be possible using Integromat. See the EAC documentation post here Welcome to our Feedback Community with instructions on how to do something similar, although doesn't include steps how to push the attachments to another feature service, but once you have retrieved them, that should be possible.

Phil.

0 Kudos
MickFulton
Emerging Contributor

SOLUTION

The following will wait for a survey to be submitted and copy the photo to another record in a different feature service. This workflow could also be useful for attaching a Survey123 report to the original task.

If you want to create a new record in a separate feature service and then add the attachment you could create another module that adds the feature first and then copy the attachments with the following scenario. 

Things to note;

- You need the objected, globalid and feature service url for where you want the photo to copy to. 

- Any surveys without a photo attached can cause the scenario to error. Resolved by making the attachment required or using an error handler. 

-The data value needs to be in base64

- I have provided screenshots followed by the text input for those who want to copy paste - you will need to update the selections to reflect your scenario modules.

Overall Workflow

 

HTTP - Get a file

URL

{{24.attachmentInfo.photo_one[].url}}

 

 

HTTP - Make a Request

 

URL

https://services7.arcgis.com/RB9EMffvnsUjBNXA/ArcGIS/rest/services/service_caeeb23423423423423423423...

 

Method

POST

 

Headers

null

 

Query String

null

 

Body Type

Multipart/form-data

 

Fields (3 of them broken down below)

Field Type -  Text

Key - f

Value - json

 

Field Type -  Text

Key - attachments

Value - {"adds":[{"objectid" : {{24.feature.attributes.wr_worktask_objectid}},

"parentGlobalId":"{{24.feature.attributes.wr_worktask_guid}}", "contentType": "image/jpeg", "name": "download.png",

"data": "{{base64(36.data)}}"}]}

 

Field Type -  Text

Key - f

Value - json

 

Field Type -  Text

Key - token

Value - {{24.portalInfo.token}}

0 Kudos
by Anonymous User
Not applicable

I have tried to hours to get this to work and ended up when the same error message consistently now. At first I was getting the error code 405 , parent id related, but I fixed that by adjusting the url. Now I am getting this: 

OUTPUT
  • Bundle 1Collection
    • Status code
      200
    • HeadersArray
    • Cookie headersArray
    • Data
      {"error":{"code":400,"message":"","details":["Unable to add attachment to the feature."]}}

Here is my url: 

https://services7.arcgis.com/xxxxxxPlNgTfOO6w/arcgis/rest/services/service_xxxxxxx/FeatureServer/lay...

I ended up reading through multiple forums, this one hits on the issue:

Adding, Updating, or Deleting Attachments in FeatureLayer applyEdits in REST API? 

James Tedrick‌ any help is greatly appreciated! Just want to add a survey123 report as an attachment (would prefer pdf, but I'll take any form) via Integromat 

I have the flow working for surveys > feature reports > cloud convert (pdf) > save & email 

The below is adjusted for testing the case use. Where I would like to add the pdf to the feature as an attachment, via updateAttachment, to replace the signature being captured in the survey. 

0 Kudos
MickFulton
Emerging Contributor

Hi Brita,

This is how I am attaching a survey123 report in my scenario.

Note - My feature report is being published against a record that is already existing in a different feature service. If you want to attach the report to the new record you are capturing in survey123 you will need to capture the objected and globalid first. Let me know if you are doing this as I have another workflow that will help.

You can choose to export as a PDF when creating your report. Configure it at https://survey123.arcgis.com/ (don't need to use cloud convert anymore)

0 Kudos