2022-06-04 12:18:30 +02:00
# Build Logs
< aside class = "notice" >
All routes in this section require authentication.
< / aside >
Endpoints for interacting with stored build logs.
## List logs
```shell
curl \
-H 'X-Api-Key: secret' \
2022-06-16 22:38:42 +02:00
https://example.com/api/v1/logs?offset=10& limit=20
2022-06-04 12:18:30 +02:00
```
> JSON output format
```json
{
"message": "",
"data": [
{
"id": 1,
2022-06-14 22:41:28 +02:00
"target_id": 3,
2022-06-04 12:18:30 +02:00
"start_time": 1652008554,
"end_time": 1652008559,
"arch": "x86_64",
"exit_code": 0
}
]
}
```
Retrieve a list of build logs.
### HTTP Request
2022-06-16 22:38:42 +02:00
`GET /api/v1/logs`
2022-06-04 12:18:30 +02:00
### Query Parameters
Parameter | Description
--------- | -----------
limit | Maximum amount of results to return.
offset | Offset of results.
2022-06-14 22:41:28 +02:00
target | Only return builds for this target id.
2022-06-04 12:18:30 +02:00
before | Only return logs started before this time (UTC epoch)
after | Only return logs started after this time (UTC epoch)
arch | Only return logs built on this architecture
exit_codes | Comma-separated list of exit codes to limit result to; using `!` as a prefix makes it exclude that value. For example, `1,2` only returns logs with status code 1 or 2, while `!1,!2` returns those that don't have 1 or 2 as the result.
## Get build log
```shell
curl \
-H 'X-Api-Key: secret' \
2022-06-16 22:38:42 +02:00
https://example.com/api/v1/logs/1
2022-06-04 12:18:30 +02:00
```
> JSON output format
```json
{
"message": "",
"data": {
"id": 1,
2022-06-14 22:41:28 +02:00
"target_id": 3,
2022-06-04 12:18:30 +02:00
"start_time": 1652008554,
"end_time": 1652008559,
"arch": "x86_64",
"exit_code": 0
}
}
```
Retrieve info about a specific build log.
### HTTP Request
2022-06-16 22:38:42 +02:00
`GET /api/v1/logs/:id`
2022-06-04 12:18:30 +02:00
### URL Parameters
Parameter | Description
--------- | -----------
id | ID of requested log
## Get log contents
```shell
curl \
-H 'X-Api-Key: secret' \
2022-06-16 22:38:42 +02:00
https://example.com/api/v1/logs/15/content
2022-06-04 12:18:30 +02:00
```
Retrieve the contents of a build log. The response is the build log in
plaintext.
### HTTP Request
2022-06-16 22:38:42 +02:00
`GET /api/v1/logs/:id/content`
2022-06-04 12:18:30 +02:00
### URL Parameters
Parameter | Description
--------- | -----------
id | ID of requested log
## Publish build log
2022-10-01 16:53:16 +02:00
> JSON output format
```json
{
"message": "",
"data": {
"id": 15
}
}
```
2022-06-04 12:18:30 +02:00
< aside class = "warning" >
You should probably not use this endpoint, as it's used by the build system to
publish its logs.
< / aside >
Publish a new build log to the server.
### HTTP Request
2022-06-16 22:38:42 +02:00
`POST /api/v1/logs`
2022-06-04 12:18:30 +02:00
### Query parameters
Parameter | Description
--------- | -----------
startTime | Start time of the build (UTC epoch)
endTime | End time of the build (UTC epoch)
arch | Architecture on which the build was done
exitCode | Exit code of the build container
2022-06-14 22:41:28 +02:00
target | id of target this build is for
2022-06-04 12:18:30 +02:00
### Request body
Plaintext contents of the build log.
2022-12-17 17:11:19 +01:00
## Remove a build log
Remove a build log from the server.
### HTTP Request
`DELETE /api/v1/logs/:id`
### URL Parameters
Parameter | Description
--------- | -----------
id | id of log to remove