Newer
Older
---
import { Tabs, Callout } from 'nextra/components'
# Badges
## Get SVG Badge
<Callout type="info">

Sebastian Kawelke
committed
`GET /api/v1/repositories/{repositoryUrl}/badges/{badgeID}`

Sebastian Kawelke
committed
This endpoint returns the **SVG badge** for the given repository URL and badge ID.

Sebastian Kawelke
committed
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 must be URL encoded**
(`https://gitlab.opencode.de/zendis-repo-scanner` → `https%3A%2F%2Fgitlab.opencode.de%2Fzendis-repo-scanner`).

Sebastian Kawelke
committed
The badge ID is the title of the badge that should be returned. The available badges and therefore the badge IDs are defined in the
[.badge-api.yaml](/concepts/configuration) of the badge api instance.

Sebastian Kawelke
committed
### Example Request

Sebastian Kawelke
committed
<Tabs items={['GO', 'JavaScript', 'curl']}>
<Tabs.Tab>
```go filename="main.go" copy
package main

Sebastian Kawelke
committed
import (
"fmt"
"io"
"net/http"
)

Sebastian Kawelke
committed
func main() {
url := "https://scanner.zend.is/api/v1/repositories/https%3A%2F%2Fgitlab.opencode.de%2Fzendis-repo-scanner/badges/MAINTAINED"
resp, err := http.Get(url)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()

Sebastian Kawelke
committed
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
```
</Tabs.Tab>
<Tabs.Tab>
```js filename="main.js" copy
const fetch = require('node-fetch');

Sebastian Kawelke
committed
const url = 'https://scanner.zend.is/api/v1/repositories/https%3A%2F%2Fgitlab.opencode.de%2Fzendis-repo-scanner/badges/MAINTAINED';

Sebastian Kawelke
committed
fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```
</Tabs.Tab>
<Tabs.Tab>
```bash filename="cli" copy
curl -X GET "https://scanner.zend.is/api/v1/repositories/https%3A%2F%2Fgitlab.opencode.de%2Fzendis-repo-scanner/badges/MAINTAINED"
```
</Tabs.Tab>
</Tabs>