Select to view content in your preferred language

How to Access the ArcGIS Survey123 data using an API request?

255
4
4 weeks ago
LorenzoAju
New Contributor

I am working on an application that requires me to access the Survey123 data. I have been looking through the documentation, but I was not able to find anything that could help me with what I am trying to do. My end goal is to make an API request and get all the data, but I am not sure what the best way to do it is. Has anybody done something similar? Does anybody know where I can find the documentation to do something like this? Any help will be appreciated.

 

-Lorenzo

0 Kudos
4 Replies
MobiusSnake
MVP

Survey123 data can be accessed through the survey's feature service using the standard feature service REST API:

https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm

There are language-specific APIs that use the REST API, such as the Python API for ArcGIS.  Feature services can be accessed through that API using the arcgis.features module:

https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html

RobertAnderson3
MVP Regular Contributor

I've actually been working with one of our devs on this for the last little while and we just got it working yesterday, pulling all the survey data in, translating it into work orders in our management database, and passing back a work order number to the feature layer.

It's definitely possible to do, the tricky part we found was getting the authentication and permissions set up. The references Mobius shared are a good place to start. We're using the OAuth 2.0 credentials application to do the authentication, which I think only allows access to the layers owned by the same owner as the app. Each authentication method has it's own limitations it seems.

I'd be interested in hearing more from others who have done this too and what 'best practices' are for it.

DougBrowning
MVP Esteemed Contributor

One way is to have Pro on the machine running any Python script and it will grab the credentials for you from Pro.  It stays logged in for about 2 weeks.  

RobertAnderson3
MVP Regular Contributor

The existing script that has been using data fed to a SQL table from Power Automate webhooks is built with .NET (C#) so we were updating that which meant we couldn't run it through Pro otherwise that would have been our solution.