AnsweredAssumed Answered

How do I get question names using the REST API?

Question asked by mstayner@utilisync.com on Oct 18, 2018
Latest reply on Oct 23, 2018 by mstayner@utilisync.com

I would like to get the question names for a Survey123 form using the REST API. What is the best way to do that?

 

I found the following endpoint, which gets me close:

 

https://www.arcgis.com/sharing/rest/content/items/[item_number]/info/[form_name].webform

 

In the return object from the above endpoint I get a key-value pair where the key is "model" and the "value" is shown below. It looks like XML, but there is a "\n" on every line that is making it difficult for us to process.

 

<Form_3            
xmlns:esri=\"http://esri.com/xforms\"           
xmlns:jr=\"http://openrosa.org/javarosa\"           
xmlns:odk=\"http://www.opendatakit.org/xforms\"           
xmlns:orx=\"http://openrosa.org/xforms\" id=\"Form_3\">\n                                 
<starttime/>\n                                 
<AOMInitials/>\n                                 
<AOMOther/>\n                                 
<DailyScheduled/>\n                                 
<SpecialInspectionType/>\n                                 
<SpecialOther/>\n                                 
<SpecialLocation/>\n            
<endtime/>\n                                 
<meta>\n                                           
<instanceID/>\n                                 
</meta>\n                       
</Form_3>\n

 

 

How can we convert that to standard XML/JSON? Is there a better endpoint we could use where we could get back the "model" in JSON or correctly formatted JSON?

 

Thanks!

 

Matt

 

 

Outcomes