DX NetOps

Expand all | Collapse all

How to get a list of all models via REST API?

Jump to Best Answer
  • 1.  How to get a list of all models via REST API?

    Posted 01-13-2017 11:27 AM

    I want to get a list of all models for each global collection, and the simplest way to do so I thought of up to now is to list all the models in Spectrum and show the attribute for the global collection name. I will then export this and work it in Excel. I'm using this xml but no data is shown:

     

    <rs:model-request throttlesize="500"
    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:requested-attribute id="0x1006e" /> <!-- Model Name -->
    <rs:requested-attribute id="0x12d7f" /> <!-- Network Address -->
    <rs:requested-attribute id="0x12adb" /> <!-- GC Name -->

    </rs:model-request>



  • 2.  Re: How to get a list of all models via REST API?
    Best Answer

    Posted 01-15-2017 07:10 PM

    I think it is simplier use a GET request instead a GET TUNNELING reguest.
    Take a look at this doc :

     

    https://docops.ca.com/ca-spectrum/10-2/en/programming/web-services-api-reference/how-to-use-the-ca-spectrum-web-services… 

     

    The request I would do is :

     

    http://<hostname><:portnumber>/spectrum/restful/devices?attr=0x1006e&attr=0x12d7f&attr=0x12adb

     


    And the XML is used on GET TUNNELING and it is usefull when you need to add filters to your query.



  • 3.  Re: How to get a list of all models via REST API?

    Posted 01-16-2017 07:57 AM

    You also may want to add

    &throttlesize=9000 

    to the request, if you have more than 1000 devices and don't want everything on one query.

     

    *Change 9000 accordingly



  • 4.  Re: How to get a list of all models via REST API?

    Posted 01-17-2017 09:55 AM

    Yes, that's what I used finally! Thanks!