Skip to content

Delete Items

Definition

POST /apis/v2/{SERVICE_ID}/{ITEMS_NAME}/delete

Description

Delete a list of items.

Details:

If there is an error with the deleting of an item, the other items will still be deleted.

Permissions

The user needs to have the permissions:

SERVICE_ID=read && SERVICE_ID=delete

To delete an item, the user needs to have selected the associated application profile, if not the item’s content mode should be set to EDIT.

Parameters

The body request parameter is a JSON array containing the list of identifiers of the items to delete.

Type Mandatory Description
JSON Array yes The list of identifiers

Example:

[
    {
        "appKey": "ondiflo",
        "name": "AuthTokenCall"
    },
    {
        "appKey": "",
        "name": "AWFCall"
    }
]

Response

HTTP code Reason
200 Success
400 Invalid parameter count or content
403 Unauthorized
404 Not found
500 Unexpected exception

When the query is successful, the HTTP response is a 200 OK and returns the multi-error object with no message and no errors:

{
    "processed" : 2,
    "errors" : {},
    "message" : ""
}

If the request parameter is null, the HTTP response is a 400 Invalid parameter:

{
    "status": 400,
    "code": 400,
    "message": "Unexpected error deleting the items!",
    "link": null,
    "developerMessage": "Invalid parameter count or content: the identifiers cannot be null.",
    "conflictInformation": null
}

If the user does not have the right permissions, it will return a non-empty multi-error object with the HTTP Response 403 Unauthorized:

{
    "processed": 2,
    "errors": {
        "ondiflo.AuthTokenCall": {
            "cause": null,
            "stackTrace": [
                {
                    "methodName": "checkEditPermission",
                    "fileName": "AbstractServiceResource.java",
                    "lineNumber": 703,
                    "className": "io.platform6.core.impl.servicecomponent.resources.AbstractServiceResource",
                    "nativeMethod": false
                },
                {
                    "methodName": "checkPermissions",
                    "fileName": "AbstractServiceResource.java",
                    "lineNumber": 720,
                    "className": "io.platform6.core.impl.servicecomponent.resources.AbstractServiceResource",
                    "nativeMethod": false
                }
            ],
            "status": 403,
            "code": 403,
            "link": null,
            "developerMessage": "Unauthorized: permission 'edit' is missing.",
            "conflictInformation": null,
            "message": "Unexpected error deleting the items! You need to have the permission 'edit'.",
            "localizedMessage": "Unexpected error deleting the items! You need to have the permission 'edit'.",
            "suppressed": []
        }
    },
    "message": "Unexpected error deleting the items!"
}

If the item is not found, it will return a non-empty multi-error object with the HTTP Response 404 Not found:

{
    "processed": 2,
    "errors": {
        "ondiflo.AuthTokenCall": {
            "cause": null,
            "stackTrace": [
                {
                    "methodName": "lambda$checkItemExistAndCanPerformAction$9",
                    "fileName": "AbstractServiceResource.java",
                    "lineNumber": 742,
                    "className": "io.platform6.core.impl.servicecomponent.resources.AbstractServiceResource",
                    "nativeMethod": false
                },
                {
                    "methodName": "run",
                    "fileName": "Thread.java",
                    "lineNumber": 748,
                    "className": "java.lang.Thread",
                    "nativeMethod": false
                }
            ],
            "status": 404,
            "code": 404,
            "link": null,
            "developerMessage": "Not found: the item 'ondiflo.AuthTokenCall' is not found.",
            "conflictInformation": null,
            "message": "Unexpected error deleting the items! Item ondiflo.AuthTokenCall is not found.",
            "localizedMessage": "Unexpected error deleting the items! Item ondiflo.AuthTokenCall is not found.",
            "suppressed": []
        }
    },
    "message": "Unexpected error deleting the items!"
}