Download photos as attachments

581
2
07-28-2017 03:12 AM
Nielsvan_Rijn2
New Contributor III

We have been working on python/reportlab scripts to create custom PDF reports of features. Based on the unique id of a record the related signatures and photos are downloaded and attached. The related photos have the same parentglobalid as the globalid of the parent record and can therefore be linked.

{

  'attributes':
    {

     'parentglobalid': '1bd4647f-44f1-43c9-820d-ef91b42fd37c',

     'objectid': 5,

     'globalid': u'c620f95b-0d9b-4775-bada-858d34718d7b',

     'Creator': u'<creatornaam>',

     'EditDate': 1500029670862L,

     'Editor': <editornaam>',

     'CreationDate': 1500029670862L

    }

}

 

Using the objectid of the attachment a specific URL for the photo can be constructed as can be seen below.

http://services.arcgis.com/..../arcgis/rest/services/service_../FeatureServer/1//5//attachments//5

 

The 5 is derived from the objectid, we were assuming the last number would always need to be the same. However if someone uploads an extra photo to a webmap the last number will become 1 higher and not the same anymore as the objectid:

http://services.arcgis.com/..../arcgis/rest/services/service_../FeatureServer/1//5//attachments//6

 

Our question is how we can know the last number?

 

Too bad we just found out that the last release supports custom reports. Our report works great except for the attached photos described above.

0 Kudos
2 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Niels, 

To get the attachments for a feature, you need to access the attachmentInfos property: ArcGIS REST API 

Nielsvan_Rijn2
New Contributor III

Hi James,

Thanks, very helpful!

0 Kudos