Web Map data is described on the ArcGIS REST API site under the Common data types section. I am curious whether I can request the current JSON configuration as shown in the examples (using /data in the url), modify it, and POST it back? As an example, I could request the web map data, add or modify the bookmarks list (by editing the JSON web map data, see example here), and submit the update to modify the web map item in ArcGIS Online. Does a REST operation or alternative exist for this?
-
3Take a look at github.com/arcpy/AutomaticUpdatesIntoFeatureService/blob/master/… - does this do what you want?– KHibmaJan 8, 2015 at 15:09
-
Thanks @KHibma, I would like to update properties of the web map (bookmarks) and am not interested in updating map or feature services.– AdamJan 8, 2015 at 15:23
2 Answers
This is definitely possible if the service is a FeatureService. I would do this using Python and either the built-in urllib modules or with requests (my preferred choice).
This example shows how to update features. You can also add features and delete features.
Edit:
You can probably just append a bookmark to the list of bookmarks. You can see this when you view the JSON:
{
"extent": {
"spatialReference": {"wkid": 102100},
"xmax": -2050429.2553922953,
"xmin": -9946068.529135762,
"ymax": 1287382.3514782274,
"ymin": -4299247.17182725
},
"name": "(Initial view of Brazil)"
},
-
Thanks for the response @crmackey. In this case, the example I gave re: bookmarks is what I would like to achieve. I am not interested in the the map or feature services but in updating properties of the web map such as the bookmarks.– AdamJan 8, 2015 at 15:22
-
1@amarinel Sorry, I misunderstood your question. You can probably just append a bookmark to the list of bookmarks through a python POST request. I edited my question to show an example from the link you provided. I am not 100% sure if this will work though.– crmackeyJan 8, 2015 at 16:11
-
1Thanks again. I did figure it out. A POST request is exactly what I needed...I just wasn't sure which operation to use. I needed to use Update Item...makes perfect sense...but I was getting confused between item details and the actual item data/content.– AdamJan 8, 2015 at 16:48
The Update Item operation is how to do this. See helpful post on GeoNet.
I was not sure how to implement Update Item or what parameter to use to POST the data I was requesting and modifying. I think I was confused between the Items common parameters (such as tags, title, type, etc.) and the actual content (data) of the item (bookmarks, extent, etc.) which is what I wanted to update (by appending bookmark JSON as @crmackey suggested). The solution for me was after requesting and modifying the Item Data, I made a POST request with the modified JSON as the text parameter of the Update Item operation.