Search for layers REST API

4067
4
09-24-2014 05:23 AM
ThomasLefort
New Contributor

Hi,

 

I'd like to include some widget similar to the search layer popup you have in the map creation application. This popup helps you find layers based on type/keyword, etc...

 

I checked the ins and outs and saw the call was in the form http://{my-account}.maps.arcgis.com/sharing/rest/search?some_cryptic_blablabla

 

Can I use this web service in my own application? is it documented somewhere? can it be called without user or app identification, ie generic api?

 

Thanks,

 

Thomas

Tags (2)
0 Kudos
4 Replies
pmi
by
New Contributor II

http://{my-account}.maps.arcgis.com/sharing/rest/search?f=pjson&q=(tags:"tag1" AND "tag2") AND type:"Feature Service"

0 Kudos
pmi
by
New Contributor II

Thank you John for your answer. 

In the link you provided https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm I found statement Developers should avoid using search to find specific items? What should developers  use instead? 

I try to find all feature layers whit a certain tag. How can I achieve this using the REST API whit out using JS API Clients?

Here the whole statement:

[...] This search engine uses many different inputs to find the appropriate results and rank them. This often makes search 'fuzzy', making it ideal for human interaction, but not necessarily ideal for looking for specific records programmatically. Developers should avoid using search to find specific items (e.g. by title) as the results of these types of queries might change as the search engine evolves.

0 Kudos
JohnGrayson
Esri Regular Contributor

"...find all feature layers with a certain tag" is not the same as "...using search to find specific items".  I think you're reading too much into the highlighted sentence.  What you should avoid using 'search' for is when you want to access a specific item. If you need to access a specific item I would recommend creating a PortalItem and use the item id directly.  Searching for layers with a certain tag is a valid use of 'search', especially if you limit the search to within an org, group, or by user.  If you're using the JS API you can use the above classes to do what you need without having to do things via REST.

0 Kudos