Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
405 lines (352 sloc) 12.2 KB
FORMAT: 1A
HOST: https://syrup.keboola.com/queue/
# Syrup Queue API
Syrup Queue API provides simple interface to view and kill Syrup jobs.
This API description assumes using the US region KBC stack, if you are using other stacks, you need to use the [correct URL](https://developers.keboola.com/overview/api/#regions-and-endpoints).
## Group Jobs
## Job [/jobs/{jobId}{?include}]
There's an option to include additional parts in response, by specifying
`include` query parameter. Available parts are: `metrics`.
Example: `?include=metrics`
+ Parameters
+ jobId (required, number, `123456`) ... ID of the Job in form of an integer
+ include (string, `metrics`) ... Specific parts to include. Comma separated.
### View Job Detail [GET]
+ Request (application/json)
+ Headers
X-StorageApi-Token: 123-abcdefghjklmnopqrstuvxyz
+ Response 200 (application/json)
{
"id": 123456,
"runId": "123457",
"lockName": "someComponent-123-456",
"project": {
"id": 123,
"name": "Some project"
},
"token": {
"id": 456,
"description": "Token Description"
},
"component": "someComponent",
"command": "run",
"params": {},
"result": {
"message": "all is fine"
},
"status": "success",
"process": {
"host": "some.hostname.com",
"pid": 1234
},
"createdTime": "2015-03-26T18:40:28+00:00",
"startTime": "2015-03-26T18:40:31+00:00",
"endTime": "2015-03-26T18:41:15+00:00",
"durationSeconds": 44,
"waitSeconds": 3,
"metrics": {
"network": {
"inBytes": 90,
"outBytes": 90
},
"storage": {
"inBytes": 16566,
"outBytes": 0
},
"backend": "mysql"
}
}
## Jobs [/jobs?component={?component}&status={?status}&runId={?runId}&q={?q}&since={?since}&until={?until}&offset={?offset}&limit={?limit}&include={?include}]
Use parameters to filter the output.
There's an option to include additional parts in response, by specifying
`include` query parameter. Available parts are: `metrics`.
Example: `?include=metrics`
+ Parameters
+ component (optional, string, `ex-db`) ... ID of the Syrup Component
+ status (optional, string, `waiting`) ... One of `waiting`,`processing`,`cancelled`,`success`,`error`,`warning`,`terminating`,`terminated`
+ runId (optional, string, `123457`) ... RunId of the Syrup Job
+ q (optional, string, `pid:1234`) ... Query String for Elasticsearch ti filter by
+ since (optional, date, `2015-01-01`) ... Date as string compatible with php strtotime()
+ until (optional, date, `2015-04-01`) ... Date as string compatible with php strtotime()
+ offset (optional, number, `0`) ... Paging offset
+ limit (optional, number, `100`) ... Limit per page, default is 100
+ include (string, `metrics`) ... Specific parts to include. Comma separated.
### View a List of Jobs [GET]
+ Request (application/json)
+ Headers
X-StorageApi-Token: 123-abcdefghjklmnopqrstuvxyz
+ Response 200 (application/json)
[
{
"id": 123456,
"runId": "123457",
"lockName": "someComponent-123-456",
"project": {
"id": 123,
"name": "Some project"
},
"token": {
"id": 456,
"description": "Token Description"
},
"component": "someComponent",
"command": "run",
"params": {},
"result": {
"message": "all is fine"
},
"status": "success",
"process": {
"host": "some.hostname.com",
"pid": 1234
},
"createdTime": "2015-03-26T18:40:28+00:00",
"startTime": "2015-03-26T18:40:31+00:00",
"endTime": "2015-03-26T18:41:15+00:00",
"durationSeconds": 44,
"waitSeconds": 3,
"metrics": {
"network": {
"inBytes": 90,
"outBytes": 90
},
"storage": {
"inBytes": 16566,
"outBytes": 0
},
"backend": "mysql"
}
}
]
## Kill [/jobs/{jobId}/kill]
+ Parameters
+ jobId (required, number, `123456`) ... ID of the Job in form of an integer
### Kill a Job [POST]
+ Response 202 (application/json)
{
"message": "job kill request accepted for processing"
}
## Error Note [/jobs/{jobId}/error-note]
+ Parameters
+ jobId (required, number, `123456`) ... ID of the Job in form of an integer
### Set or update an Error Note of a Job [PUT]
+ Response 200 (application/json)
{
"message": "error note updated"
}
## Group Metrics
## Project Metrics [/metrics{?dateFrom}{?dateTo}{?period}]
Gets project metrics from specified date range and aggregated by period.
Available periods are `day` and `month`.
For `day` period you'll get an array of metrics where `dateFrom` and `dateTo` are the same.
```
{
"dateFrom": "2016-09-01",
"dateTo": "2016-09-01",
"components": []
}
```
For `month` period, result is very similar, but with different `dateFrom` and `dateTo` fields.
```
{
"dateFrom": "2016-09-01",
"dateTo": "2016-09-30",
"components": []
}
```
+ Parameters
+ dateFrom (required, string, `2016-09-01`) ... Start date for which we need stats
+ dateTo (required, string, `2016-09-30`) ... Start date for which we need stats
+ period (required, string, `day`) ... Period by which metrics will be aggregated.
### Get aggregated stats for project [GET]
+ Request (application/json)
+ Headers
X-StorageApi-Token: 123-abcdefghjklmnopqrstuvxyz
+ Response 200 (application/json)
[
{
"dateFrom": "2016-09-01",
"dateTo": "2016-09-01",
"components": []
},
{
"dateFrom": "2016-09-02",
"dateTo": "2016-09-02",
"components": []
},
{
"dateFrom": "2016-09-03",
"dateTo": "2016-09-03",
"components": []
},
{
"dateFrom": "2016-09-04",
"dateTo": "2016-09-04",
"components": []
},
{
"dateFrom": "2016-09-05",
"dateTo": "2016-09-05",
"components": []
},
{
"dateFrom": "2016-09-06",
"dateTo": "2016-09-06",
"components": []
},
{
"dateFrom": "2016-09-07",
"dateTo": "2016-09-07",
"components": []
},
{
"dateFrom": "2016-09-08",
"dateTo": "2016-09-08",
"components": []
},
{
"dateFrom": "2016-09-09",
"dateTo": "2016-09-09",
"components": []
},
{
"dateFrom": "2016-09-10",
"dateTo": "2016-09-10",
"components": []
},
{
"dateFrom": "2016-09-11",
"dateTo": "2016-09-11",
"components": []
},
{
"dateFrom": "2016-09-12",
"dateTo": "2016-09-12",
"components": []
},
{
"dateFrom": "2016-09-13",
"dateTo": "2016-09-13",
"components": []
},
{
"dateFrom": "2016-09-14",
"dateTo": "2016-09-14",
"components": [
{
"name": "storage-direct",
"network": {
"inBytes": 0,
"outBytes": 0
},
"storage": {
"inBytes": 1012,
"outBytes": 0
}
},
{
"name": "keboola.ex-mongodb",
"network": {
"inBytes": 786,
"outBytes": 540
},
"storage": {
"inBytes": 5103,
"outBytes": 0
}
}
]
},
{
"dateFrom": "2016-09-15",
"dateTo": "2016-09-15",
"components": [
{
"name": "keboola.ex-mongodb",
"network": {
"inBytes": 90,
"outBytes": 90
},
"storage": {
"inBytes": 2187,
"outBytes": 0
}
}
]
},
{
"dateFrom": "2016-09-16",
"dateTo": "2016-09-16",
"components": []
},
{
"dateFrom": "2016-09-17",
"dateTo": "2016-09-17",
"components": []
},
{
"dateFrom": "2016-09-18",
"dateTo": "2016-09-18",
"components": []
},
{
"dateFrom": "2016-09-19",
"dateTo": "2016-09-19",
"components": []
},
{
"dateFrom": "2016-09-20",
"dateTo": "2016-09-20",
"components": []
},
{
"dateFrom": "2016-09-21",
"dateTo": "2016-09-21",
"components": []
},
{
"dateFrom": "2016-09-22",
"dateTo": "2016-09-22",
"components": []
},
{
"dateFrom": "2016-09-23",
"dateTo": "2016-09-23",
"components": []
},
{
"dateFrom": "2016-09-24",
"dateTo": "2016-09-24",
"components": []
},
{
"dateFrom": "2016-09-25",
"dateTo": "2016-09-25",
"components": []
},
{
"dateFrom": "2016-09-26",
"dateTo": "2016-09-26",
"components": []
},
{
"dateFrom": "2016-09-27",
"dateTo": "2016-09-27",
"components": []
},
{
"dateFrom": "2016-09-28",
"dateTo": "2016-09-28",
"components": []
},
{
"dateFrom": "2016-09-29",
"dateTo": "2016-09-29",
"components": []
},
{
"dateFrom": "2016-09-30",
"dateTo": "2016-09-30",
"components": []
}
]