<?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: Recent Failure of Using ArcGIS Online Hosted Feature Layers as Inputs in arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1668202#M74942</link>
    <description>&lt;P&gt;This could be a red herring but I believe I have fixed my issue. I changed two things specifically. Firstly, when creating a variable using the REST URL, I used double quotes instead of single quotes. Secondly, I changed the way I was writing to memory:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# original way I was writing to memory:
fl = r'memory/layer'

# new way I am writing to memory:
fl = 'memory/layer'&lt;/LI-CODE&gt;&lt;P&gt;The difference seems arbitrary but I believe it made the difference. All of the scripts are running as they should now. I'll accept this as the solution but I'll update this thread if the issue reoccurs. Thanks all!&lt;/P&gt;</description>
    <pubDate>Mon, 24 Nov 2025 14:48:05 GMT</pubDate>
    <dc:creator>B_NewGE</dc:creator>
    <dc:date>2025-11-24T14:48:05Z</dc:date>
    <item>
      <title>Recent Failure of Using ArcGIS Online Hosted Feature Layers as Inputs in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1667181#M74931</link>
      <description>&lt;P&gt;Hello, I have a script that has ran without failure for the last 6 months but very recently started failing. The script includes lines of code that pass in a hosted feature layer from our ArcGIS Online instance into various geoprocessing tools. Here is an example:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;well_points = "https://services3.arcgis.com/7FTAucs3gO3lUZyu/arcgis/rest/services/Well_Points_Input/FeatureServer/0"
well_points_sort = r'memory/well_points_fl_sort'

arcpy.management.Sort(in_dataset=well_points,out_dataset=well_points_sort,sort_field='WellName ASCENDING')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As of very recently, it started failing with these errors:&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 000732: Input Dataset: Dataset &lt;A href="https://services3.arcgis.com/7FTAucs3gO3lUZyu/arcgis/rest/services/Well_Points_Input/FeatureServer/0" target="_blank"&gt;https://services3.arcgis.com/7FTAucs3gO3lUZyu/arcgis/rest/services/Well_Points_Input/FeatureServer/0&lt;/A&gt; does not exist or is not supported&lt;BR /&gt;Failed to execute (Sort)&lt;/P&gt;&lt;P&gt;Here's another example with a different error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;well_master_points_hosted = "https://services3.arcgis.com/7FTAucs3gO3lUZyu/arcgis/rest/services/Well_Master_Points/FeatureServer/0"

insert_field_list = [f.name for f in arcpy.ListFields(well_master_points_hosted)]

icur = arcpy.da.InsertCursor(well_master_points_hosted, insert_field_list)
with arcpy.da.SearchCursor(mem_well_master_points, insert_field_list) as cursor:
    for row in cursor:
        icur.insertRow(row)
del icur

&lt;/LI-CODE&gt;&lt;P&gt;Error code: 400&lt;/P&gt;&lt;P&gt;Description: Bad syntax in request. Message: Invalid URL&lt;/P&gt;&lt;P&gt;As you can tell, I am using the full REST URL as the input to pass in my hosted feature layer. Can I no longer use the REST URL per the October release, and if so, how can I now correctly pass in our hosted feature layers? TIA!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Nov 2025 16:14:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1667181#M74931</guid>
      <dc:creator>B_NewGE</dc:creator>
      <dc:date>2025-11-19T16:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Recent Failure of Using ArcGIS Online Hosted Feature Layers as Inputs in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1667834#M74938</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/908586"&gt;@B_NewGE&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;How are you authenticating with AGOL?&amp;nbsp; Whenever I'm using REST URLs with arcpy, I'll sign-in using the API &lt;STRONG&gt;and&lt;/STRONG&gt; with arcpy.SignIntoPortal.&amp;nbsp; Ex:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Connect to AGOL
