Hi there,
is it possible to enable to the "Time Settings" of a Feature Service with the Python API?
Thanks for your help
Karsten
Solved! Go to Solution.
Find the solution:
def updateServiceDef(token):
''' use this to update feature service max record count '''
updateServiceDefURL = 'https://services2.arcgis.com/.../ArcGIS/rest/admin/services/.../FeatureServer/0/updateDefinition'
params = {
'updateDefinition': {"timeInfo" : {"startTimeField" : "DateTimeField1", "endTimeField" : "DateTimeField2"}},
'async': 'true',
'token': token,
'f':'json'
}
response = requests.post(updateServiceDefURL, data=params, verify=True)
Find the solution:
def updateServiceDef(token):
''' use this to update feature service max record count '''
updateServiceDefURL = 'https://services2.arcgis.com/.../ArcGIS/rest/admin/services/.../FeatureServer/0/updateDefinition'
params = {
'updateDefinition': {"timeInfo" : {"startTimeField" : "DateTimeField1", "endTimeField" : "DateTimeField2"}},
'async': 'true',
'token': token,
'f':'json'
}
response = requests.post(updateServiceDefURL, data=params, verify=True)
You should be able to do this with manager.update_definition() as well
lyr = gis.content.get('{your Feature Layer item id}').layers[0]
lyr.manager.update_definition({
"timeInfo": {
"startTimeField": "{your Start date/time field}",
"endTimeField": "{your End date/time field}"
}
})
https://developers.arcgis.com/rest/services-reference/online/update-definition-feature-layer-.htm - This reference has plenty of other examples for Service Definition updates you can make with this function.