Select to view content in your preferred language

Send picture through REST

576
4
03-19-2019 12:23 PM
joerodmey
MVP Alum

Is it possible to send a picture through the REST API? Want to move a picture from one feature service to another.

0 Kudos
4 Replies
RandyBurton
MVP Alum

I've updated some attachments, so you should be able to move them.  Start by checking: Query Attachments.  There are links on the side of the page for Add Attachments and Delete Attachments.

0 Kudos
joerodmey
MVP Alum

Haven't had too much luck with it. Have any examples?

0 Kudos
RandyBurton
MVP Alum

It has been a while since my experimenting.  I'll try to dig up my code. What you can do is explore the REST API on AGOL and examine the returned html and json.  This should give you an idea of the coding needed and the process to follow.

The link to a feature should look something like:

https://<services>.arcgis.com/<account>/arcgis/rest/services/<feature>/FeatureServer/<layerID>?token=<token>

The link to query attachments (I've used "OBJECTID > 0' for the definition expression:

https://<services>.arcgis.com/<account>/arcgis/rest/services/<feature>/FeatureServer/<layerID>/queryAttachments?token=<token>

The links to update and add attachments will return a multi-part form:

https://<services>.arcgis.com/<account>/arcgis/rest/services/<feature>/FeatureServer/<layerID>/<parentID>/updateAttachment?token=<token>


https://<services>.arcgis.com/<account>/arcgis/rest/services/<feature>/FeatureServer/<layerID>/<parentID>/addAttachment?token=<token>
0 Kudos
joerodmey
MVP Alum

I'm trying to incorporate this into Integromat. A user will submit a picture via Survey123, hits integromat, runs REST to take the picture and update another feature service with the picture