AssetExplorer

    Delete CI using criteria



    To delete CI using a filter use the following URL format:

    http://<servername>:<portnumber>/api/cmdb/ci


    Assuming you are deleting a CI in the local server with port number 8080, the URL should be given as::

    http://localhost:8080/api/cmdb/ci


    Keypoints:

    1. Input is an XML string sent as "POST attribute" with key "INPUT_DATA".

    2. The operation name "delete"  should be sent as a "POST attribute" with key "OPERATION_NAME".

    3. The technician key should be sent as a "POST attribute" with key "TECHNICIAN_KEY".

     

    Note:  

    • Parameter Result Format - Optional. specifies the return format ( XML or JSON )

    • If no result format specified then API will return output in JSON format.

     

    Mandatory Parameters:  

    • All CIs can be deleted using this API; to delete unique records, use the tag <CI Type> to specify the CI Type.

    • CI Name1 - Mandatory. CI Name can be case insensitive.

    • Only CIs and CI Relationships can be deleted.

    • CI Type tag is optional.


    Sample Input XML

    <?xml version="1.0" encoding="UTF-8"?>
    <API version="1.0">
            <citype>
                <name>Switch Ports</name>
                <criterias>
                    <criteria>
                       <parameter>  <name compOperator="CONTAINS">CI Name</name><value>1 (hp2650.csez.zohocorpin.com)</value></parameter>
                    </criteria>
                </criterias>
            </citype>    
    </API>

     

    Sample XML to delete a workstation CI using CI Type


    <?xml version="1.0" encoding="UTF-8"?>
    <API locale="en" version="1.0">
    <response>
    <result>
                <statuscode>200</statuscode>
                <status>Success</status>
                <message>Relationship added successfully.</message>
                <created-date>Mon Jul 05 18:18:39 GMT+05:30 2010</created-date>
    </result>
    </response>
    </API>


    Sample Response: Success

    <?xml version="1.0" encoding="UTF-8"?>
    <API version="1.0">
            <response>
                <result>
                           <statuscode>200</statuscode>
                           <status>Success</status>
                           <message>Deleted successfully.</message>
                           <created-date>May 10, 2013 03:31 PM</created-date>
                           <records deleted="5">                       
                                <ci id="6919">1 (hp2650.csez.zohocorpin.com)</ci>
                                <ci id="6929">11 (hp2650.csez.zohocorpin.com)</ci>
                                <ci id="6939">21 (hp2650.csez.zohocorpin.com)</ci>
                                <ci id="6939">31 (hp2650.csez.zohocorpin.com)</ci>
                                <ci id="6939">41 (hp2650.csez.zohocorpin.com)</ci>
                           </records>

                <result>                   
            <response>

    <API version="1.0">

     


    Sample Response: Failure



    <?xml version="1.0" encoding="UTF-8"?>
    <API locale="en" version="1.0">
    <response>
    <result>
                <statuscode>3018</statuscode>
                <status>No row matched to delete</status>
                <message>No row matched to delete</message>
    </result>
    </response>
    </API>



    JSON Response for deleting Printer CIs

    {
        "API": {
            "response": {
                "result": {
                    "created-date": "May 10, 2013 03:41 PM",
                    "records": {
                        "deleted": "6",
                        "ci": [
                            {
                                "content": "192.168.11.2",
                                "id": "1224"
                            },
                            {
                                "content": "192.168.11.23",
                                "id": "1220"
                            },
                            {
                                "content": "192.168.11.24",
                                "id": "1221"
                            },
                            {
                                "content": "192.168.11.25",
                                "id": "1222"
                            },
                            {
                                "content": "192.168.11.26",
                                "id": "1223"
                            },
                            {
                                "content": "192.168.11.29",
                                "id": "2401"
                            }
                        ]
                    },
                    "message": "Deleted successfully.",
                    "status": "Success",
                    "statuscode": "200"
                },
                "name": "delete"
            }
        },
        "version": "1.0"
    }

     

     

    Copyright © 2017, ZOHO Corp. All Rights Reserved.