Inserting Survey Response to ArcGIS Survey123 via REST API

1613
6
Jump to solution
12-11-2018 04:28 AM
DineshUthayakumar
New Contributor

Is this possible to programmatically insert survey responses into the Survey123?

0 Kudos
1 Solution

Accepted Solutions
NicolasRoger
Occasional Contributor

Ok it is more complex. I think you can manually do it this way:

-Go to your ArcGIS Online account and open the Feature Service of the Survey. The URL will be similar to this: https://services3.arcgis.com/0lL78GhXbg1P07WO/ArcGIS/rest/services/service_075dd44dce89477b8j3d8l3kf...

-Look at the bottom for the "Add Features" button.

-Choose JSON format and try to add your JSON string.

To automate this with the REST API, I think you will need to create a POST request to a URL similar to this one: https://services3.arcgis.com/0lL78GhXbg1P07WO/ArcGIS/rest/services/service_075dd44dce89477b8j3d8l3kf.../addFeatures

The request will include the following parameters:

"format" (json), "token" and "features" (the JSON string).

You will need to programmatically ask ArcGIS Online for a token to use in your request.

EDIT: You can find more information about the "addFeatures" REST service at this link: Add Features—ArcGIS REST API: Services Directory | ArcGIS for Developers 

View solution in original post

6 Replies
NicolasRoger
Occasional Contributor

You can populate answers from the Survey URL.

See here: How To: Prepopulate fields in Survey123 for ArcGIS by modifying a custom URL 

0 Kudos
DineshUthayakumar
New Contributor

Thanks for your response

The article you shared is helpful in a scenario when a user submits the prepopulated survey.

We are looking to integrate survey responses collected in a different system into Survey123.

Hence looking for an API capability to insert responses into Survey123.

0 Kudos
NicolasRoger
Occasional Contributor

Ok it is more complex. I think you can manually do it this way:

-Go to your ArcGIS Online account and open the Feature Service of the Survey. The URL will be similar to this: https://services3.arcgis.com/0lL78GhXbg1P07WO/ArcGIS/rest/services/service_075dd44dce89477b8j3d8l3kf...

-Look at the bottom for the "Add Features" button.

-Choose JSON format and try to add your JSON string.

To automate this with the REST API, I think you will need to create a POST request to a URL similar to this one: https://services3.arcgis.com/0lL78GhXbg1P07WO/ArcGIS/rest/services/service_075dd44dce89477b8j3d8l3kf.../addFeatures

The request will include the following parameters:

"format" (json), "token" and "features" (the JSON string).

You will need to programmatically ask ArcGIS Online for a token to use in your request.

EDIT: You can find more information about the "addFeatures" REST service at this link: Add Features—ArcGIS REST API: Services Directory | ArcGIS for Developers 

DineshUthayakumar
New Contributor

Hi Nicolas,

Thanks for the detailed response

I am unable to locate the Feature Service of the Survey123 application from the web interface.

Any hints or clues?

I tried finding URL in the below sites

  1. https://my.esri.com 
  2. https://survey123.arcgis.com/surveys 
  3. https://duitconsulting.maps.arcgis.com/ 

Thanks

Dinesh

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Dinesh,

Each Form Item has an associated Feature Layer (or Feature Layer View) - this can be identified as the link listed in the 'Layers' area of the form's item description.  Feature Layers have interfaces that conform to the ArcGIS REST API.

NicolasRoger
Occasional Contributor

In Survey123 Connect, there is a button to open the URL of the Survey in your ArcGIS Organisation website. From there,you should see the Feature Service of the Survey in your content.

0 Kudos