A map is composed of operational and basemap layers, along with tasks. Both operational and basemap layers correspond to ArcGIS services. For each layer type, the following parameters are required:
There are additional optional parameters for layers. For example, there is a title that is used in the legend.
Tasks expose pre-authored parameterized geospatial tasks. Currently, only the Query task is supported.
The following is an example of a map on ArcGIS Online that is publically available and its JSON:
"title": "SS5_Events - Events"
There is much more to the JSON structure; however, the operational and basemap layer definition is what is critical to composing a map. To learn more about the web map format, see Web map format in the ArcGIS REST API.
Another way to understand the JSON format is to view examples from ArcGIS Online. You can read the JSON of a map that you create in ArcGIS Online by manipulating the URL in your web browser.
For example, to see the JSON of the map in Step 1, use the following URL: http://www.arcgis.com/sharing/content/items/d5e02a0c1f2b4ec399823fdd3c2fdebd/data?f=pjson.
Reading the JSON of a publically available ArcGIS Online map can be accomplished using the steps in the previous section. If you attempt to access a map that is only available to certain user accounts, you receive a 400 or 403 error. Accessing those maps require generating a token, then providing it in the ArcGIS.com request. If you need to access a map that is only available to certain user accounts, generate a token based on your user ID and provide that in your ArcGIS.com request.
A token is generated by entering the following in the address bar of your browser: https://www.arcgis.com/sharing/generateToken?f=json&request=gettoken&username=myusername&password=mypassword&Referer=MyToken, where myusername and mypassword are replaced with your ArcGIS Online user name and password, respectively.
This generates a response similar to the following:
Once you have the token, use its value to retrieve the map's JSON by including "&token=" and the token value at the end of the URL. For example, http://www.arcgis.com/sharing/content/items/0a27f5cb1f07478fbdf117b70231c5c2/data?f=pjson&token=nEvfvFwGBaQ7laRKxUlH8ACGkwm2aHqUKiscQbyoG4lmVZU8EiG2NLa5nj6UKiEa. This uses the token value to request the formatted JSON from the specified item.