Hello I’ve seen this question asked but never seen a solution... but: is there a way to query the attachment service URL?
Example: https://services1.arcgis.com/AGOInstanceName/ArcGIS/rest/services/FeatureName/FeatureServer/3/queryA...I’d like to query the whole attachment table related to a feature service so an application I’m creating can use the URL’s to pull up the attachments.
I can query and capture the data for the service but I can't capture the attachments that are related without iterating through all the object ids.
There is a returnUrl parameter which returns the attachment URL with the results: https://developers.arcgis.com/rest/services-reference/query-attachments-feature-service-layer-.htm#GUID-5D234BC8-99C3-4792-B903-87FAA3CA3FA6
You still have to append a token if it's a secured service though, otherwise the link won't open.
Thanks Michael. But I’ve tried the returnurl parameter. In fact, here is what I tried exactly:
https://services5.arcgis.com/v3DMn7xrRivFMRiU/ArcGIS/rest/services/survey123_86170d7dd0954ceb838466fd88944112_fieldworker/FeatureServer/0/query?where=1%3D1&outFields=*&returnGeometry=true&returnUrl=true&f=geojson
as you can see, I’ve included the returnurl parameter... unfortunately I only get the other data but not the url.
Any ideas..?
Here is the relavant portion of the query:
/FeatureServer/0/query?returnUrl=true&f=geojson>
You have to use the queryAttachments endpoint (links in comments above use the query endpoint) which is layer specific (i.e. you must specify FeatureLayer/<layer_number>/queryAttachments). So something like this works (HTML version): https://services5.arcgis.com/v3DMn7xrRivFMRiU/ArcGIS/rest/services/survey123_86170d7dd0954ceb838466fd88944112_fieldworker/FeatureServer/0/queryAttachments?objectIds=&globalIds=&definitionExpression=1%3D1&attachmentsDefinitionExpression=&attachmentTypes=&size=&keywords=&resultOffset=&resultRecordCount=&returnUrl=true&f=html&token=
Or this for pjson: https://services5.arcgis.com/v3DMn7xrRivFMRiU/ArcGIS/rest/services/survey123_86170d7dd0954ceb838466fd88944112_fieldworker/FeatureServer/0/queryAttachments?objectIds=&globalIds=&definitionExpression=1%3D1&attachmentsDefinitionExpression=&attachmentTypes=&size=&keywords=&resultOffset=&resultRecordCount=&returnUrl=true&f=pjson&token=
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.