This article details instructions for two calls:
- api/objects/{swID}/attributes/{attributeName} (listing values of an object attribute, modifying an object attribute)
- api/objects/{swID}/attributes (modifying multiple (bulk) object attributes of an object)
Summary:
List values of an object attribute and modify an object attribute.
URL:
http(s)://{server hostname}/api/objects/{swID}/attributes/{attributeName}
Summary:
Modify multiple (bulk) object attributes of the object.
URL:
http(s)://{server hostname}/api/objects/{swID}/attributes
GET Method detail - objects/{swID}/attributes/{attributeName}
PUT Method detail - objects/{swID}/attributes/{attributeName}
PUT Method detail - objects/{swID}/attributes
Methods summary
objects/{swID}/attributes/{attributeName}
- GET Method - lists values of an attribute of the object.
- PUT Method - modifies an attribute of the object.
objects/{swID}/attributes
- PUT Method - modifies multiple (bulk) attributes of the object.
GET Method detail - objects/{swID}/attributes/{attributeName}
Lists the values of an attribute on this object.
Response:
The list of attributes, with entries according to the following format:
| Name | Description |
|---|---|
| name | value of “name” attribute of the device. |
| displayName | value of “displayName” attribute of the device. |
| userEditable | if the attribute can be modified by the user. |
| userOverriden | if the attribute is set to polled or user-defined value. |
| values | list of values for the attribute. |
Examples:
INPUT
curl -u admin:admin https://localhost/api/objects/611/attributes/typeName?media=json
OUTPUT
{
"name" : "typeName",
"displayName" : "typeName",
"userEditable" : false,
"userOverriden" : false,
"values" : [ "SwitchDevice" ]
}
INPUT
curl -u admin:admin https://localhost/api/objects/611/attributes/typeName?media=xml
OUTPUT
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<objectAttribute userOverriden="false" userEditable="false" displayName="typeName">
<name>typeName</name>
<value>SwitchDevice</value>
</objectAttribute>
PUT Method detail - objects/{swID}/attributes/{attributeName}
Modifies an attribute of the object.
Request:
An attribute definition:
| Name | Description |
|---|---|
| name | name of attribute to be changed. |
| userOverriden | if the attribute has user-supplied or polled value. The fields "userOverriden" and "values" are mutually exclusive, meaning that "values" are only permitted if the "userOverriden" is false. |
| values | list of values for the attribute. |
Response:
An updated attribute:
| Name | Description |
|---|---|
| name | value of “name” attribute of the device. |
| displayName | value of “displayName” attribute of the device. |
| userEditable | if the attribute can be modified by the user. |
| userOverriden | if the attribute is set to polled or user-defined value. |
| values | list of values for the attribute. |
Examples:
INPUT
curl -u admin:admin https://localhost/api/objects/611/attributes/TransferServer?media=json -X PUT -H "content-type:application/json" -d \
'{
"name" : "TransferServer",
"displayName" : "Configuration Transfer Server",
"userOverriden" : true,
"values" : [ "10.12.3.456" ]
}'
OUTPUT
{
"name" : "TransferServer",
"displayName" : "Configuration Transfer Server",
"userEditable" : true,
"userOverriden" : true,
"values" : [ "10.12.3.456" ]
}
INPUT
curl -u admin:admin https://localhost/api/objects/611/attributes/TransferServer?media=xml -X PUT -H "content-type:application/xml" -d \
'<objectAttribute userOverriden="true" userEditable="true" displayName="Configuration Transfer Server">
<name>TransferServer</name>
<value>10.12.3.456</value>
</objectAttribute>'
OUTPUT
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<objectAttribute userOverriden="true" userEditable="true" displayName="Configuration Transfer Server">
<name>TransferServer</name>
<value>10.12.3.456</value>
</objectAttribute>
PUT Method detail - objects/{swID}/attributes
Modifies multiple (bulk) attributes of the object with one request, in either JSON or XML format.
Request:
The request can contain a list of the object attribute names and their values to modify, in the format “name" : "value”.
Response:
200 OK, or an error message detailing the reason for the modification failure.
Examples:
INPUT
curl -u admin:admin -X PUT "http://localhost/api/objects/123/attributes" -H "content-type:application/json" -d \
'{
"agentId" : "007",
"sysDescr" : "MI5",
"descriptiveAlias" : "New Alias",
"guid" : "123"
}'
OUTPUT
{
"errorCode" : "USER_EDIT_SUCCESS",
"message" : "ok",
"successCount" : 1,
"failCount" : 0,
"serverId" : "fbd123e4-5678-9d10-b111-80e06be57162",
"objectsResponses" : [ {
"errorCode" : "USER_EDIT_SUCCESS",
"message" : "ok",
"objectId" : 714
}
INPUT
curl -u admin:admin -X PUT http://localhost/api/objects/714/attributes -H content-type:application/xml \ -d
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<devManufacturer>New Manufacturer</devManufacturer>
<devModel>New Model</devModel>
'
OUTPUT
"errorCode" : "USER_EDIT_SUCCESS",
"message" : "ok",
"successCount" : 1,
"failCount" : 0,
"serverId" : "fbd123e4-5678-9d10-b111-80e06be57162",
"objectsResponses" : [ {
"errorCode" : "USER_EDIT_SUCCESS",
"message" : "ok",
"objectId" : 714
Comments
0 comments
Please sign in to leave a comment.