Does the Query URL parameters format apply to querying Hosted Feature services?
I'm seeing a "Invalid Layer name or Id" error in Dev Tools ( Chrome). I see the layer name listed in the map _layerInfo but eventually get the error and the map doesnt zoom to or locate the feature.
Solved! Go to Solution.
Yes it works for hosted feature services. Did you follow the help doc for getting the layer Id (not the layer name):
Since the layer name can be changed, it is strongly recommended that you use the layer ID in the query. You can retrieved the layer ID from the web map ID as shown below.
I'm using that help doc as my reference. Our Portal map has services that are hosted and services from other federated servers. I have attached my map URL and one of the hosted services ( in the Map Contents) looks like this:
When I checked the _layerInfos variable, I saw that This layer had an ID of 22 which I used in the query parameter and that didnt work either.
Is there any other way to verify the layer ID as the map has a mix of services from several servers?
Robert- I was able to get it working. I was NOT using the real Id of the layer earlier ( which happens to be numbers appended at the end of the actual mapservice name).
I still had to use the _layerinfos from dev tools to get the layer id. Using the sharing/rest/content/items.... url shows me some info about the web map but nothing about the layers. Am I missing some setting?
Not sure why you did not see the layer id using the documented method.
Glad you go tit working though.
Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.
says that the map need to be public to get the layer Ids. Our map is shared only within a group in our Portal which maybe why I dont see the layer Id.