Upload a SARIF report of code scanning results
const url = 'https://gitea.example.com/api/v1/repos/example/example/security/code_scanning/sarifs';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"commit_sha":"example","ref":"example","sarif":"example","tool_name":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gitea.example.com/api/v1/repos/example/example/security/code_scanning/sarifs \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "commit_sha": "example", "ref": "example", "sarif": "example", "tool_name": "example" }'Gitea Enterprise only. This endpoint is not part of the community edition.
Stores the report for a branch and queues a scan of it. An upload replaces the report the same branch and tool had, which is what a scan reconciles with. The report may be the SARIF document itself or its base64, gzip or zlib compressed, which is the encoding the clients of the reference API send.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Name of the owner
Name of the repository
Request Body
Section titled “Request Body”UploadCodeScanningReportOptions is the body of the code scanning upload endpoint. It carries the fields the reference API of code scanning uploads carries, with the report as it is or base64 encoded and compressed.
object
Commit the report was produced for
Reference of the branch the report is about, either “refs/heads/main” or “main”; empty means the default branch
The SARIF report itself, or its base64, gzip or zlib compressed
Name the report is stored under, empty means the tool of the report
Examplegenerated
{ "commit_sha": "example", "ref": "example", "sarif": "example", "tool_name": "example"}Responses
Section titled “Responses”CodeScanningReportUpload
object
Id of the stored report
Where the findings of that branch are read
Examplegenerated
{ "id": 1, "url": "https://example.com"}APIForbiddenError is a forbidden error response
Headers
Section titled “Headers”APIError is error format response
Headers
Section titled “Headers”APIValidationError is error format response related to input validation