Get portal item

3897
3
11-19-2013 02:10 PM
danbonab
New Contributor II
How do I get a portal item in JSAPI? I have a url to my portal and also the item id.
Silverlight API has a ESRI.ArcGIS.Client.WebMap.WebMap.FromPortalItemAsync utility function which works great.
Anything similar in JSAPI?
Thanks
0 Kudos
3 Replies
ArtemisFili
Esri Contributor
You can use the queryItems method of Portal class
https://developers.arcgis.com/en/javascript/jsapi/portal-amd.html#queryitems

This method takes a PortalQueryParams parameter.
https://developers.arcgis.com/en/javascript/jsapi/portalqueryparams-amd.html

The PortalQueryParams class exposes the q parameter which is the query string to search with. View the ArcGIS REST API Search Reference for details on constructing a valid query (http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000mn000000). You will be able to set the item id by using this q parameter.
danbonab
New Contributor II
Thanks artemisfili,
That is what I'm doing right now but the problem is that queryItems only returns web map item, then I have to get itemDataUrl and make another call (through esri.request or similar ajax call) to get actual web map data.
My question basically was that is there any utility function so I don't have to make two calls to get web map data.

Cheers
0 Kudos
ArtemisFili
Esri Contributor