<?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: Not Able to Get Service Layers From ArcGIS API for Python in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474853#M10039</link>
    <description>&lt;P&gt;Thanks a lost&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/86309"&gt;@EarlMedina&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My version then is 1.8.3 and maybe that why I was getting that error&lt;/P&gt;&lt;P&gt;By the way, can I ask you to kindly take a look at this Post too. I&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/issue-on-listing-service-service-workspaces/td-p/1408024" target="_blank"&gt;Issue on Listing Service Service Workspaces Inform... - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to get the service workspace information but not shore it is doable by ArcGIS API for Python. Thanks again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 17 May 2024 22:53:47 GMT</pubDate>
    <dc:creator>BHK</dc:creator>
    <dc:date>2024-05-17T22:53:47Z</dc:date>
    <item>
      <title>Not Able to Get Service Layers From ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474110#M10026</link>
      <description>&lt;P&gt;I am trying to get list of Layers from a Service using this code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.gis.server import Server
from arcgis.features import FeatureLayerCollection

gis_servers = gis.admin.servers.list()
server1 = gis_servers[0]
fservices = server1.services.list(folder='GDPServices')

for service in fservices:
        layer = FeatureLayerCollection(service.url)
        print(layer)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I am&amp;nbsp; receiving this error message&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;AttributeError: 'PropertyMap' instance has no attribute 'layers'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please let me know why this is happening and how I can fix this?&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 19:10:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474110#M10026</guid>
      <dc:creator>BHK</dc:creator>
      <dc:date>2024-05-16T19:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Not Able to Get Service Layers From ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474139#M10028</link>
      <description>&lt;P&gt;The problem here is that you're getting the admin url for those services (which is not what you want to be using). They come back in the format:&amp;nbsp;&lt;A href="https://server.domain.com/server/admin/services/serviceName.MapServer" target="_blank" rel="noopener"&gt;https://server.domain.com/server/admin/services/serviceName.MapServer&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If you're not doing any Server administration then it would be better to just use gis.content, I'd say.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;However, if you must stick with the Server submodule, then I think you can do so by changing your code to:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;server1 = gis_servers[0]
fservices = server1.content.list(folder='GDPServices')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a catch - content.list doesn't have filtering built in beyond the folder and&amp;nbsp;will try to initialize objects (this may be a slow process) from the services for you. So, unless you are certain all you have in there are Feature Services, I would recommend setting the as_dict param to True and getting only what&amp;nbsp; you need:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;server.content.list(folder="Hosted", as_dict=True)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This adds extra work as you will need to filter for feature services and then concatenate the expected urls from the services directory url and content urls. So again, unless there's a reason you need to be using the Server submodule, probably using gis.content is going to be easier for whatever you're doing.&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 20:18:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474139#M10028</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-05-16T20:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Not Able to Get Service Layers From ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474149#M10029</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/86309"&gt;@EarlMedina&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is working now but when trying this&amp;nbsp;&lt;STRONG&gt;server.content.list(folder="GDPService", as_dict=True)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I am getting&amp;nbsp; this error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;TypeError: list() got an unexpected keyword argument 'as_dict'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 20:28:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474149#M10029</guid>
      <dc:creator>BHK</dc:creator>
      <dc:date>2024-05-16T20:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Not Able to Get Service Layers From ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474159#M10030</link>
      <description>&lt;P&gt;Might be a version problem? I am on&amp;nbsp;&lt;STRONG&gt;2.3.0.1&amp;nbsp;&lt;/STRONG&gt;and it works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 20:48:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474159#M10030</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-05-16T20:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Not Able to Get Service Layers From ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474164#M10031</link>
      <description>&lt;P&gt;and this 2.3.0.1 is version of what?&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 20:56:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474164#M10031</guid>
      <dc:creator>BHK</dc:creator>
      <dc:date>2024-05-16T20:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Not Able to Get Service Layers From ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474244#M10033</link>
      <description>&lt;P&gt;sorry, the version of the API.&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 23:55:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474244#M10033</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-05-16T23:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Not Able to Get Service Layers From ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474576#M10035</link>
      <description>&lt;P&gt;Very silly question but where can I find the in used API version? is it the one compatible with Pro version?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 14:49:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474576#M10035</guid>
      <dc:creator>BHK</dc:creator>
      <dc:date>2024-05-17T14:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Not Able to Get Service Layers From ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474791#M10038</link>
      <description>&lt;P&gt;There's a few ways you can do this. You can either check the Pro Package Manager (arcgis), run "conda list" and check the arcgis package version, or in code like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
print(arcgis.__version__)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 21:11:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474791#M10038</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-05-17T21:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Not Able to Get Service Layers From ArcGIS API for Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474853#M10039</link>
      <description>&lt;P&gt;Thanks a lost&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/86309"&gt;@EarlMedina&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My version then is 1.8.3 and maybe that why I was getting that error&lt;/P&gt;&lt;P&gt;By the way, can I ask you to kindly take a look at this Post too. I&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/issue-on-listing-service-service-workspaces/td-p/1408024" target="_blank"&gt;Issue on Listing Service Service Workspaces Inform... - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to get the service workspace information but not shore it is doable by ArcGIS API for Python. Thanks again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 22:53:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/not-able-to-get-service-layers-from-arcgis-api-for/m-p/1474853#M10039</guid>
      <dc:creator>BHK</dc:creator>
      <dc:date>2024-05-17T22:53:47Z</dc:date>
    </item>
  </channel>
</rss>

