Hi there,
is it possible to get the number of feature layer of a hosted featue service with javascript api?
Thanks for your help!
Cheers,
Karsten
Karsten,
you could use esriRequest to get the layers array from the result.
require([ "esri/request" ], function(esriRequest) { var layerUrl = "http://yourserver/arcgis/rest/services/yourservice/FeatureServer"; var layersRequest = esriRequest({ url: layerUrl, content: { f: "json" }, handleAs: "json", callbackParamName: "callback" }); layersRequest.then( function(response) { console.log("Success: ", response.layers); }, function(error) { console.log("Error: ", error.message); }); });
Hi Robert,
this is what I searched.
Thank you very much.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.