Select to view content in your preferred language

Setting the refresh interval for a hosted feature layer

01-16-2020 12:49 PM
New Contributor III

I have a project that will be adding hosted feature layers to a map, and eventually removing them and archiving the data for the layer. I would like to be able to set the refresh interval for the layer with the Python API so that the web map has a near live view of the data. I can set it manually in AGOL, but it will be a pain to have to manually do this for each layer. Does anyone know if it's possible to set the refresh interval using the Python API?

0 Kudos
2 Replies
New Contributor III

You can do it like this.

from arcgis.gis import GIS
import getpass

password = getpass.getpass("Enter password: ")

gis = GIS('org', 'username', password)
print("Connected to: {}\nConnected as: {}".format(
                                        + "." +,

webmap_item = gis.content.get('ce80541f342546319d99308cbeb9f675')

from arcgis.mapping import WebMap
webmap = WebMap(webmap_item)

json_key = 'refreshInterval'
for layer in webmap.layers:
    if json_key in layer:
        print('refreshInterval already exits with value {}'.format(layer[json_key]))
        print('Adding refreshInterval to the layer with value 2')
        layer[json_key] = 2    

New Contributor II

webmap_item refers to item of type web map. I'm trying to set refresh interval on my published tile layer. Any idea how can I do that for an individual layer rather than a map

0 Kudos