Working with images from a webhook

238
1
08-13-2018 10:16 AM
MattStayner
Occasional Contributor

What is the best way to see if there are images attached to a survey and to determine which question they belong to? Below is an example...

I created a test survey with 3 fields: name (name), before photo (photo) and after photo (photoafter). I submitted the form and received the attached webhook payload. In the payload I can see the name I entered in, but nothing about the attached images.

I see I can make a call to: [serviceUrl]/[addResults id]/[uniqueId]/attachments?f=pjson&token=[token] to get information about the attachments for that object (see below). In the json object keywords contains the name of the feature attribute.

Is using that endpoint and looking at keywords the best way to 1) see if there are any attachments to the survey and 2) to determine which question they belong to?

Thanks,

Matt

{   "attachmentInfos" : [     {       "id" : 5,        "globalId" : "3d424dd8-de4b-4273-a9ff-4c87010115e6",        "parentGlobalId" : "63d210e7-aecd-4386-9e1b-77c04071d030",        "name" : "broken-fire-hydrant-lying-sidewalk-46171082.jpg",        "contentType" : "image/jpeg",        "size" : 117352,        "keywords" : "photo"     },      {       "id" : 6,        "globalId" : "2f119743-a9e5-4ae4-845b-2c30c690964f",        "parentGlobalId" : "63d210e7-aecd-4386-9e1b-77c04071d030",        "name" : "Downtown_Charlottesville_fire_hydrant.jpg",        "contentType" : "image/jpeg",        "size" : 24352,        "keywords" : "photoafter"     }   ] }
0 Kudos
1 Reply
JamesTedrick
Esri Esteemed Contributor

Hi Matt,

The current pattern for accessing attachments is exactly as you describe.

0 Kudos