Deleting a Sublist

You can delete a sublist, that is, remove all the lines of a sublist, by replacing it with an empty sublist. To delete a sublist, you send a PATCH request with the replace query parameter. The following example shows how to delete a sublist.

The operation works both for keyed and non-keyed sublists. The sublist must be specified both in the request body and the query parameter.

If the sublist is mandatory, the operation fails.

Request Body

PATCH .../myrecord?replace=sublist

            {
    "sublist" : {
        "items" : []
    }
} 

          

Alternatively, you can delete a sublist by setting the value of the sublist to null.

PATCH .../myrecord?replace=sublist

            {
    "sublist" : null
} 

          

Response

Response: 204 No Content

Post State:

            {
    "body1": "replaced body text 1",
    "body2": "previous body text 2",
    "sublist" : {
        "items" : []
    },
    "unkeyedsublist" : {
        "items" : [
            { "col": "previously present line 1" },
            { "col": "previously present line 2" },
            { "col": "previously present line 0" },
        ]
    }
} 

          

Related Topics

Working with Sublists
Creating a Sublist
Updating a Sublist
Replacing a Sublist

General Notices