gis = GIS('https://www.arcgis.com', username, password)
arcpy.SignIntoPortal('https://www.arcgis.com', username, password)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've found this get's around the error about the URL not existing/being accessible.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Nov 2025 11:55:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1667834#M74938</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2025-11-21T11:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Recent Failure of Using ArcGIS Online Hosted Feature Layers as Inputs in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1667844#M74939</link>
      <description>&lt;P&gt;I was curious about this, and was motivated to dig in when I saw&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10527"&gt;@JakeSkinner&lt;/a&gt;&amp;nbsp;response: I despise putting my credentials in a script if I don't have to! (And most days, we're just 'reading' data from a script, not trying to make edits or updates).&lt;BR /&gt;&lt;BR /&gt;So just to confirm, from my end at least:&lt;BR /&gt;&lt;BR /&gt;ArcPy doesn't seem to have any trouble&amp;nbsp;&lt;EM&gt;reading&amp;nbsp;&lt;/EM&gt;from the Service URL; and we can Sort directly from the REST too, into a new Feature Class.&amp;nbsp; The short sample script below will show as much.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;But when I check your&amp;nbsp;REST, i.e. (&lt;A href="https://services3.arcgis.com/7FTAucs3gO3lUZyu/arcgis/rest/services/Well_Points_Input/FeatureServer/0" target="_blank"&gt;https://services3.arcgis.com/7FTAucs3gO3lUZyu/arcgis/rest/services/Well_Points_Input/FeatureServer/0&lt;/A&gt;), I see the message 'Token is Required'.&amp;nbsp; Is it possible that ownership or sharing permissions have changed recently, or the account used to invoke the script has changed?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy 
arcpy.env.addOutputsToMap = False

# ArcGIS US States REST Service:
hfc = 'https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Census_States/FeatureServer/0'

# Check our ability to 'Search' and Select from the Service:
count = 0
with arcpy.da.SearchCursor(hfc, ['*']) as sCursor:
    for row in sCursor:
        count+=1
print('We found', count, 'records.\n')

# Now lets try to sort by Area (SQMI), and list the results:
arcpy.management.Sort(hfc, "memory/HFC", 'SQMI')
with arcpy.da.SearchCursor("memory/HFC", ['STATE_NAME']) as sCursor:
    for row in sCursor:
        print(row[0])&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Nov 2025 12:45:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1667844#M74939</guid>
      <dc:creator>D_Atkins</dc:creator>
      <dc:date>2025-11-21T12:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Recent Failure of Using ArcGIS Online Hosted Feature Layers as Inputs in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1667869#M74940</link>
      <description>&lt;P&gt;My organization uses SAML credentials and I was never successful in authenticating through username and password like you did above. I could try it again just to see if I can get it to work. I am using the python.exe that came with the ArcGIS Pro install as my interpreter. With that, this authentication has always worked previously:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis = GIS("home")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Nov 2025 14:29:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1667869#M74940</guid>
      <dc:creator>B_NewGE</dc:creator>
      <dc:date>2025-11-21T14:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Recent Failure of Using ArcGIS Online Hosted Feature Layers as Inputs in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1667870#M74941</link>
      <description>&lt;P&gt;My organization has its own ArcGIS Online instance and none of our services are shared with the public, so an outside user would not be able to access our services. You are correct, the script can read the REST URL and export to a separate feature class, it's writing to the REST URL that is the problem. I have a couple scripts that requests data from a third party via their API, and writes to our layers in AGOL. The settings of the feature layer(s) have not changed at all, which is why I thought the October release may have changed parameters for calling REST URLs.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Nov 2025 15:20:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1667870#M74941</guid>
      <dc:creator>B_NewGE</dc:creator>
      <dc:date>2025-11-21T15:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Recent Failure of Using ArcGIS Online Hosted Feature Layers as Inputs in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1668202#M74942</link>
      <description>&lt;P&gt;This could be a red herring but I believe I have fixed my issue. I changed two things specifically. Firstly, when creating a variable using the REST URL, I used double quotes instead of single quotes. Secondly, I changed the way I was writing to memory:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# original way I was writing to memory:
fl = r'memory/layer'

# new way I am writing to memory:
fl = 'memory/layer'&lt;/LI-CODE&gt;&lt;P&gt;The difference seems arbitrary but I believe it made the difference. All of the scripts are running as they should now. I'll accept this as the solution but I'll update this thread if the issue reoccurs. Thanks all!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Nov 2025 14:48:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/recent-failure-of-using-arcgis-online-hosted/m-p/1668202#M74942</guid>
      <dc:creator>B_NewGE</dc:creator>
      <dc:date>2025-11-24T14:48:05Z</dc:date>
    </item>
  </channel>
</rss>

