0

I'm trying to figure out how I can get the data collected with Survey 123 out of ArcGIS Online via the REST API.

I am using Postman to try and formulate the POST request, but, all it shows me is the feature service metadata. In fact, it returns JSON that contains everything about the feature service but no actual data.

What am I doing wrong?

3
  • 1
    can you give an example url? (POST is send data [insert] GET is getting [select] data)
    – Mapperz
    May 21, 2019 at 18:00
  • You need to go a few levels deeper in the url. /layer#/query. Use the arcgis api for python. Also fiddler if you want to catch the actual request May 26, 2019 at 17:51
  • Yeah, finally figured out I needed to add /query on the end. The docs leave a little something to be desired. Postman is far more capable than Fiddler IMO.
    – tnk479
    May 26, 2019 at 17:54

2 Answers 2

0

You will need to create a replica of your feature service.

https://developers.arcgis.com/rest/services-reference/create-replica.htm

However once you create a replica you need a method to download the data rather having HTML or JSON returned you as you currently are in POSTMAN.

This blog post from ESRI explains how to do this using Python and supplies a fully functioning script.

https://community.esri.com/groups/survey123/blog/2016/12/14/migrating-data-from-the-survey-feature-service-to-an-enterprise-geodatabase

0

I think the current docs that helped me are at https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm.

I was able to download survey123 row attribs and file attachments using the following urls. Note token is a short-lived access token you also get from a call to ESRI using a client secret associated with your survey/dataset.

# the layer of interest
layer_number = 0

# base url for layer
base_url = "https://services3.arcgis.com/<gobblygookID>/arcgis/rest/services/survey123_<gobblygookID>/FeatureServer/{layer_number}"

# url to get row count
row_count_url = "{base_url}/query?f=pjson&where=1=1&returnCountOnly=true&token={token}"

# url to get list of object ids
object_ids_url = "{base_url}/query?where=1=1&returnIdsOnly=true&f=pjson&token={token}"

# url to get row attribs
row_attrib_url = "{base_url}/{objectid}?f=pjson&token={token}"

# url to get attachment attribs (id, size, name, contentType, keywords, parentGlobalId)
attachment_attrib_url = "{base_url}/{objectid}/attachments?f=pjson&token={token}"

# url to download attachment data (note no 'f' param for raw data)
attachment_data_url = "{base_url}/{objectid}/attachments/{attachmentid}?token={token}"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.