Summary
The first parameter of the ArcPy function ConvertWebMapToMapDocument requires a JSON string defining the web map. The ArcGIS Web APIs (JavaScript, Flex, and Silverlight) allow developers to obtain this JSON string from a web application. Another way to obtain the string, using the Fiddler web debugging tool, is described in this article.
Procedure
- Log in to ArcGIS.com. Open the applicable web map in the map viewer.
- Run the Fiddler tool, and reset the option to capture traffic:
a. From the File menu, un-check Capture Traffic.
b. Clear any existing lines by clicking Edit > Remove > All Sessions.
c. Enable the option to Capture Traffic again. - In the map viewer, click the Print button.
- In Fiddler, wait for the lines related to the Print operation to be displayed in the tool dialog, then disable traffic capture and click the Inspectors tab.
- In the dialog window there are several lines of traffic shown. Look for the line with the following parameters:
• In the Host column:
Host = utility.arcgisonline.com
• In the URL column:
URL = /arcgis/rest/services/Utilities/PrintingTools/...
- Highlight the indicated record in the dialog window, and click the WebForms sub-tab under the Inspectors tab.
- a. View the Body section in the Inspectors/Webforms tab.
b. In the Body section, locate the following item:
Name = Web_Map_as_JSON
b. Click in the Value section for that item to highlight the value.
c. Right-click, click Copy, and paste into a text editor or Python editor capable of holding a very large string.
- a. When the JSON string has been pasted into a Python script, put single-quotation marks around the entire string, and assign the string to a local variable.
b. If desired, split the string for readability, and format it according to Python syntax rules for splitting strings across multiple lines.
- Use the local variable as the first parameter to the ConvertWebMapToMapDocument function.