Enabling general search for ports, devices, and more (#11571)

* Search engine for device, through API

* reviewed port search through API

* fixed die

* Update api_functions.inc.php

* Update api_functions.inc.php

* Update api_functions.inc.php

* Update api_functions.inc.php

* Update api.php

* Update api.php

* Update Ports.md

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
hachpai
2020-05-25 00:16:07 +02:00
committed by GitHub
parent a44cdc2f45
commit 4bb064c7ad
3 changed files with 69 additions and 4 deletions

View File

@@ -44,6 +44,52 @@ Output:
}
```
### `search_ports`
Search for ports matching the query.
Route: `/api/v0/ports/search/:search`
- search string to search in fields: ifAlias, ifDescr, and ifName
Input:
-
Example:
```curl
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/ports/search/lo
```
Output:
```json
{
"status": "ok",
"ports": [
{
"device_id": 1,
"port_id": 1,
"ifIndex": 1,
"ifName": "lo"
},
{
"device_id": 2,
"port_id": 3,
"ifIndex": 1,
"ifName": "lo"
},
{
"device_id": 3,
"port_id": 5,
"ifIndex": 1,
"ifName": "lo"
}
]
}
```
### `get_port_info`
Get all info for a particular port.