Hi
Does anyone know if it is possible to get a webmap from Portal in it's web map specification format using the JS API (4.x)? If so, any help would be greatly appreciated.
Thanks
Solved! Go to Solution.
I guess the key is figuring out at what level you need the JSON info, like looking for the webmap info might be just adding 'webmap?f=pjson' to the end of a known content item, like:
While looking at the data would mean adding 'data?f=pjson' to the end of the item:
Portal is like your own personal ArcGIS Online. You can create layers that are accessible using their defined REST endpoint. The 'JSON web map specification' is accessible by entering the feature layer's URL, with our without the ArcGIS Javascript API. Such as https://services5.arcgis.com/4LKAHwqnBooVDUlX/arcgis/rest/services/PARKS_Historic_Old_Growth_Trees/F... . The only difference between this (ArcGIS Online) and Portal would be the server information such as https://services5.arcgis.com would be something else like https://local.server.com.
ArcGIS Javascript API is a Javascript library located through a URL that provides functionality (through Javascript) to access ArcGIS Online and Portal REST endpoints (and other things). But the 'JSON' representation of the data being access is available through the layers URL (REST URL). The only thing needed to write a publicly accessible ArcGIS Javascript API web application that access Portal data is to have the web app housed on a publicly exposed server running IIS or Apache, and the Portal publicly (outside the agency's firewall) available with data layers that are shared to everyone.
Hope this makes sense and is answering your question.
Thanks, that all makes sense.
However what I'm after is the web map specification of a web map as opposed to an individual feature layer. A JSON object with all the properties listed here that describes a web map on portal.
Not sure what you are missing. If you are looking for Map information you can see that by looking at the map REST service such as:
https://tagis.dep.wv.gov/arcgis/rest/services/Hosted/Apples_and_Solar/MapServer
Or as JSON:
https://tagis.dep.wv.gov/arcgis/rest/services/Hosted/Apples_and_Solar/MapServer?f=pjson
A lot of those properties, like 'bookmarks' or 'widgets' almost seem like attributes for an application, even though it does say they are available for the Webmap. Not sure if that's viewable like this or not.
I guess the key is figuring out at what level you need the JSON info, like looking for the webmap info might be just adding 'webmap?f=pjson' to the end of a known content item, like:
While looking at the data would mean adding 'data?f=pjson' to the end of the item:
It looks like the second URL example is the one we need. Thanks