Request for means to delete an item/field from a document via JSON in a PATCH request.
The current workaround below is quite convoluted so we'd like for a better approach:
A. For example, test document has "value1" field on the Form with the following formula: @Text(@Created)
B. Create a new Form just for REST client's APIs compute against for this specific purpose.
The Form, for this specific example, would make the Value1 to be an editable field with no formulas of any kind. Let's call this Form 'Test1' while the original Form (document) is called 'Test'.
You'd have ValidateFields only on the new 'Test1' form:
FIELD value1 := @If(Value1=""; @DeleteField; Value1);
@Success
C. You'd execute 2 requests to achieve the results you're after:
1) PATCH http://mytest.com/test.nsf/api/data/documents/unid/6964E86DC3A14E6A852587790003FBE4?computewithform=true&form=test1
BODY: raw JSON
{
"value1":""
}
Note the form=test1 param in the URL. Follow the above request with,
2) PATCH http://mytest.com/test.nsf/api/data/documents/unid/6964E86DC3A14E6A852587790003FBE4?form=test
BODY: raw JSON
{
}
Note the form is being reset to "test" via URL params since the first request had set it to 'test1'