Does anyone have a good solution to backing up a hosted feature service using python, so a local backup can be run in task scheduler (preferably as a python script)? I tried to do this using Create Replica and the requests library, but it doesn't seem to be working. Does anyone know why the following python doesn't work?
import requests, json
payload={"geometry": '',
"geometryType": "esriGeometryEnvelope",
"inSR": '',
"layerQueries": '',
"layers": "0",
"replicaName": "read_only_rep",
"returnAttachments": 'true',
"returnAttachmentsDataByUrl": 'true',
"transportType": "esriTransportTypeURL",
"async": 'false',
"syncModel": "none",
"dataFormat": "filegdb",
"replicaOptions": '',
"f": "html"}
payload2 = json.dumps(payload)
r2 = requests.post('http://services2.arcgis.com/Pw6oQMuXLspbq6zz/arcgis/rest/services/SON_ROADS/FeatureServer/createReplica', data=payload2)