AnsweredAssumed Answered

ArcGIS Online REST API - Add Item (type: Map Service) - WMS Style

Question asked by branders on Aug 28, 2015

Hello,

 

I am trying to use the ArcGIS Online REST API to add an item for a WMS map service via an HTTP POST to:

 

     <base url>/content/users/<username>/addItem

 

by posting the following data in the POST body:

 

{"culture": "en-us",

                "f": "json",

                "token": token,

                "type": "WMS",

                "title": title,

                "url": "...my WMS url here...",     

                "text": "my JSON text here",

                "extent": "-140.96, 60, -90.45,40}

 

using something like the following JSON as the "text" above:

 

{

  "layers": [

    {

      "name": "my_layer",

      "title": "my_layer"

    }

  ],

  "maxWidth": 2048,

  "copyright": "copyright here",

  "format": null,

  "url": "...url here...",

  "mapUrl": "...url here...",

  "maxHeight": 2048,

  "version": "1.3.0",

  "title": "...title here...",

  "spatialReferences": [

    3857,

    4326

  ]

}

 

When I substitute in an actual WMS URL and a layer name, this works -- I can successfully add the layer to ArcGIS Online, and view it on a map.

 

Now what I want to do is specify a WMS named style other than the default style to be applied to my layer.  Said another way, I'd like ArcGIS Online to fill in the OGC WMS &STYLES=... parameter for all requests it makes to my layer.  Is this possible via the ArcGIS Online REST API?  Can someone provide an example of how I might modify the JSON above to specify a WMS style?

 

Thanks!

Outcomes