<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Access non-public results from Survey123 outside of agol environment in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1308854#M68183</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/412943"&gt;@ChristopherCounsell&lt;/a&gt;&amp;nbsp;I have tried the scripts and haven't made progress. I'm going to recap what I'm trying right now with my own account and ignore any other data.&lt;/P&gt;&lt;P&gt;I have a new account through my employer which didn't have anything in it. I created a quick Survey123 form and made 3 survey entries in it (3 submissions). I am now trying to use Python to download the data I entered into the new form to my local machine.&lt;/P&gt;&lt;P&gt;Here's what I see on this account when I look at "My Content"; everything there was created by Survey123.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-07-17 at 4.04.40 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/75577i6FAC102D6645757A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-07-17 at 4.04.40 PM.png" alt="Screenshot 2023-07-17 at 4.04.40 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I query with my username&amp;nbsp; (eg.&amp;nbsp;&lt;EM&gt;gis.content.search('owner:&amp;lt;username&amp;gt;')&lt;/EM&gt;) I get two results now (regardless of the Public setting)&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;[&amp;lt;Item title:"Testing Survey_results" type:Feature Layer Collection owner:&amp;lt;username&amp;gt;, &amp;lt;Item title:"Testing Survey" type:Form owner:&amp;lt;username&amp;gt; &amp;gt;]&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The links you sent me appear to want a&amp;nbsp;Feature Service - which I don't appear to have&lt;/P&gt;&lt;P&gt;My data is stubbornly staying on AGOL unless I manually download it&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jul 2023 23:15:59 GMT</pubDate>
    <dc:creator>ChristopheSchnaufer</dc:creator>
    <dc:date>2023-07-17T23:15:59Z</dc:date>
    <item>
      <title>Access non-public results from Survey123 outside of agol environment</title>
      <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1305982#M68094</link>
      <description>&lt;P&gt;First time posting here. I am trying to access Survey123 results that aren't&amp;nbsp;&lt;EM&gt;Everyone(public)&lt;/EM&gt; using the `arcgis` Python package from a machine that does not have ArcGIS installed. Unfortunately, I am only able to access public results in my account (and elsewhere). The end goal is to access data that had been shared with me from another group (and won't be public). The following sample code shows what I've done so far. Any help is appreciated&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS

# ESRI Survey123 API endpoint
survey123_api_url = 'https://www.arcgis.com'
survey123_username = '&amp;lt;my_username&amp;gt;'
survey123_password = '&amp;lt;my_password&amp;gt;'

# Get a list of non-public Survey123 data
survey_item_id = '88d7e11f82fa44c0a52db4ba435b86ff'
gis = GIS(survey123_api_url, survey123_username, survey123_password)

# Use SurveyManager to see everything available
survey_manager = arcgis.apps.survey123.SurveyManager(gis)
print(survey_manager.surveys) # only contains public items

# Try to get a non-public item
sbi = survey_manager.get(survey_item_id)
print(sbi) # only contains item when it's public

sr = gis.content.search('owner:&amp;lt;my account name&amp;gt;')
print(sr)   # also only contains public items&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 06 Jul 2023 19:23:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1305982#M68094</guid>
      <dc:creator>ChristopheSchnaufer</dc:creator>
      <dc:date>2023-07-06T19:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Access non-public results from Survey123 outside of agol environment</title>
      <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1305988#M68095</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/668721"&gt;@ChristopheSchnaufer&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Looks like you will need to import the survey123 module at the beginning of the script. Try adding:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;from arcgis.apps import survey123&lt;/LI-CODE&gt;&lt;P&gt;from there you can just use:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;survey_manager = survey123.SurveyManager(gis)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;in your script.&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 00:08:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1305988#M68095</guid>
      <dc:creator>alex_mapintel</dc:creator>
      <dc:date>2023-07-06T00:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Access non-public results from Survey123 outside of agol environment</title>
      <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1306339#M68106</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/674562"&gt;@alex_mapintel&lt;/a&gt;&amp;nbsp;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your response&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The code changes you suggested are the equivalent to what I have in line 13 in the original post. Nevertheless, I tried the changes as you suggested and there wasn't a change in the results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My code from line 13 in the original post:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;survey_manager = arcgis.apps.survey123.SurveyManager(gis)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is the equivalent of the following import and creation statements:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Declare import of survey123 from the arcgis.apps module
from arcgis.apps import survey123

# Stuff happens ...

