AssetExplorer

    Get CI Details using criteria



    To get (obtain) details of a CI using criteria use the following URL format:

    http://<hostname>:<port>/api/cmdb/ci/


    Assuming you want to read details of a CI - using some form of criteria - associated with 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 "read"  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.


    Sample Input XML using various conditions:

    1. Get CI Details using conditions with relational operator (OR)

    2. Get CI Details using date criteria

     

    Fetching CI Details using conditions with relational operator (OR)

     

    <API version="1.0" locale="en">
            <criterias>
                <criteria>
                    <parameter>
                        <name compOperator="START WITH">CI Type</name>
                        <!-- Can give Non english values in the parameter names as well as in the data-->
                        <value>Windows Workstation</value>
                    </parameter>
                    <reloperator>OR</reloperator>
                    <parameter>
                        <name compOperator="CONTAINS">CI Name</name>
                        <value>sdp</value>
                    </parameter>
                </criteria>
            </criterias>
            <returnFields>
                <name>CI Name</name>
                <name>CI Type</name>
                <name>Business Impact</name>
                <name>Site</name>
                <name>Description</name>
            </returnFields>
            <sortparameters sortOrder="desc">
                <name>CI Name</name>
                <name>Site</name>            
            </sortparameters>
            <!-- If the total number pages is 100, we can give the navigation from 50 to 50 -->
            <range>
                <startindex>1</startindex>
                <limit>50</limit>
            </range>
    </API>

     



    Fetching CI Details using conditions with relational operator (OR)

     

    <?xml version="1.0" encoding="UTF-8"?>
    <API version="1.0">   
            <citype>
                <name>Workstation</name>
                <criterias>
                    <criteria>
                        <parameter>
                            <name compOperator="IS">Acquisition Date</name>
                            <value>2011-12-30</value>
                        </parameter>
                    </criteria>
                </criterias>
                <returnFields>
                    <!-- Syntax to return all available column(s). <name>*</name> -->
                    <name>CI Name</name>
                    <name>CI Type</name>
                    <name>Owned By</name>
                    <name>Site</name>
                    <name>Description</name>
                    <name>Acquisition Date</name>
                    <name>Warranty Expiry Date</name>
                    <name>Expiry Date</name>
                    <name>Asset Tag</name>
                    <name>Serial Number</name>
                    <name>Barcode</name>
                    <name>Product Name</name>
                    <name>Resource State</name>
                    <name>Vendor</name>
                    <name>Location</name>
                    <name>Mac Address</name>
                    <name>WS UDF Date</name>
                    <name>WS UDF Num</name>
                    <name>WS UDF Multi</name>
                    <name>WS UDF String</name>
                    <name>Sites</name>
                </returnFields>
                <sortFields sortOrder="desc">
                    <name>Product Name</name>
                </sortFields>
            </citype>    
    </API>

     

    Sample XML Response (truncated)

     

    <?xml version="1.0" encoding="UTF-8"?>
    <API locale="en" version="1.0">
        <response>

                <range>
                    <startindex>40</startindex>
                    <limit>50</limit>
                </range>
                <result>
                    <statuscode>200</statuscode>
                    <status>Success</status>
                    <message>Successfully fetched.</message>
                    <created-date>May 10, 2013 12:52 PM</created-date>
                    <field-names>
                        <name type="String">CI Name</name>
                        <name type="String">CI Type</name>
                        <name type="String">Site</name>
                        <name type="String">Description</name>
                    </field-names>
                    <field-values totalRecords="14">
                        <record>
                            <value>21 (hp2650.csez.zohocorpin.com)</value>
                            <value>Switch Ports</value>
                            <value>(null)</value>
                            <value>Created while scanning..</value>
                        </record>
                        <!-- 
                        Truncated 
                            .
                            .
                            .
                        -->
                        <record>
                            <value>10 (hp2650.csez.zohocorpin.com)</value>
                            <value>Switch Ports</value>
                            <value>(null)</value>
                            <value>Created while scanning..</value>
                        </record>
                        <record>
                            <value>1 (hp2650.csez.zohocorpin.com)</value>
                            <value>Switch Ports</value>
                            <value>(null)</value>
                            <value>Created while scanning..</value>
                        </record>
                    </field-values>
                </result>
            
        </response>
    </API>

     

    Sample JSON Response

     

    {"API":{"locale":"en","response":{"":{"result":{"created-date":"May 10, 2013 12:55 PM","field-names":{"name":[{"type":"String","content":"CI Name"},{"type":"String","content":"CI Type"},{"type":"String","content":"Site"},{"type":"String","content":"Description"}]},"message":"Successfully fetched.","field-values":{"record":[{"value":["21 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["20 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["2 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["19 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["18 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["17 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["16 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["15 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["14 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["13 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["12 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["11 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["10 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]},{"value":["1 (hp2650.csez.zohocorpin.com)","Switch Ports","(null)","Created while scanning.."]}],"totalRecords":"14"},"status":"Success","statuscode":"200"},"range":{"limit":"50","startindex":"40"},"name":"read"}},"version":"1.0"}}

     

     

    Zoho Corp. All rights reserved.