Added documentation to edit, delete services and locations (#11193)

This commit is contained in:
gabrielRojasNew
2020-02-25 21:57:54 -04:00
committed by GitHub
parent 3ce8ae5bad
commit 2d14a57986
3 changed files with 137 additions and 0 deletions

81
doc/API/Locations.md Normal file
View File

@@ -0,0 +1,81 @@
source: API/Locations.md
path: blob/master/doc/
### `add_location`
Add a new location
Route: `/api/v0/locations/`
Input:
- location: name of the new location
- lat: latitude
- lng: longitude
Example:
```curl
curl -X POST -d '{"location":"Google", "lat":"37.4220041","lng":"-122.0862462"}' -H 'X-Auth-Token:YOUR-API-TOKEN' https://librenms.org/api/v0/locations
```
Output:
```json
{
"status": "ok",
"message": "Location added with id #45"
}
```
### `delete_location`
Deletes an existing location
Route: `/api/v0/locations/location`
- location: name of the location to delete
Example:
```curl
curl -X DELETE -H 'X-Auth-Token:YOUR-API-TOKEN' https://librenms.org/api/v0/locations/Google
```
Output:
```json
{
"status": "ok",
"message": "Location Google has been deleted successfully"
}
```
### `edit_location`
Edits a location
Route: `/api/v0/locations/location`
- location: name of the location to edit
Input:
- lat: latitude
- lng: longitude
Example:
```curl
curl -X PATCH -d '{"lng":"100.0862462"}' -H 'X-Auth-Token:YOUR-API-TOKEN' https://librenms.org/api/v0/locations/Google
```
Output:
```json
{
"status": "ok",
"message": "Location updated successfully"
}
```

View File

@@ -144,3 +144,58 @@ Output:
"message": "Service ping has been added to device 192.168.1.10 (#10)"
}
```
### `edit_service_from_host`
Edits a service
Route: `/api/v0/services/:service_id`
- service id
Input:
- id: service id
Example:
```curl
curl -X PATCH -d '{"service_disabled":"1"}' 'X-Auth-Token:YOUR-API-TOKEN' https://librenms.org/api/v0/services/5
```
Output:
```json
{
"status": "ok",
"message": "Service updated successfully"
}
```
### `delete_service_from_host`
Deletes service from device
Route: `/api/v0/services/:service_id`
- service id
Input:
- id: service id
Example:
```curl
curl -X DELETE -H 'X-Auth-Token:YOUR-API-TOKEN' https://librenms.org/api/v0/services/35
```
Output:
```json
{
"status": "ok",
"message": "Service has been deleted successfully"
}
```

View File

@@ -85,3 +85,4 @@ Output from the API currently is via two output types:
- [Services](Services.md)
- [Logs](Logs.md)
- [System](System.md)
- [Locations](Locations.md)