Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
sidebar_position: 3
---
import { Tabs, Callout } from 'nextra/components'
# Badges
## Get SVG Badge
<Callout type="info">
`GET /api/v1/repositories/{repositoryUrl}/badges/{badgeId}.svg[?timestamp=<unix_timestamp>]`
</Callout>
This endpoint gets parameterized with the repository URL and the badge ID. The repository URL is the URL of the repository that should
be or was already scanned. The URL should be in the following format: `https://gitlab.opencode.de/zendis-repo-scanner`.
**The URL must be URL encoded.** (`https%3A%2F%2Fgitlab.opencode.de%2Fzendis-repo-scanner`)
The badge ID is the title of the badge that should be returned. The badge ID can be one of the following:
- `MAINTENANCE`
- `SECURITY`
- `REUSED`
The timestamp parameter is optional. If it is provided, the endpoint will return the badge that is closest (but never in the future) to
the given timestamp. If it is not provided, the endpoint will return the latest badge as a SVG image `image/svg+xml`.
This simplifies the integration of the badges into other elements like README files or websites.
## Get Badge Explanation
<Callout type="info">
`GET /api/v1/repositories/{repositoryUrl}/badges/{badgeId}[?timestamp=<unix_timestamp>]`
</Callout>
This endpoint gets parameterized with the repository URL and the badge ID. The repository URL is the URL of the repository that should
be or was already scanned.
The badge ID is the title of the badge that should be returned.
The endpoint will return the badge evaluation as JSON. The timestamp parameter is optional. If it is provided, the endpoint will return the
badge that is closest (but never in the future) to the given timestamp. If it is not provided, the endpoint will return the latest badge
evaluation. It is a subset of the whole SARIF response.
### Example Response
```json
{
"badgeUrl": "https://img.shields.io/badge/maintenance-silver-lightgrey.svg",
"badgeId": "MAINTENANCE",
"badgeStatus": "silver",
"badgeInformationUri": "https://gitlab.opencode.de/zendis-repo-scanner/badges/maintenance.json",
"badgeExplanation": {
"criteria": [
{
"description": "The average issue reaction time qualifies as silver (4 days, between 1 and 7 days).",
"ruleId": "ISSUE_REACTION_TIME",
"value": 4,
"status": "silver",
},
{
"description": "The bus factor qualifies as gold (3 contributors or more).",
"ruleId": "BUS_FACTOR",
"value": 3,
"status": "gold",
},
],
"conclusion": "Based on the evaluation of the above criteria, this project is classified as Silver level maintenance."
}
}
```
The currently provided badgeUrls serve only as an example. They will be dynamically generated in the future.