# Create an instance of SurveyManager
# Equivelant to: survey_manager=arcgis.apps.survey123.SurveyManager(gis)
survey_manager = survey123.SuveryManager(gis)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2023 19:36:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1306339#M68106</guid>
      <dc:creator>ChristopheSchnaufer</dc:creator>
      <dc:date>2023-07-06T19:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Access non-public results from Survey123 outside of agol environment</title>
      <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1306423#M68108</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/668721"&gt;@ChristopheSchnaufer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No Worries. This is what I'd be looking into for the next steps:&lt;/P&gt;&lt;P&gt;1) Can you confirm that if you login to AGOL using a browser, using credentials from the python script, do you see that the item&amp;nbsp;'88d7e11f82fa44c0a52db4ba435b86ff' is shared with you?&lt;/P&gt;&lt;P&gt;2) What license type is associated with the account you are using? Viewer? Does this license type allow you to interrogate survey123 data?&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 01:08:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1306423#M68108</guid>
      <dc:creator>alex_mapintel</dc:creator>
      <dc:date>2023-07-07T01:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Access non-public results from Survey123 outside of agol environment</title>
      <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1306701#M68116</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/674562"&gt;@alex_mapintel&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;1) Yes I can log into the browser and see the data, it's in my account - I'm trying that out before I tackle accessing results from someone else. When I made the result associated with the ID &lt;EM&gt;Public&lt;/EM&gt; I can see it with Python and in the browser; when it's not public I can not see it with Python, but I can with the browser. Due to the sensitive nature of the clients results that I will need to access, they will be restricted and not public&lt;/P&gt;&lt;P&gt;2) I have the following when I check my license info:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;User type:&amp;nbsp;&lt;SPAN&gt;GIS Professional Advanced&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Role: Publisher&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 21:19:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1306701#M68116</guid>
      <dc:creator>ChristopheSchnaufer</dc:creator>
      <dc:date>2023-07-07T21:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Access non-public results from Survey123 outside of agol environment</title>
      <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1307183#M68133</link>
      <description>&lt;P&gt;What are you trying to do? You don't need to work with the survey manager to access 'results'. You can use the feature service (or a view) and work with that. I would use the survey manager if I wanted to say see all the features services targeted by surveys owned by a user. But I'd need to be the owner or an administrator to check this. You won't be either in the given scenario. Sounds like you can remove the Survey Manager from the workflow and ask for feature service access. Unless there is some specific thing you need to be doing, in which case you might need a higher level of permissions (or the client runs the script you develop).&lt;/P&gt;&lt;P&gt;But this isn't necessarily your issue...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;sr = gis.content.search('owner:&amp;lt;my account name&amp;gt;')
print(sr)   # also only contains public items&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are searching using gis.content.search and only returning publicly shared items owned by your account, it sounds like this isn't an issue with Survey Manager. It sounds like your ArcGIS Account does not have the necessary permissions. Given your user is a Publisher, if you have signed in correctly, you should be be able to access non-public content that your account owns.&lt;/P&gt;&lt;P&gt;Add a few lines to check your authentication&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS

# Connect to ArcGIS Online
url = 'https://www.arcgis.com'
username = '&amp;lt;my_username&amp;gt;'
password = '&amp;lt;my_password&amp;gt;'

gis = GIS(url, username, password)

