ArcGIS Rest API Add Attachment Issue

1945
1
Jump to solution
11-09-2016 06:02 PM
CallumSmith2
Occasional Contributor

Hi

I am writing a python script that copies data from 1 hosted feature layer to another feature layer. This is to move data captured with survey 123 to another instance when changes to the survey have been made like extra questions.

It is all working fine except for the attachments. I can get the attachment as a string using the Attachment request detailed here: ArcGIS REST API . What I want to do with this data is write it to another feature layer that has attachments enabled using the "Add Attachment" request detailed here: ArcGIS REST API .

I am passing the string that has come from the "Attachment" request as a attachment parameter but no mater what I do I get the error:

java.lang.String cannot be cast to com.esri.arcgis.discovery.json.JSONObject

Does anybody know what I need to do to the String object to be able to pass it to the "Add Attachment" request so that it works without error? Unfortunatley the documentation is a bit light!

Any help appreciated.

cheers

Callum

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
CallumSmith2
Occasional Contributor

After lost of trial and error I managed to get it to work using the requests module as is outlined in this post: Correct syntax for ???RESTful??? addAttachment? and this post Unable to add attachment to ArcGIS Online feature service using Python and REST API - Geographic Inf... 

cheers

Callum

View solution in original post

0 Kudos
1 Reply
CallumSmith2
Occasional Contributor

After lost of trial and error I managed to get it to work using the requests module as is outlined in this post: Correct syntax for ???RESTful??? addAttachment? and this post Unable to add attachment to ArcGIS Online feature service using Python and REST API - Geographic Inf... 

cheers

Callum

0 Kudos