Skip to content
Snippets Groups Projects
badge-explanation.mdx 2.29 KiB
Newer Older
---
sidebar_position: 3
---

{/* Copyright 2025 Zentrum für Digitale Souveränität der Öffentlichen Verwaltung (ZenDiS) GmbH.
SPDX-License-Identifier: MIT */}

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](/en/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>

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.