4.1 Working With Inventory Sheets Via API
URI: https://myIsoraURL/api/sheets
Verb | Address | Notes | Additional Details |
GET | /sheets /sheets?page=X &page_size=Y | Retrieves a paginated list of all hosts, Y at a time (25 by default). Each object in the array includes detailed information about people and OUs associated with the sheet, number of hosts, and notification settings. | The beginning of each response includes a count and a link to the next and previous pages. Each entry in the array has a link to itself, as well as a link to hosts on that sheet and a csv page of the hosts. |
GET | /sheets/<id> | Retrieves an individual sheet object. If an invalid location id is given, a “Not found” error is returned. | |
GET | /sheets/<id>/csv | Retrieves a CSV file containing the sheet. | The file includes a header. |
GET | /hosts?sheet=<id> &page_size=Y | Retrieves a paginated list of hosts belonging to the sheet in arrays of up to Y at a time (25 by default). Each entry includes some details about the host. | The beginning of each response includes a count and a link to the previous and next pages Each entry in the array has a link to itself. |
POST | /sheets | Creates a new sheet. Returns the new sheet. Even if another owner is specified, the creator of the sheet is also an owner. | body { “name”: string, “owners_people”: array of strings (usernames)*, “owners_orgs”: array of strings (codes)* *optional |
PUT | /sheets/<id> | Updates (replaces) an existing sheet. Returns the updated sheet object. | Include the name, along with any other fields you want to change. |
POST | /sheets/<id>/csv | Adds contents of a CSV file to an existing sheet. The CSV file should have a header. Returns an array of errors (which is empty if there are none). | Use content type multipart/form-data, use field name “file” and attach the CSV file. |
DELETE | /sheets/<id> | Removes the sheet. No content is returned. | If any hosts are assigned to the location, the request will return an error. |
GET | /sheets?search=string &page_size=Y | Returns sheet objects matching the search string. | Searches both sheet and host data, so if a host object matches the search string, it will result in a match. |