1
0
Fork 0

document new API endpoints

This commit is contained in:
Sean Sube 2024-01-14 19:25:54 -06:00
parent 2faac57b93
commit 513c1908a1
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 126 additions and 1 deletions

View File

@ -8,6 +8,10 @@
- [GUI bundle](#gui-bundle)
- [`GET /`](#get-)
- [`GET /<path>`](#get-path)
- [Jobs](#jobs)
- [`POST /api/job`](#post-apijob)
- [`PUT /api/job/cancel`](#put-apijobcancel)
- [`GET /api/job/status`](#get-apijobstatus)
- [Settings and parameters](#settings-and-parameters)
- [`GET /api`](#get-api)
- [`GET /api/settings/filters`](#get-apisettingsfilters)
@ -51,11 +55,132 @@ Usually includes:
- `config.json`
- `index.html`
### Jobs
#### `POST /api/job`
Create a new job that will run a chain pipeline provided in the `POST` body.
#### `PUT /api/job/cancel`
Cancel one or more jobs by name, provided in the `jobs` query parameter.
Request:
```shell
> curl http://localhost:5000/api/job/status?jobs=job-1,job-2,job-3,job-4
```
Response:
```json
[
{
"name": "job-1",
"status": "cancelled"
},
{
"name": "job-2",
"status": "pending"
}
]
```
#### `GET /api/job/status`
Get the status of one or more jobs by name, provided in the `jobs` query parameter.
Request:
```shell
> curl http://localhost:5000/api/job/status?jobs=job-1,job-2,job-3,job-4
```
Response:
```json
[
{
"metadata": [
// metadata for each output
],
"name": "job-1",
"outputs": [
"txt2img_job_1.png"
],
"queue": {
"current": 0,
"total": 0
},
"stages": {
"current": 4,
"total": 6
},
"status": "running",
"steps": {
"current": 120,
"total": 78
},
"tiles": {
"current": 0,
"total": 16
}
},
{
"name": "job-2",
"queue": {
"current": 2,
"total": 3
},
"stages": {
"current": 0,
"total": 0
},
"status": "pending",
"steps": {
"current": 0,
"total": 0
},
"tiles": {
"current": 0,
"total": 0
}
}
]
```
### Settings and parameters
#### `GET /api`
Introspection endpoint.
API introspection endpoint.
Returns a JSON document with all of the available API endpoints and valid methods for them:
```json
{
"name": "onnx-web",
"routes": [
{
"methods": [
"HEAD",
"GET",
"OPTIONS"
],
"path": "/static/:filename"
},
{
"methods": [
"HEAD",
"GET",
"OPTIONS"
],
"path": "/"
},
...
]
}
```
#### `GET /api/settings/filters`