mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add port description API endpoints and documentation (#15578)
* Add port description API endpoints and documentation * Change "update_port_description" behaviour to mimic webUI behaviour * Fix code style issue * Fix another code style issue
This commit is contained in:
@@ -379,3 +379,49 @@ Output:
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `get_port_description`
|
||||
|
||||
Get the description (`ifAlias`) for a given port id.
|
||||
|
||||
Route: `/api/v0/ports/:portid/description`
|
||||
|
||||
Example:
|
||||
|
||||
```curl
|
||||
curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/ports/323/description
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"port_description": "GigabitEthernet14"
|
||||
}
|
||||
```
|
||||
|
||||
### `update_port_description`
|
||||
|
||||
Change the description (`ifAlias`) for a given port id.
|
||||
|
||||
Route: `/api/v0/ports/:portid/description`
|
||||
|
||||
Input (JSON):
|
||||
|
||||
- description: The string data to use as the new port description.
|
||||
Sending an empty string will reset the description to default.
|
||||
|
||||
Example:
|
||||
|
||||
```curl
|
||||
curl -X PATCH -d '{"description": "Out-of-Band Management Link"}' -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/ports/323/description
|
||||
```
|
||||
|
||||
Output:
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"message": "Port description updated."
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user