search cancel

How to get a list of Global Collections and CAPCIPDomain models using the REST API.

book

Article ID: 238334

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction

I am not able to see the Global Collection that are tied to CAPC when using the CLI command.  Also is there not a rest command to get the same results?  Is there a way to list ID mapping so i know to use 0x10474 for global collection:

[[email protected] vnmsh]$ ./show models |grep 0x10474
0x1002d5b   APAC                              0x10474     GlobalCollection
0x1000ddb   Arista DeviceView                 0x10474     GlobalCollection

Environment

Release : 21.2

Component : Spectrum OneClick

Resolution

Here's a curl command that will get you the model name and model type name of all of the global collections and CAPCIPDomain models. You can add requested attribute at the bottom of the XML 

curl -u spectrum:spectrum -X 'POST' \
  'http://lvndev014836.bpc.broadcom.net:8080/spectrum/restful/models' \
  -H 'accept: application/xml; charset=UTF-8' \
  -H 'Content-Type: application/xml; charset=UTF-8' \
  -d '<?xml version="1.0" encoding="UTF-8"?>
<!--


   CA Technologies, Inc.
   One CA Plaza
   Islandia, NY 11749 USA

   Copyright (c) 2012 CA Technologies, Inc.
   All rights reserved.

   IN NO EVENT SHALL CA TECHNOLOGIES INCORPORATED BE LIABLE FOR
   ANY INCIDENTAL, INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES
   WHATSOEVER (INCLUDING BUT NOT LIMITED TO LOST PROFITS) ARISING OUT
   OF OR RELATED TO THIS SOFTWARE, EVEN IF CA TECHNOLOGIES INCORPORATED
   HAS BEEN ADVISED OF, KNOWN, OR SHOULD HAVE KNOWN, THE POSSIBILITY OF
   SUCH DAMAGES.


-->

<rs:model-request throttlesize="5"
  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>
           <or>
            <equals>
              <attribute id="AttributeID.MTYPE_HANDLE">
                <value>0x10474</value> <!-- Global Collection-->
              </attribute>
            </equals>
            <equals>
              <attribute id="AttributeID.MTYPE_HANDLE">
              <value>0x5c40001</value> <!-- CAPC IP Domain -->
              </attribute>
            </equals>
           </or>
          </filtered-models>
        </rs:search-criteria>
      </rs:models-search>
    </rs:target-models>

    <rs:requested-attribute id="0x1006e" />
    <rs:requested-attribute id="0x10000" />


</rs:model-request>
'