Rest API call to update attributes on multiple models at once.
search cancel

Rest API call to update attributes on multiple models at once.

book

Article ID: 401184

calendar_today

Updated On:

Products

Network Observability Spectrum

Issue/Introduction

You want to update the same attribute on multiple models with the same value in one single call. 

Resolution

  1. To add "SAMPLE TEXT" to the e.g. USER ASSET TAG attribute on multiple models in one REST call

    use a PUT call to

    https://<OC host>:<oc port>/spectrum/restful/models

    with the following xml body

    <?xml version="1.0" encoding="UTF-8"?>
    <rs:update-models-request throttlesize="0"
      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:model mh="<model_handle of device 1>" />
          <rs:model mh="<model_handle of device 2>" />
          <rs:model mh="<model_handle of device 3>" />
          <rs:model mh="<model_handle of device 4>" />
      <rs:model mh="<model_handle of device 5>" />
          <rs:model mh="<model_handle of device 6>" />
        </rs:target-models>
       <rs:attribute-value id="0x12bfb">SAMPLE TEXT</rs:attribute-value> <!--USER ASSET TAG attribute -->
    </rs:update-models-request>
     
    This change can be instantly verified from the Oneclick GUI.
     
    Do not use quotation marks with the SAMPLE TEXT that you want to change or they will added to the attribute value.
     
  2. If you wish to clear the value of an attribute, send an empty value as follows:

   <rs:attribute-value id="0x12bfb"></rs:attribute-value> <!--USER ASSET TAG attribute -->

Additional Information

Please be aware that making many updates to a large a large number of models simultaneously can cause performance issues.  This will be different in each environment based on load and resources on the servers.  e.g. if you are updating 10 attributes on thousands of models, please consider breaking this into multiple smaller requests.

REST query to pull all models based on an specific attribute value.