Skip to main contentIBM Maximo REST API Guide

Delete resources

In the last section we talked about deleting child objects in an object structure resource. Any updating of the resources properties including adding, updating or deleting child objects is done under the update API for the resource. Deleting the resource (object structure root MBO) can be done by using the following sample API:

DELETE /oslc/os/<os name>/{rest id}

You get a response of 200 OK if the delete is successful. Starting 7608 you are able to do the same by using the following API:

POST /oslc/os/<os name>/{rest id}
x-method-override: PATCH
{
"_action":"Delete"
}

In certain cases, some browsers do not allow the http DELETE and this POST equivalent is a good alternative.

It is also important to consider the fact that in Maximo Asset Management deleting an MBO internally deletes the dependent child objects. The REST API invokes the delete routine on the MBO, and is not responsible for what the MBO does internally to delete the dependent child objects.

Additionally, there is an action API that can be used to determine if this MBO can be deleted. This is helpful in cases where you want to delete the resource in two steps, firstly to mark the resource for deletion and then to later delete the resource. To mark a resource for deletion, you need to verify if the resource can be deleted by using the MBO call back API nameed canDelete(). The following REST API exmple shows how to invoke canDelete():

GET /oslc/os/<os name>/{rest id}?action=system:candelete

A 200 OK response indicates that the resource can be deleted. This depends on the application MBO implementing the canDelete method, which is not implemented by default in the MBO framework. If deletion is not allowed, an JSON error would indicate the reason, which is determined by the application MBO.