CA Service Management

Expand all | Collapse all

CMDBf query find by name

  • 1.  CMDBf query find by name

    Posted Feb 06, 2017 08:44 AM

    Hi,

     

    I need build query to find a IC by name,  how to do this?

    I am using the ..../axis/services/QueryPort

     

    I found example to list all ICs but I didnt found other examples.

     

    Regards.

     

    Matheus Isquierdo



  • 2.  Re: CMDBf query find by name

    Posted Feb 07, 2017 05:49 PM

    Hi Matheus,

     

    I would recommend a SOAP web services call to perform this action.  You can find the documentation on SOAP here: Web Services Management - CA Service Management - 14.1 - CA Technologies Documentation, and I would specifically recommend using the doSelect() method with a WHERE clause to specify exactly which Configuration Items you would like.  

     

    If this is not what you are trying to accomplish, please let me know and I will try to provide a better answer.

     

    Regards,

     

    Marty



  • 3.  Re: CMDBf query find by name

    Posted Feb 08, 2017 10:32 AM

    Hi Marty.Malecki,

     

    I know this service, and to perform doSelect it is necessary to specify objectType. What object type related to IC?

     

    Regards

     

    Matheus



  • 4.  Re: CMDBf query find by name
    Best Answer

    Posted Feb 08, 2017 11:48 AM

    Hi Matheus,

     

    Your SOAP request should look something like this:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk">
    <soapenv:Header/>
    <soapenv:Body>
    <ser:doSelect>
    <sid>123456789</sid>
    <objectType>nr</objectType>
    <whereClause>name='put the right name here'</whereClause>
    <maxRows>-1</maxRows>
    <attributes>
    <!--1 or more repetitions:-->

    </attributes>
    </ser:doSelect>
    </soapenv:Body>
    </soapenv:Envelope>

     

    As you can see, the object type is "nr" which refers to the Configuration Item object in Service Desk.  This is the raw SOAP request, so if you are writing a program to make this call, then that would look a little bit different, but the attributes (sid, objectType, whereClause, and maxRows) should be the same.

     

    Please let me know if you have any more questions!

     

    -Marty



  • 5.  Re: CMDBf query find by name

    Posted Feb 09, 2017 04:46 AM

    Marty.Malecki Thanks by the tips.

     

    I've found another way, I need to interact with my cmdb, getting the relationships, so I'm exploring the / axis / services / QueryPort.

    Below I have an example of how I searched for the IC by name through this service:

     

    Request:

     

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
    <sec:securityHeader sec:actor="http://schemas.xmlsoap.org/soap/actor/next" sec:mustUnderstand="0" xmlns:sec="http://schemas.xmlsoap.org/soap/envelope/">
    <sec:username>USERNAME</sec:username>
    <sec:password>PASSWORD</sec:password>
    </sec:securityHeader>
    </soapenv:Header>
    <soapenv:Body>
    <query xmlns="http://cmdbf.org/schema/1-0-0/datamodel">
    <itemTemplate id="TestIt">

    <recordConstraint>
    <recordType localName="[Type of IC]"/>
    <propertyValue localName="name">
    <!--Zero or more repetitions:-->
    <equal>HOSTNAME</equal>

    </propertyValue>

    </recordConstraint>


    </itemTemplate>
    </query>
    </soapenv:Body>
    </soapenv:Envelope>

     

    Regards

     

    Matheus Isquierdo



  • 6.  Re: CMDBf query find by name

    Posted Feb 09, 2017 07:40 AM

    Marty.Malecki,

     

    Can I get therelationships of an IC?

     

    Thanks



  • 7.  Re: CMDBf query find by name

    Posted Feb 09, 2017 09:41 AM

    Hi Matheus,

     

    It is possible, but I haven't created a query to do this before, and it will be more complicated than just looking for a CI.  Jon_Israel Alex_Perretti Do either of you know of any good way to get CI relationships via a web services call?

     

    -Marty



  • 8.  Re: CMDBf query find by name

    Posted Feb 09, 2017 10:32 AM

    Typically we only support doing this via GRLoader.  



  • 9.  Re: CMDBf query find by name

    Posted Feb 09, 2017 10:55 AM

    Hi Jon_Israel,

     

    Thanks for your anwser.

    I found this doc(CA CMDB Technical Reference Guide r12.6 ) but I did not find how to get the relationships of ICs



  • 10.  Re: CMDBf query find by name

    Posted Feb 09, 2017 11:19 AM

    Marty.Malecki Jon_Israel Alex_Perretti,

     

    Do any of you know this getLrelValue operation?
    It returns relationships of CIs?

     

    Regards

     

    Matheus Isquierdo



  • 11.  Re: CMDBf query find by name

    Posted Feb 10, 2017 02:05 AM

    Hi,

    Ci relations are not Lrel but Qrel against the bmhier object.

     

     

    May you just read those value you can do a doselect on this table with the necessary but don't update directly without knowing exactly what you do as you can breack up your CMDB here.

    The best way to update CI and/or their relation ship is (as John mention) to use GR loader to ensure that the CORA rules are applied and integrity of your CMDB keep safe.

    Hope this help.

    /J



  • 12.  Re: CMDBf query find by name

    Posted Feb 14, 2017 05:52 AM

    jmayer, Nice,

     

    I'd already found the kind of CI relationships (bmhier).

    I do not need to update my CMDB, only query to retrieve information needed to open calls.

     

    Example to get  CI relations:

    <sid>1385320598</sid>
    <objectType>bmhier</objectType>
    <whereClause>child = U'7B0A50242A6D4C49BD727CC70709338C'</whereClause>
    <maxRows>10</maxRows>
    <attributes>