Updated API (markdown)

master
Hunter Long 2018-09-12 12:21:53 -07:00
parent 90f081e631
commit be4f3cb1fd
1 changed files with 68 additions and 8 deletions

76
API.md

@ -10,38 +10,98 @@ The main API route will show you all services and failures along with them.
## Services ## Services
The services API endpoint will show you detailed information about services and will allow you to edit/delete services with POST/DELETE http methods. The services API endpoint will show you detailed information about services and will allow you to edit/delete services with POST/DELETE http methods.
#### Viewing All Services ### Viewing All Services
- Endpoint: `/api/services` - Endpoint: `/api/services`
- Method: `GET` - Method: `GET`
#### Viewing Service ### Viewing Service
- Endpoint: `/api/services/{id}` - Endpoint: `/api/services/{id}`
- Method: `GET` - Method: `GET`
#### Updating Service ### Updating Service
- Endpoint: `/api/services/{id}` - Endpoint: `/api/services/{id}`
- Method: `POST` - Method: `POST`
#### Deleting Service POST Data:
```json
{
"name": "Updated Service",
"domain": "https://google.com",
"expected": "",
"expected_status": 200,
"check_interval": 15,
"type": "http",
"method": "GET",
"post_data": "",
"port": 0,
"timeout": 10,
"order_id": 0
}
```
### Deleting Service
- Endpoint: `/api/services/{id}` - Endpoint: `/api/services/{id}`
- Method: `DELETE` - Method: `DELETE`
Response:
```json
{
"status": "success",
"id": 4,
"type": "service",
"method": "delete"
}
```
## Users ## Users
The users API endpoint will show you users that are registered inside your Statup instance. The users API endpoint will show you users that are registered inside your Statup instance.
#### View All Users ### View All Users
- Endpoint: `/api/users` - Endpoint: `/api/users`
- Method: `GET` - Method: `GET`
#### Viewing User ### Viewing User
- Endpoint: `/api/users/{id}` - Endpoint: `/api/users/{id}`
- Method: `GET` - Method: `GET`
#### Updating User ### Creating New User
- Endpoint: `/api/users`
- Method: `POST`
POST Data:
```json
{
"username": "newadmin",
"email": "info@email.com",
"password": "password123",
"admin": true
}
```
### Updating User
- Endpoint: `/api/users/{id}` - Endpoint: `/api/users/{id}`
- Method: `POST` - Method: `POST`
#### Deleting User POST Data:
```json
{
"username": "updatedadmin",
"email": "info@email.com",
"password": "password123",
"admin": true
}
```
### Deleting User
- Endpoint: `/api/services/{id}` - Endpoint: `/api/services/{id}`
- Method: `DELETE` - Method: `DELETE`
Response:
```json
{
"status": "success",
"id": 3,
"type": "user",
"method": "delete"
}
```