Using this handler, you can search for assets in the Inventory, using the same search syntax as in the UI. That makes it easy to construct the specific search. Since the Inventory can hold thousands of assets, you can create a search window, returning only a given number of entries.
Run a search for assets in the Inventory. You have to post the request using a JSON body with the following fields:
REQUEST Fields | Value Type | Description |
---|---|---|
query | String | The search query. It can be empty. |
chunkLimit | Number (optional) | The amount of search results to return. Default: 50 |
chunkStart | Number (optional) | The starting point in the search results to create a window from |
Note: To search for all assets in the Inventory, simply send an empty JSON request.
Note: When a chunkStart
is set, the search result is automaically adjusted so that you always receive a list of at most chunkLimit
search results, starting with chunkStart
index in the full search. That allows to create a search window that can be used to keep on searching if there are more results.
The response is an object that contains a list of search results with the following fields:
RESPONSE Fields | Value Type | Description |
---|---|---|
isPartialResult | Boolean | True, if there are more results to list. Just increase the chunkStart in the query |
entries | List<Entry> | The list of search result entries |
Entry Definition | ||
id | GUID | The GUID of an asset |
parent | GUID | The GUID of the parent asset or null if not set |
name | String | The display name of the asset |
isArchived | Boolean | True, if the asset is in the archived state |
type | Object | The asset type object |
type.id | Number | The asset type index |
type.name | String | The display name of the asset type |
# Request POST /api/inventory/search HTTP/1.1 Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u { "query": "", "chunkLimit": 50, "chunkStart": 0 } # Response HTTP/1.1 200 OK Content-Type: application/json { "isPartialResult": true, "entries": [ { "id": "59xcwdkgrd6uvkfm2hks6swxq", "parent": null, "owner": "0000000093b631ea1c6c025a2", "name": "Dell Inspiron 5000 Desktop", "type": { "id": 11, "name": "Computer" } }, { "id": "akdge4rwow805g6mxq5tb1wxl", "parent": null, "owner": "00000000893d1130793b289ce", "name": "HP Pavilion Desktop", "type": { "id": 11, "name": "Computer" } }, ... }
# Browser access http://127.0.0.1:9000/api/inventory/search # Shell access using curl curl -Ls "http://127.0.0.1:9000/api/inventory/search" \ --header 'Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u' \ --header "Content-Type: application/json" \ --request POST \ --data '{"query":"Computer"}' # Shell access using curl with username and password curl -Lsu username:password "http://127.0.0.1:9000/api/inventory/search" \ --header "Content-Type: application/json" \ --request POST \ --data '{"query":"Computer"}'