<?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: How to retrieve layer name and field name directly from REST endpoints in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-retrieve-layer-name-and-field-name-directly/m-p/612707#M13606</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Nidhi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can use the layerinfos of the ArcGISDynamicMapServiceLayer class. For my implementation: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var layerInfos:Array = ArcGISDynamicMapServiceLayer(&amp;lt;service&amp;gt;).layerInfos; //where service is the name of the map service 
var layerNames:Array = [];

for each (var layerInfo:LayerInfo in layerInfos){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (layerInfo.name){&amp;nbsp; // If the layer has a name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerNames.push(layerInfo.name);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This would populate layerNames (an array) with the name of every layer of the given &amp;lt;service&amp;gt;. There are a few attributes to the layerInfo, including id, max and min scales, parent layer ID and sublayer IDs. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is using the Flex API and not getting the information &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;directly &lt;/SPAN&gt;&lt;SPAN&gt;from the rest endpoint, however, hopefully is what you're after...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:12:18 GMT</pubDate>
    <dc:creator>JustinRobinson</dc:creator>
    <dc:date>2021-12-12T02:12:18Z</dc:date>
    <item>
      <title>How to retrieve layer name and field name directly from REST endpoints</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-retrieve-layer-name-and-field-name-directly/m-p/612706#M13605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi ,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a dynamic map service which at any time can contain n number of layers . I need to read the layername and attribute information of each layer thru the rest end points ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions about how to achieve this functionality will be highly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nidhi Arora.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jun 2011 13:28:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-retrieve-layer-name-and-field-name-directly/m-p/612706#M13605</guid>
      <dc:creator>nidhiarora</dc:creator>
      <dc:date>2011-06-22T13:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve layer name and field name directly from REST endpoints</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-retrieve-layer-name-and-field-name-directly/m-p/612707#M13606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Nidhi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can use the layerinfos of the ArcGISDynamicMapServiceLayer class. For my implementation: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var layerInfos:Array = ArcGISDynamicMapServiceLayer(&amp;lt;service&amp;gt;).layerInfos; //where service is the name of the map service 
var layerNames:Array = [];

for each (var layerInfo:LayerInfo in layerInfos){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (layerInfo.name){&amp;nbsp; // If the layer has a name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerNames.push(layerInfo.name);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This would populate layerNames (an array) with the name of every layer of the given &amp;lt;service&amp;gt;. There are a few attributes to the layerInfo, including id, max and min scales, parent layer ID and sublayer IDs. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is using the Flex API and not getting the information &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;directly &lt;/SPAN&gt;&lt;SPAN&gt;from the rest endpoint, however, hopefully is what you're after...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:12:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-retrieve-layer-name-and-field-name-directly/m-p/612707#M13606</guid>
      <dc:creator>JustinRobinson</dc:creator>
      <dc:date>2021-12-12T02:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve layer name and field name directly from REST endpoints</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-retrieve-layer-name-and-field-name-directly/m-p/612708#M13607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The info you need should be retrievable using this REST method:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/layers.html"&gt;http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/layers.html&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jun 2011 17:28:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-retrieve-layer-name-and-field-name-directly/m-p/612708#M13607</guid>
      <dc:creator>EokNgo</dc:creator>
      <dc:date>2011-06-29T17:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve layer name and field name directly from REST endpoints</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-retrieve-layer-name-and-field-name-directly/m-p/612709#M13608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you're using AGS 10 and you need more information than is included in LayerInfo and you want to get it in one request for all of the layers in a service, see:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/supportClasses/AllDetails.html"&gt;http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/supportClasses/AllDetails.html&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Aug 2011 22:59:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-retrieve-layer-name-and-field-name-directly/m-p/612709#M13608</guid>
      <dc:creator>DasaPaddock</dc:creator>
      <dc:date>2011-08-01T22:59:05Z</dc:date>
    </item>
  </channel>
</rss>

