models

Contents
csp
Contents
Use the Models resource to retrieve and update models and attributes.
The models resource operates on groups of models. For a single model, use the model resource.
  • Base URL
    http://<hostname><:portnumber>/spectrum/restful/models
POST models (GET Tunneling)
Use POST models to get all model handles and requested attributes. POSTing a models request lets you provide an XML document that specifies the models to retrieve. The document contains a list of model handles, XML search criteria, or a reference to the existing search criteria on the OneClick server.
POST models is a form of GET Tunneling used to retrieve multiple models. You cannot create a model with POST models. To create a model, use POST model.
  • URL
    http://<hostname><:portnumber>/spectrum/restful/models
  • HTTP Method
    POST
  • Body
    Examples are provided in <
    $SPECROOT
    >/RestfulExamples/xml/Models. These XML files provide examples of properly formed XML for different purposes. Use these examples as a basis for your own XML:
    • GetCiscoRouterModels.xml
    • GetModelsByModelHandles.xml
    • GetModelsFromExistingSearch.xml
  • Body Content
    application/xml
  • Header
    application/xml, application/json
  • Output
    XML or JSON listing of models satisfying the request input in the
    SpectroSERVER
    or distributed
    SpectroSERVER
Example: Java CALL
The following is an example call:
Java GenericPoster noun=Models file=resources/xml/Models/GetCiscoRouterModels.xml server=localhost username=jdoe password=spectrum port=8080
Example: Request XML to find device models by IP address
The following is an example of how to find device models by IP address by embedding the correct locater search in the POST body of a models GET. This operation searches all landscapes in a distributed
SpectroSERVER
environment as well as allowing you to specify the attributes of interest.
URL
POST the following XML body to:
http://<hostname><:portnumber>/spectrum/restful/models
Body
<?xml version="1.0" encoding="UTF-8"?> <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">           <action-models>             <filtered-models>               <equals>                 <model-type>SearchManager</model-type>               </equals>             </filtered-models>             <action>FIND_DEV_MODELS_BY_IP</action>             <attribute id="AttributeID.NETWORK_ADDRESS">               <value>172.22.96.6</value>             </attribute>           </action-models>         </rs:search-criteria>            </rs:models-search>     </rs:target-models>     <rs:requested-attribute id="0x1006e" />     <rs:requested-attribute id="0x10000" />     <rs:requested-attribute id="0x10032" />     <rs:requested-attribute id="0x12de2" /> </rs:model-request>
GET models
GET models returns model handles and requested attributes. To retrieve specific model attributes, use the &attr=<
attr_id
> parameter.
GET models can be used only after a POST (GET Tunneling) models has been performed. POST models generates the result set, and GET models is used to retrieve model handles and attribute information for the items within that result set.
  • URL
    http://<hostname><:portnumber>/spectrum/restful/models?id=<result_set_pointer>[&attr=<attr_ID>][&landscape=<landscape_handle>][&throttlesize=<num>]
  • HTTP Method
    GET
  • Body
    None
  • Body Content
    Not used
  • Header
    application/xml, application/json
  • Output
    XML or JSON listing of models satisfying the request input in the
    SpectroSERVER
    or distributed
    SpectroSERVER
URL Parameters
  • ?id=<
    result_set_pointer
    >
    Specifies the location of the result set on the OneClick server. This value is generated by using POST (GET Tunneling) models and appears on the "next" relative link. The location expires on the OneClick server after ten minutes of inactivity.
  • &attr=<
    attr_ID
    >
    (Optional) Specifies the requested attributes. Multiple attribute parameters can be specified.
    There are many attributes on a model; for best performance you should limit attribute selection to attributes of interest. Not all models support the same set of attributes. Unsupported attributes will return ‘NoSuchAttribute’
  • &landscape=<
    landscape_handle
    >
    (Optional) Filters which landscapes are queried. Multiple landscape parameters can be specified.
  • &throttlesize=<
    num
    >
    (Optional) Specifies a throttle size.
PUT models
PUT models updates attributes across multiple models. The models can be selected by a variety of techniques including search criteria. Not all selected models need to support the attributes being modified.
  • URL
    http://<hostname><:portnumber>/spectrum/restful/models
  • HTTP Method
    PUT
  • Body
    Uses Request.xsd:update-models-request. The Request.xsd is located in <
    $SPECROOT
    >/RestfulExamples/src/xsd
  • Body Content
    application/xml, application
  • Header
    application/xml, application/json
  • Output
    XML or JSON listing of model-response indicating the success or failure of each update.