ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

Create a Restful API search to collect all models contained within a Global Collection


Article ID: 209503


Updated On:


CA Spectrum


We are looking for search on CollectionsModelNameString to collect models contained within a specific GC Name via RestAPI


Spectrum 10.3 and up


You will need to use a REST client that has the ability to send a POST as


http://<OC Host name>:<port>/spectrum/restful/models


The Restful XML Body suggestion is below:


<?xml version="1.0" encoding="UTF-8"?>

<rs:model-request throttlesize="5"



  xsi:schemaLocation=" ../../../xsd/Request.xsd">



        <rs:search-criteria xmlns="">






        <model-type>0x10474</model-type>  <!-- GC mtype -->



         <attribute id="AttributeID.MODEL_NAME">

           <value>Fault</value> <!-- ModelName -->





     <relation>0x1003a</relation> <!-- 0x1003a DynamicGlobalCollects relation-->

                                  <!-- 0x1003b StaticGlobalCollects relation-->







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



You can replace the GC name.


This search query will satisfy your requirement by replacing the GC name.


This query looks for all models under specified GC with either StaticGlobalCollects or DynamicGlobalCollects child relation.



You can also use this CURL command: 


url --user spectrum:spectrum http://model/0x700154d?side=leftum/restful/associations/relation/0x0001003a/

This is the curl command you can use to get the list of models associated with a Global Collection. The parameter after the model is the model handle of the Global Collection. The parameter after relation is the DynamicGlobalCollects relation handle and the side is the side the global collection is on in the association. In this case the left side.

The output looks like the following:

<association-response-list xmlns="">
<association rh="0x1003a" leftmh="0x700154d" rightmh="0x700007d"/>
<association rh="0x1003a" leftmh="0x700154d" rightmh="0x70010bd"/>
<association rh="0x1003a" leftmh="0x700154d" rightmh="0x7000762"/>
<association rh="0x1003a" leftmh="0x700154d" rightmh="0x7001515"/>

Additional Information

Some users have difficulties with the CURL command.  Please ensure that it is all on 1 line e.g.

curl -u user:password -H "Content-Type: application/xml" -X POST -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rs:model-request throttlesize=\"5\" xmlns:rs=\"\" xmlns:xsi=\"\" xsi:schemaLocation=\" ../../../xsd/Request.xsd\"><rs:target-models><rs:models-search><rs:search-criteria xmlns=\"\"><child-models><filtered-models><and><equals><model-type>0x10474</model-type></equals><equals><attribute id=\"AttributeID.MODEL_NAME\"><value>GC_NAME</value></attribute></equals></and></filtered-models><relation>0x1003a</relation></child-models></rs:search-criteria></rs:models-search></rs:target-models><rs:requested-attribute id=\"0x1006e\" /></rs:model-request>" http://OC_SERVER:PORT/spectrum/restful/models