The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
This chapter describes the Device Management API.
In your IoT FND NB API client application, use this IoT FND server URL to access the Device API WSDL:
http://<server_address> /nbapi/device?wsdl
The IoT FND distribution provides a Device Management API client (device-client script) in the cgms-tools-version .x86_64.rpm package. The client is wrapped by a shell script (/opt/cgms-tools/bin/device-client) to directly communicate with the IoT FND API.
[root@localhost bin]# ./device-client usage: ./bin/device-client add <endpoint URL> <filename> ./bin/device-client remove <endpoint URL> <filename> ./bin/device-client set <endpoint URL> <filename> <status> ./bin/device-client update <endpoint URL> <filename> ./bin/device-client export <endpoint URL> <query> ./bin/device-client job <endpoint URL> <job id>
The following table lists device-client script commands:
Command |
Description |
---|---|
add |
Calls the addDevices API. |
remove |
Calls the removeDevices API. |
set |
Calls the setDevices API to change status. |
update |
Calls the updateDevices API to change device properties. |
export |
Calls the exportDevices API. |
job |
Calls the getJob API to get the status of the job for one of the commands above. |
Except for export and job, all other commands return a job ID used to query the job execution status.
This call lets the client add the devices specified in a CSV file to a managed device list in the IoT FND database. It is an asynchronous call that returns a job ID used to query the status of the add device job using the getJob call (see getJob).
<dev:addDevices > <file > <data >eid:564620131674</data> <filename >H:\SGBU\csv_loading\test_for_device_api_2.csv</filename> <username >root</username> </file> </dev:addDevices>
The following table describes the parameters in the interface.
Parameter |
Options |
Description |
---|---|---|
file |
data filename username |
A structure describing the CSV file to import. This file contains the list and details of devices to add. The data type is base 64 binary. This example CSV file specifies new values for the mapLevel, latitude, and longitude properties of the specified devices: eid,mapLevel,lat,lng CA06001400100,2,-22.229488,37.860659 CA06001400100-0,15,-22.22887230524572,37.85273990917842 CA06001400100-1,15,-22.21759741145942,37.85962556788922 |
The following table describes the parameters in the response.
Parameter |
Type |
Description |
---|---|---|
jobId |
int |
Use the job ID to get more information about the status of this call. For more information, see getJob. |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dev="http://devicemgmt.nbapi.cgms.cisco.com/"> <soapenv:Header/> <soapenv:Body> <dev:addDevices> <!--Optional:--> <file> <!--Optional:--> <data>eid:564620131674</data> <!--Optional:--> <filename>H:\SGBU\csv_loading\test_for_device_api_2.csv</filename> <!--Optional:--> <username>root</username> </file> </dev:addDevices> </soapenv:Body> </soapenv:Envelope>
This call lets the client remove the devices specified in a CSV file from a managed devices list stored in the IoT FND database. It is an asynchronous call that returns a job ID used to query the status of this job using the getJob call (see getJob).
<dev:removeDevices > <file > <data >eid:136162421901</data> <filename >h:\SGBU|csv_loading\remove_device_Notepad_format.csv</filename> < username >root</username> </file> </dev:removeDevices>
The following table describes the parameters in the interface.
Parameter |
Options |
Description |
---|---|---|
file |
data filename username |
A structure describing the CSV file to import. This file contains the list of devices to remove. The data type is base 64 binary. This example CSV file specifies new values for the mapLevel, latitude, and longitude properties of the specified devices: eid,mapLevel,lat,lng CA06001400100,2,-22.229488,37.860659 CA06001400100-0,15,-22.22887230524572,37.85273990917842 CA06001400100-1,15,-22.21759741145942,37.85962556788922 |
The following table describes the parameters in the response.
Parameter |
Type |
Description |
---|---|---|
jobId |
int |
The job ID used to get more information about the status of this call. For more information, see getJob. |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dev="http://devicemgmt.nbapi.cgms.cisco.com/"> <soapenv:Header/> <soapenv:Body> <dev:removeDevices> <!--Optional:--> <file> <!--Optional:--> <data>eid:136162421901</data> <!--Optional:--> <filename>h:\SGBU|csv_loading\remove_device_Notepad_format.csv</filename> <!--Optional:--> <username>root</username> </file> </dev:removeDevices> </soapenv:Body> </soapenv:Envelope>
This call sets the properties of the specified devices as defined in a CSV file.
The following table describes the parameters in the interface.
Parameter |
Options |
Description |
---|---|---|
file |
data filename username |
A structure describing the CSV file to import. This file contains the list of devices and corresponding properties to set. The data type is base 64 binary. This example CSV file specifies new values for the mapLevel, latitude, and longitude properties of the specified devices: eid,mapLevel,lat,lng CA06001400100,2,-22.229488,37.860659 CA06001400100-0,15,-22.22887230524572,37.85273990917842 CA06001400100-1,15,-22.21759741145942,37.85962556788922 |
The following table describes the parameters in the response.
Parameter |
Type |
Description |
---|---|---|
jobId |
int |
The job ID used to get more information about the status of this call. For more information, see getJob. |
This call updates the properties of the specified devices with new values provided in CSV file.
<dev:updateDevices > <file > <data >eid:568127286335</data> <filename >?</filename> <username >?</username> </file> </dev:updateDevices>
The following table describes the parameters in the interface.
Parameter |
Type |
Description |
---|---|---|
file |
data filename username |
This structure describes the CSV file to import. This file contains the list of devices and corresponding properties to update. The data type is base 64 binary. This example CSV file specifies new values for the mapLevel, latitude, and longitude properties of the specified devices: eid,mapLevel,lat,lng CA06001400100,2,-22.229488,37.860659CA06001400100-0,15,-22.22887230524572,37.85273990917842CA06001400100-1,15,-22.21759741145942,37.85962556788922CA06001400100-10,15,-22.21672330007085,37.85933754140877CA06001400100-100,15,-22.22737656792707,37.866319080937444CA06001400100-1000,15,-22.23107565852129,37.86334942264521CA06001400100-1001,15,-22.2344480993644,37.86209437189405 |
The following table describes the parameters in the response.
Parameter |
Type |
Description |
---|---|---|
jobId |
int |
The job ID used to get more information about the status of this call. For more information, see getJob. |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dev="http://devicemgmt.nbapi.cgms.cisco.com/"> <soapenv:Header/> <soapenv:Body> <dev:updateDevices> <!--Optional:--> <file> <!--Optional:--> <data>eid:568127286335</data> <!--Optional:--> <filename>?</filename> <!--Optional:--> <username>?</username> </file> </dev:updateDevices> </soapenv:Body> </soapenv:Envelope>
This call returns a list of devices found by the query. This is an asynchronous call. Unlike other device management APIs, this call is blocking until all results are consumed by the caller.
<dev:exportDevices > <username >root</username> <query >cgr1000</query> </dev:exportDevices>
The following table describes the parameters in the interface.
Parameter |
Type |
Description |
---|---|---|
username |
string |
IoT FND username used as part of the job creation. |
query |
string |
The query that determines the criteria of the devices to export. |
The following table describes the parameters in the response.
Parameter |
Type |
Description |
---|---|---|
data |
base64Binary |
The job ID used to get more information about the status of this call. For more information, see getJob. |
date |
dateTime |
The date of the query (UTC time). |
query |
string |
The query used to find the devices to export. |
status |
string |
Status of the job. |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dev="http://devicemgmt.nbapi.cgms.cisco.com/"> <soapenv:Header/> <soapenv:Body> <dev:exportDevices> <!--Optional:--> <username>root</username> <!--Optional:--> <query>cgr1000</query> </dev:exportDevices> </soapenv:Body> </soapenv:Envelope>
This call returns a job report describing the detailed execution status of the specified job.
<dev:getJob > <jobId >110</jobId> </dev:getJob>
The following table describes the parameters in the interface.
Parameter |
Type |
Description |
---|---|---|
jobId |
int |
The job ID to return information about. |
The following table describes the parameters in the response.
Parameter |
Type |
Description |
---|---|---|
id |
integer |
Job ID. |
username |
string |
The username of the job submitter. |
filename |
string |
The filename of the job. |
type |
string |
The job type. |
totalCount |
integer |
Total count includes successes and failures. |
successCount |
integer |
Success count represents the number of devices successfully updated. |
failureCount |
integer |
Failure count summarizes the number of devices not successfully updated. |
status |
string |
The job execution status. |
submittedAt |
date |
The job submission date (UTC time). |
updatedAt |
date |
The job updating date (UTC time). |
logs |
string |
The logged messages of the job execution. |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dev="http://devicemgmt.nbapi.cgms.cisco.com/"> <soapenv:Header/> <soapenv:Body> <dev:getJob> <jobId>110</jobId> </dev:getJob> </soapenv:Body> </soapenv:Envelope>