Select to view content in your preferred language

ArcGIS Online REST API - Add Item (type: Map Service) - Override service properties

4422
1
03-11-2015 05:04 PM
BrockAnderson
New Contributor II

Hello All,

I am trying to use the ArcGIS Online REST API to add a new item of type Map Service.  I am successfully able to do this, but I also want to override some properties of the service when I create the item.  The "Items and Item Types" section of the REST API docs (ArcGIS REST API ) indicates that when adding an item with "type=Map Service" it's possible to specify a JSON string to override map service properties.  I have experimented with this, but can't seem to get it working -- ArcGIS Online seems to ignore any JSON I specify. 

I have tried specifying the JSON in the "text" parameter posted to the addItem REST end point, and I have also tried specifying the JSON in the body of the HTTP post.  In both cases, my JSON seems to get ignored.

Ideally I would like to specify JSON that ArcGIS Online injects into the "dynamicLayers=..." parameter of the "export" request it makes to the target ArcGIS Server. 

What should the format of the JSON be?

How do I pass the JSON in the HTTP POST request? (In the "text" parameter?)

What service properties is it possible to override?

Does anyone have an example?

Thanks for your help!

Brock

Tags (1)
0 Kudos
1 Reply
BrianTwardzik
New Contributor

It turns out not-much. As far as object structure goes it sticks most of the JSON text into a subobject called resourceinfo. I was investigating this to see why WMS services always requested PNG images. It turns out the WMSLayer constructor in the arcgisonline.js tries to reference a FORMAT item property. However, that property doesn't exist for the item type for WMS. The JOSN property for format, if set, ends up in resourceInfo, but doesn't get used to set the imageformat property of the WMS layer object.

So basically it defaults to PNG, forever. You can't bomb it into the URL as far as I can tell, it snips it off.

ESRI needs to fix their WMSLayer implementation.

0 Kudos