Rest API query to update hostname
search cancel

Rest API query to update hostname

book

Article ID: 140033

calendar_today

Updated On:

Products

CA Infrastructure Management CA Performance Management - Usage and Administration

Issue/Introduction

 I am trying to update their hostnames, using REST API, as "[sysname]_[IP Address]".

 

Environment

Release : 3.6

Component : IM Reporting / Admin / Configuration

Resolution

1. Go to <DA_SYSTEM>:8581/rest/devices and get the ID of the device. You could also get the ID from the monitored devices page on the DA.  

 

Example line in REST:
 <ID>6626</ID>


2. Then in a rest client to update the hostname do a PUT to: 


http://<DA_HOSTNAME>:8581/rest/devices/<ID_FROM_STEP_1>

 

Example: 

http://<DA_SYSTEM>:8581/rest/devices/6626
 

Of this body:

<Device version="1.0.0">
    <Item version="1.0.0">
        <Name>NEW_NAME</Name>
    </Item>
</Device>

note: Type must be application/xml 

Additional Information

Via curl command:

curl --user admin --request PUT 'http://<DA_SYSTEM>:8581/rest/devices/6626' \
--header 'Content-Type: application/xml' \
--data '<Device version="1.0.0">
<Item version="1.0.0">
<Name>NEW_NAME</Name>
</Item>
</Device>'