WAB Query URL Parameters( Hosted Feature services)

1424
6
Jump to solution
10-24-2016 03:30 PM
SowjanyaSunkara3
New Contributor III

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.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Sowjanya,

   So using the http://<your portal url>/sharing/rest/content/items/b210d1da1a664019916d244e0bdc9be2/data/?f=pjson would just get you the real id of your layer that you are wanting to query like "Census_7501" and then you full query url would look like:

http://<your portal url>/apps/webappviewer/index.html?id=b210d1da1a664019916d244e0bdc9be2&query=Census_7501,STATE NAME='California'

View solution in original post

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus

Sowjanya,

  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.http://<your portal url>/sharing/rest/content/items/32a83775654249dcae6b8f2eff5d4072/data/?f=pjson

Use URL parameters—Web AppBuilder for ArcGIS | ArcGIS 

SowjanyaSunkara3
New Contributor III

Robert Scheitlin, GISP

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?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sowjanya,

   So using the http://<your portal url>/sharing/rest/content/items/b210d1da1a664019916d244e0bdc9be2/data/?f=pjson would just get you the real id of your layer that you are wanting to query like "Census_7501" and then you full query url would look like:

http://<your portal url>/apps/webappviewer/index.html?id=b210d1da1a664019916d244e0bdc9be2&query=Census_7501,STATE NAME='California'

0 Kudos
SowjanyaSunkara3
New Contributor III

rscheitlin

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?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sowjanya,

   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.

0 Kudos
SowjanyaSunkara3
New Contributor III

The link here Use URL parameters—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers  

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.