yuuvis® RAD Q&A

+1 vote
by (2.1k points)
retagged by

Hello,

I am trying to delete all objects of a type, as described here: /rest-ws/#ENDPOINT:DmsBatchService.deleteObjects

This is what the documentation states about deleting child objects.
> deleteonlyemptyfolders true If set to false, even folders that still
> contain child objects, will be deleted or recycled. The deletion will
> be recursive and the child objects are also deleted.

This is my body:

{ "query": { "type" : "customer" }, "data": {
"harddelete":"true", "deleteonlyemptyfolders":"false" } }

This is the response I get (deleting the objects without childs worked just fine):

{
    "summary": {
        "operation": "DELETE",
        "successcount": 0,
        "failurecount": 7,
        "modifications": {
            "indexdata": 0,
            "delete": 0,
            "recycled": 0,
            "move": 0
        }
    },
    "success": [],
    "failure": [
        {
            "id": "552E26EB28234556886A14320B9DA68F",
            "error": {
                "status": "CONFLICT",
                "key": "DMS_DELETE_CONFLICT",
                "message": "The object can not be deleted, because it has conflicting child objects.",
                "callerhint": "Folder 552E26EB28234556886A14320B9DA68F with type customer is not empty.",
                "time": "2018-08-28T19:04:01.076Z"
            }
        },
        {
            "id": "497AA733A9304736AA840B7D80711671",
            "error": {
                "status": "CONFLICT",
                "key": "DMS_DELETE_CONFLICT",
                "message": "The object can not be deleted, because it has conflicting child objects.",
                "callerhint": "Folder 497AA733A9304736AA840B7D80711671 with type customer is not empty.",
                "time": "2018-08-28T19:04:01.082Z"
            }
        },
        {
            "id": "25BF3C5B8D0A457990CA53E5C3F17C75",
            "error": {
                "status": "CONFLICT",
                "key": "DMS_DELETE_CONFLICT",
                "message": "The object can not be deleted, because it has conflicting child objects.",
                "callerhint": "Folder 25BF3C5B8D0A457990CA53E5C3F17C75 with type customer is not empty.",
                "time": "2018-08-28T19:04:01.089Z"
            }
        },
        {
            "id": "D8EB7C35362B4D10BA146EA1C2C689A3",
            "error": {
                "status": "CONFLICT",
                "key": "DMS_DELETE_CONFLICT",
                "message": "The object can not be deleted, because it has conflicting child objects.",
                "callerhint": "Folder D8EB7C35362B4D10BA146EA1C2C689A3 with type customer is not empty.",
                "time": "2018-08-28T19:04:01.097Z"
            }
        },
        {
            "id": "7B9C18B6A60C4FE992123CE77F8D1705",
            "error": {
                "status": "CONFLICT",
                "key": "DMS_DELETE_CONFLICT",
                "message": "The object can not be deleted, because it has conflicting child objects.",
                "callerhint": "Folder 7B9C18B6A60C4FE992123CE77F8D1705 with type customer is not empty.",
                "time": "2018-08-28T19:04:01.106Z"
            }
        },
        {
            "id": "155C610B9A60485CA5FE51414B37828E",
            "error": {
                "status": "CONFLICT",
                "key": "DMS_DELETE_CONFLICT",
                "message": "The object can not be deleted, because it has conflicting child objects.",
                "callerhint": "Folder 155C610B9A60485CA5FE51414B37828E with type customer is not empty.",
                "time": "2018-08-28T19:04:01.116Z"
            }
        },
        {
            "id": "3B227CF4B1EF4C738A27AB0189F0AA8E",
            "error": {
                "status": "CONFLICT",
                "key": "DMS_DELETE_CONFLICT",
                "message": "The object can not be deleted, because it has conflicting child objects.",
                "callerhint": "Folder 3B227CF4B1EF4C738A27AB0189F0AA8E with type customer is not empty.",
                "time": "2018-08-28T19:04:01.122Z"
            }
        }
    ],
    "warnings": []
}

How do I set the deleteonlyemptyfolders parameter properly in my json body?
I've tried to orientate myself at the examples in the create and update documentation.

Thanks

1 Answer

+2 votes
by (2.0k points)
edited by
 
Best answer

Hi,

change "data" to "options". That should do the trick.

So the json body should look like this:

{ 
  "query": { "type" : "customer" }, 
  "options": {"harddelete":true, "deleteonlyemptyfolders":false }
}

Sincerely,
Yannick

by (2.1k points)
Worked great thanks!

Just a note, so other users have the full solution: I needed to remove the quotes around the boolean values for it to work aswell.
by (2.0k points)
Ah yes, thanks for that. I neglected to check the rest of the json.
I edited my answer accordingly to not confuse other users with the same question.
by (2.1k points)
I have another question regarding this.

What happens when I send the request with  "query": { "type" : "sysroot" }? Do I destroy my system, or do I delete all objects?
by (3.3k points)
edited by
Deleting of sysroot is prevented. This should not be possible. But even if sysroot is removed in some way in the system, it is recreated during the next dms-service restart.

Related questions

...