Generate Property Inventory Report
Request
Body parameters
This request uses the same search criteria as the Search Objects request.
Response
Returns an Excel spreadsheet that contains property inventory report for objects that matched the search criteria.
Property inventory has the following structure:
Object | Created | property_1 | <...> |
property_N |
---|---|---|---|---|
<Object Name 1> |
|
value |
|
value |
<Object Name 2> |
|
value |
|
value |
The list of properties includes all properties from every matched object. If an object doesn’t have the property, the value cell would be empty.
Example
Request
As this request returns the XLSX file, you should output it directly to the output file to avoid corrupting it.
-
Bash
-
JavaScript
-
NodeJS
-
Python
login=<...>
password=<...>
saymon_hostname=<...>
url=https://$saymon_hostname/node/api/reports/prop-inventory/excel
curl -X POST $url +
-H "Content-Type: application/json" +
-o report.xlsx +
-d @- <<EOF
{
"name": {
"$regex": "{caret}CPU$",
"$options": "i"
},
"class_id": 4,
"parent_id": "62d7e58056d203149a08001b"
}
EOF
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/reports/prop-inventory/excel";
let headers = new Headers();
headers.append("Content-Type", "application/json");
let data = JSON.stringify({
"name": {
"$regex": "^CPU$",
"$options": "i"
},
"class_id": 4,
"parent_id": "62d7e58056d203149a08001b"
});
let requestOptions = {
method: "POST",
headers: headers,
body: data
};
fetch(saymonHostname + path, requestOptions)
.then(response => response.blob())
.then(blob => {
var file = window.URL.createObjectURL(blob);
window.location.assign(file);
})
.catch(error => console.log("error", error));
const http = require("http");
const fs = require("fs");
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/reports/prop-inventory/excel";
let options = {
"method": "POST",
"hostname": saymonHostname,
"headers": {
"Content-Type": "application/json"
},
"path": path
};
let req = http.request(options, function (res) {
let chunks = [];
....
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
let body = Buffer.concat(chunks);
fs.writeFile('report.xlsx', body.toString(), function (err) {
if (err) return console.log(err);
console.log('Saved report.xlsx');
});
});
res.on("error", function (error) {
console.error(error);
}); });
....
let data = JSON.stringify({
"name": {
"$regex": "{caret}CPU$",
"$options": "i"
},
"class_id": 4,
"parent_id": "62d7e58056d203149a08001b"
});
req.write(data);
req.end();
import requests
login = <...>
password = <...>
saymon_hostname = <...>
url = "http://" + saymon_hostname + "/node/api/reports/prop-inventory/excel"
json = {
"name": {
"$regex": "^CPU$",
"$options": "i"
},
"class_id": 4,
"parent_id": "62d7e58056d203149a08001b"
}
response = requests.request("POST", url, json=json, auth=(login, password))
f = open("report.xlsx", "w")
f.write(response.text)
f.close()