# Show connection
print(gis)
# Show username of signed in user
user = gis.properties.user.username
print(user)
# Get all content owned by this user
ownerquery = "owner:" + user
content = gis.content.search(query=ownerquery,max_items=-1)
print(content)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should print&lt;/P&gt;&lt;P&gt;GIS @ https://&lt;EM&gt;magisian&lt;/EM&gt;.maps.arcgis.com version:2023.2&lt;BR /&gt;themagisian&lt;BR /&gt;[&amp;lt;all your content&amp;gt;]&lt;/P&gt;&lt;P&gt;I don't know why this would be failing for you as your script seems fine (and seems to be returning some content). The most obvious answers are that you are using the wrong username and password or don't own the content.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this working OK, we'll then need to understand more about what you're actually trying to do, and who will own the content. Like what is shared public? There's several parts to a survey (form, views, service, map and the folder - they should all be together). Get the authentication confirmed first and then get back to us.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2023 10:02:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1307183#M68133</guid>
      <dc:creator>ChristopherCounsell</dc:creator>
      <dc:date>2023-07-11T10:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Access non-public results from Survey123 outside of agol environment</title>
      <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1307650#M68144</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/412943"&gt;@ChristopherCounsell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;The content I'm currently testing against is my own content which is public, or not public, depending upon the test&lt;/P&gt;&lt;P&gt;I have run the code above as suggested and I have the following output. I am using SSO with the University of Arizona using the below (redacted) username, and don't see my public survey results&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;GIS @ &lt;A href="https://www.arcgis.com" target="_blank"&gt;https://www.arcgis.com&lt;/A&gt; version:2023.2&lt;BR /&gt;&amp;lt;login username&amp;gt;&lt;BR /&gt;[]&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;When I use my ESRI username in the above query after login, I get my public results but not my restricted ones&lt;/P&gt;&lt;P&gt;What I'm trying to do is pull down non-public survey results data to a local machine using Python (another programming language would be OK if I can get to the data). Currently I am testing against my own account&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 16:06:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1307650#M68144</guid>
      <dc:creator>ChristopheSchnaufer</dc:creator>
      <dc:date>2023-07-12T16:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Access non-public results from Survey123 outside of agol environment</title>
      <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1308198#M68166</link>
      <description>&lt;P&gt;Interesting... maybe it's tied to the SSO but it's showing your login so not sure.&amp;nbsp; What type of SSO? Where are you running this script?&lt;/P&gt;&lt;P&gt;'survey results' aren't an item. You don't need to interact with 'Survey123' at all here. You need access to the Hosted Feature Layers. Couple of scripts:&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en-us/knowledge-base/how-to-download-feature-service-items-from-arcgis-onlin-000018909" target="_blank"&gt;https://support.esri.com/en-us/knowledge-base/how-to-download-feature-service-items-from-arcgis-onlin-000018909&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/guide/download-data/" target="_blank"&gt;https://developers.arcgis.com/python/guide/download-data/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Want to give one of those a go?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2023 12:53:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1308198#M68166</guid>
      <dc:creator>ChristopherCounsell</dc:creator>
      <dc:date>2023-07-14T12:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: Access non-public results from Survey123 outside of agol environment</title>
      <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1308201#M68167</link>
      <description>&lt;P&gt;Just to add some discussion on the SSO - you may need to use a clientid or interactive login to authenticate (thought it's unusual to see that your logged in name is shown. maybe it's tied to token generation). This is less my area than the content/survey handling but it does appear to be access or authentication related.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/is-it-possible-to-use-the-arcgis-online-python-api/td-p/862406" target="_blank"&gt;https://community.esri.com/t5/arcgis-api-for-python-questions/is-it-possible-to-use-the-arcgis-online-python-api/td-p/862406&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2023 12:55:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1308201#M68167</guid>
      <dc:creator>ChristopherCounsell</dc:creator>
      <dc:date>2023-07-14T12:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Access non-public results from Survey123 outside of agol environment</title>
      <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1308854#M68183</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/412943"&gt;@ChristopherCounsell&lt;/a&gt;&amp;nbsp;I have tried the scripts and haven't made progress. I'm going to recap what I'm trying right now with my own account and ignore any other data.&lt;/P&gt;&lt;P&gt;I have a new account through my employer which didn't have anything in it. I created a quick Survey123 form and made 3 survey entries in it (3 submissions). I am now trying to use Python to download the data I entered into the new form to my local machine.&lt;/P&gt;&lt;P&gt;Here's what I see on this account when I look at "My Content"; everything there was created by Survey123.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-07-17 at 4.04.40 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/75577i6FAC102D6645757A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-07-17 at 4.04.40 PM.png" alt="Screenshot 2023-07-17 at 4.04.40 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I query with my username&amp;nbsp; (eg.&amp;nbsp;&lt;EM&gt;gis.content.search('owner:&amp;lt;username&amp;gt;')&lt;/EM&gt;) I get two results now (regardless of the Public setting)&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;[&amp;lt;Item title:"Testing Survey_results" type:Feature Layer Collection owner:&amp;lt;username&amp;gt;, &amp;lt;Item title:"Testing Survey" type:Form owner:&amp;lt;username&amp;gt; &amp;gt;]&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The links you sent me appear to want a&amp;nbsp;Feature Service - which I don't appear to have&lt;/P&gt;&lt;P&gt;My data is stubbornly staying on AGOL unless I manually download it&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 23:15:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1308854#M68183</guid>
      <dc:creator>ChristopheSchnaufer</dc:creator>
      <dc:date>2023-07-17T23:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Access non-public results from Survey123 outside of agol environment</title>
      <link>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1309294#M68202</link>
      <description>&lt;P&gt;I have a solution in hand! Thanks to&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/412943"&gt;@ChristopherCounsell&lt;/a&gt;&amp;nbsp;and &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/674562"&gt;@alex_mapintel&lt;/a&gt;&amp;nbsp; for all their help&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
from arcgis.gis import GIS

# ESRI endpoint
esri_url = 'https://www.arcgis.com'
esri_username = '&amp;lt;username&amp;gt;'
esri_password = '&amp;lt;password&amp;gt;'

# Connect to ArcGIS
gis = GIS(esri_url, esri_username, esri_password)

# Search for accessible content
search_results = gis.content.search('owner:&amp;lt;username&amp;gt;')
for one_search in search_results:
    # Find the feature service that you are looking for
    if one_search.type == 'Feature Service':
        # Choose the layer of interest
        feature_layer = one_search.layers[0]
        # Perform a query to get all of the data
        results = feature_layer.query(where='OBJECTId&amp;gt;=0')
        # Process the returned data (printing in this case)
        for data in results.features:
            print(data.as_dict)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I still am having other issues, but I can not be sure I'm accessing available data&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 21:44:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-non-public-results-from-survey123-outside/m-p/1309294#M68202</guid>
      <dc:creator>ChristopheSchnaufer</dc:creator>
      <dc:date>2023-07-18T21:44:20Z</dc:date>
    </item>
  </channel>
</rss>

