How to get the model handle of a device using the Spectrum REST API
search cancel

How to get the model handle of a device using the Spectrum REST API

book

Article ID: 249249

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction

We are running on spectrum 21.2.10. We are having some issues using Spectrum REST API to get the model handle of any one device. When we run the GET on below query, the output lists all the devices instead of just a single device which has the IP address of 10.10.10.10

https://spectrumurl.com/spectrum/restful/devices?attr=0x1006e&attr=0x12d7f&value=10.10.10.10

Environment

Release : 21.2

Component :

Resolution

You can use the following URL, HTTP Method and xml body to return a device model based on an IP address. 
 
http://ocserver:port/spectrum/restful/models
 
HTTP Method: POST
 
<?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">
          <devices-only-search/>   
          <filtered-models>
            <equals>
              <attribute id="0x12d7f">
                <value>10.10.10.10</value>
              </attribute>
            </equals>
          </filtered-models>
        </rs:search-criteria>
      </rs:models-search>
    </rs:target-models>

 

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

 

</rs:model-request>