I have a use case where a DATE field needs to be set to NULL under certain circumstances. This is currently not working when sending updates to a branch versioned feature service layer through the ApplyEdits endpoint. This is being performed in a python script sending a POST request to the endpoint.
This is the updates object, as displayed in a debug session:
The error I receive when sending this object:
But I am not able to set this value to NULL through Python, since Python uses None as the NULL keyword and will not recognize the value of NULL.
Any assistance on this issue will be greatly appreciated!
Solved! Go to Solution.
Are you converting to JSON before sending? What does the JSON representation of your updates object looks like? The REST endpoints only accept JSON and None is not valid in JSON, it needs to be null.
Thank you, this did the trick!
I just needed to use json.dumps(updates_object) to create the JSON representation, and this was successfully passed into the applyEdits endpoint.
The object I was sending was formatted as a JSON object, and most of the edit procedures using this formatting have been working, but as a general practice I'll convert all of my JSON-ish objects to actual JSON going forward, to avoid any issues like this.
Are you converting to JSON before sending? What does the JSON representation of your updates object looks like? The REST endpoints only accept JSON and None is not valid in JSON, it needs to be null.
Thank you, this did the trick!
I just needed to use json.dumps(updates_object) to create the JSON representation, and this was successfully passed into the applyEdits endpoint.
The object I was sending was formatted as a JSON object, and most of the edit procedures using this formatting have been working, but as a general practice I'll convert all of my JSON-ish objects to actual JSON going forward, to avoid any issues like this.