DX NetOps

 View Only
  • 1.  RestAPI XML question

    Posted Nov 22, 2018 07:06 AM

    Hello community,

     

    I have been using the Spectrum api on Spectrum 9.4 with this XML to find a container. We have upgraded to Spectrum 10.2.3 and now the same XML won't work. I get this error from powershell:

     

    Invoke-RestMethod : JAXBException occurred : cvc-complex-type.2.4.d: Invalid content was found starting with element 'and'. No child element is expected at this point.. 

     

    The issue is because I'm using two attributes. When I only search on one attribute it works fine. I have been looking at the xml schema definition but can't really make heads or tails from it. The schema on oneclick also hasn't changed after the upgrade, so I'm at a loss. Can someone help me?

     

    <?xml version="1.0" encoding="UTF-8"?>
    <rs:model-request
    xmlns:rs="http://www.ca.com/spectrum/restful/schema/request"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd ">
    <rs:target-models>
    <rs:models-search>
    <rs:search-criteria xmlns="http://www.ca.com/spectrum/restful/schema/filter">
    <filtered-models>
    <equals-ignore-case>
    <attribute id="0x10000">
    <value>Network</value>
    </attribute>
    <attribute id="0x1006e">
    <value>_Servers from UIM</value>
    </attribute>
    </equals-ignore-case>
    </filtered-models>
    </rs:search-criteria>
    </rs:models-search>
    </rs:target-models>
    </rs:model-request>



  • 2.  Re: RestAPI XML question
    Best Answer

    Broadcom Employee
    Posted Nov 29, 2018 10:08 AM

    Hi Marco,

     

    I was able to get this to work in 10.2.3 by changing the XML body to this:

     

     

    <rs:model-request
    xmlns:rs="http://www.ca.com/spectrum/restful/schema/request"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd ">
    <rs:target-models>
    <rs:models-search>
    <rs:search-criteria xmlns="http://www.ca.com/spectrum/restful/schema/filter">
    <filtered-models>
    <and>
    <equals>
    <attribute id="0x1006e">
    <value>_Servers from UIM</value>
    </attribute>
    </equals>
    <and>
    <equals>
    <attribute id="0x10000">
    <value>Network</value>
    </attribute>
    </equals>
    </and>
    </and>
    </filtered-models>
    </rs:search-criteria>
    </rs:models-search>
    </rs:target-models>
    </rs:model-request>

     

     

    Best regards,

    Glenn



  • 3.  Re: RestAPI XML question

    Posted Dec 03, 2018 11:06 AM

    Hi Glenn, Yes thank you! Works for me also.