Skip to content
Snippets Groups Projects
Verified Commit 54d7ce1f authored by Sebastian Kawelke's avatar Sebastian Kawelke :upside_down:
Browse files

Readds badge explanation endpoint

parent 23f821c9
No related branches found
No related tags found
No related merge requests found
---
sidebar_position: 3
---
import { Tabs, Callout } from 'nextra/components'
# Badge Explanation
## Get the explanation of a badge
<Callout type="info">
`GET /api/v1/repositories/{repositoryUrl}/badges/{badgeID}/sarif`
</Callout>
This endpoint returns the the explanation of a badge for the given repository URL and badge ID.
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`).
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.
### Example Request
<Tabs items={['GO', 'JavaScript', 'curl']}>
<Tabs.Tab>
```go filename="main.go" copy
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://scanner.zend.is/api/v1/repositories/https%3A%2F%2Fgitlab.opencode.de%2Fzendis-repo-scanner/badges/MAINTAINED/sarif"
resp, err := http.Get(url)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
```
</Tabs.Tab>
<Tabs.Tab>
```js filename="main.js" copy
const fetch = require('node-fetch');
const url = 'https://scanner.zend.is/api/v1/repositories/https%3A%2F%2Fgitlab.opencode.de%2Fzendis-repo-scanner/badges/MAINTAINED/sarif';
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/sarif"
```
</Tabs.Tab>
</Tabs>
\ No newline at end of file
---
sidebar_position: 3
sidebar_position: 2
---
import { Tabs, Callout } from 'nextra/components'
......@@ -18,7 +18,7 @@ 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`).
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).
[.badge-api.yaml](/concepts/configuration) of the badge api instance.
### Example Request
......
---
sidebar_position: 2
sidebar_position: 1
---
import { Tabs, Callout } from 'nextra/components'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.