api: Added add_service_for_host endpoint to API (#8113)

* Add add_service_for_host endpoint to API

Signed-off-by: Rémy Jacquin <remy@remyj.fr>

* Change permissions to allow users to modify device

Signed-off-by: Rémy Jacquin <remy@remyj.fr>
This commit is contained in:
Rémy Jacquin
2018-01-21 20:56:57 +01:00
committed by Neil Lathwood
parent 8a9fc7783d
commit e12e6720f8
6 changed files with 99 additions and 7 deletions

View File

@@ -106,3 +106,31 @@ Output:
]
}
```
### `add_service_for_host`
Add a service for device
Route: `/api/v0/services/:hostname`
- id or hostname is the specific device
Input:
- type: service type
- ip: ip of the service
- desc: description for the service
- param: parameters for the service
- ignore: ignore the service for checks
Example:
```curl
curl -X POST -d '{"type":"ping","ip": "192.168.1.10","desc":"test ping","param": "-t 10 -c 5"}' -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/services/192.168.1.10
```
Output:
```json
{
"status": "ok",
"message": "Service ping has been added to device 192.168.1.10 (#10)"
}
```