Hello,
I'm a little stuck, I'm trying to create an internal interface for a web map so that non-gis users can set alerts for a specific area, mostly for wildfires. The main data is a hosted feature so have some code that does a query based on the objectid of the row. There are two date only fields that I can't get to reset to null, I've tried setting it to None and 'NULL' which are both converted to '' in the JSON. I can't find anything in the documentation about it either.
Saw this post: https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/unable-to-set-date-field-to-null-through/td-p/1194194, however they went from a python dictionary and converted the whole thing to JSON. I'm just copying the existing JSON and then inserting the value from a dataframe, how can I insert a JSON NULL as NULL instead of 'NULL'?
My update code:
def post_to_agol(rows_to_update, object_to_update, out_fields, query_field):
# Rows_to_update: dataframe with one row
# object_to_update: name of the object in the layer, have a couple other
# tables that I update too and use this function for that too
# out_fields: fields to get in the query, doesnt like fields with raw
# HTML in it so gotta kick those out
# query_field: ObjectID for one row and a group for another that will all
# then be given the same data.
object_id = rows_to_update['subdivision'][0]
where = "{} = '{}'".format(query_field, object_id)
agol_fields = list(out_fields.keys())
area = object_to_update.query(where=where, out_fields=agol_fields)
features_for_update = []
for subdivision in area:
feature_to_be_updated = deepcopy(subdivision)
for agol_field, sql_field in out_fields.items():
feature_to_be_updated.attributes[agol_field] = rows_to_update[sql_field].iloc[0]
features_for_update.append(feature_to_be_updated)
object_to_update.edit_features(updates=features_for_update) Error:
Exception at /alert/1
Cannot perform operation. Invalid operation parameters.
'updates' parameter is invalid
Invalid esriFieldTypeDateOnly value .
(Error Code: 400)