I'm testing out the extract changes endpoint and I finally got it to work, but no matter what I do, the request returns always empty "updates".
I have tried editing a couple of features, either the shape or the table information, in map viewer. Then I save it. Then I make the call again, and the information is updated in "adds" object, but nothing in "updates". The return_updates parameter is set to True.
Do I need to change the serverGen or something else? I don't get it.
gis = GIS("URL", username, password)
item = gis.content.get("ID")
flc=FeatureLayerCollection(item.url, gis)
sg = flc.properties.changeTrackingInfo.layerServerGens[0].serverGen
req = flc.extract_changes(
layers=[1],
servergen=[{"id": 1, "serverGen": sg}],
queries={1:{"where":"FID=1981"}},
# return_ids_only=True,
return_inserts=True,
return_updates=True,
data_format="json"
)
print(req)
# {'layerServerGens':
#[{'id': 1, 'serverGen': 914376}], 'transportType': 'esriTransportTypeUrl', 'responseType': 'esriDataChangesResponseTypeEdits',
#'edits':[{'id': 1, 'features':
#{'adds': [{
#'geometry': {'paths': [[[-73.6592894210589, 45.505982917298], [-73.6583249229399, 45.5044803958229], [-73.6594751091767, 45.5029865662784], [-73.6604843118765, 45.5044454814924]]]},
#'attributes': {'FID': 1981, 'GlobalID': 'E096B38F-B18E-4322-BB4D-DBA25EE65BA0', 'id': 99999, 'terrain': '1', 'niveau_ms': 1, 'source': 'abc', 'CreationDate': 1670533735636, 'Creator': 'ME', 'EditDate': 1670601353246, 'Editor': 'ME', 'notes': 'updated feature', 'bb': 0}
#}],
#'updates': [],
#'deleteIds': []
#}}]}