Example Create a Model Based on Model Type

You can use the POST method to create a model based on a model type. Use the model noun and the model type ID for the model type that you want to create. You can deploy this basic method to create pingable models, user models, maintenance schedules, containers, and any other type of model that you can create using sp web services.
casp1031
You can use the POST method to create a model based on a model type. Use the model noun and the model type ID for the model type that you want to create. You can deploy this basic method to create pingable models, user models, maintenance schedules, containers, and any other type of model that you can create using
CA Spectrum
web services.
The basic format to use is shown in the following URL. Variables are indicated with
italics
:
http:
//hostname
:
portnumber
/spectrum/restful/model[?mtypeid=
modeltype_of_a_device
][&parentmh=
model_handle
][&relationid=
rel_handle
][&attr=
attr_id
&val=<num>]
Example
Use any REST client to post the following URL:
http://
host IP address
:
portnumber
/spectrum/restful/model
?mtypeid=0x00010290&parentmh=0x40000005&attr=0x12d7f&val=10.13.12.111
In this example, we supplied the following parameters:
  • val
    The IP address of a pingable device (in this example, 10.13.12.111).
  • mtypeid
    The model type of a device that you are modeling. In this example, it is a pingable device, 0x00010290. To find the model type ID for the model type that you want to create, use the Search feature in the Model Type Editor.
  • parentmh
    The model_handle for a universe.
  • relationid
    (Optional) The relation ID to identify an association between two models in the model domain (a relation).
  • attr
    The attribute ID of ipaddress. The value is the device IP address.