curl --request GET \
--url https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"path": "lib/discount.rb",
"diffCoverage": {
"value": 83.33,
"coveredLines": 5,
"missedLines": 1
},
"uncoveredLines": [
6
]
}
],
"meta": {
"hasMore": false
},
"unavailableReason": null
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}List pull request files with diff coverage
Lists the files a pull request adds or modifies, with each file’s diff coverage and uncovered lines, matching the Files Changed tab of its Coverage page in Qlty. Coverage from all tags is combined.
A file is listed when its changes include executable lines or its line coverage changed. Coverage can change even when a file gains no executable lines, for example when lines are deleted or tests exercise it differently, or for reasons outside the pull request.
All files are currently returned in one response, so meta.hasMore is false. Check it anyway, since a future version may paginate.
If the files can’t be listed, data is empty and unavailableReason explains why.
On private projects, returns 403 if the pull request’s author has no Qlty seat.
curl --request GET \
--url https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qlty.sh/gh/{ownerKeyOrId}/projects/{projectKeyOrId}/pulls/{number}/coverage/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"path": "lib/discount.rb",
"diffCoverage": {
"value": 83.33,
"coveredLines": 5,
"missedLines": 1
},
"uncoveredLines": [
6
]
}
],
"meta": {
"hasMore": false
},
"unavailableReason": null
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "The request was invalid."
}
]
}Authorizations
Generate an API token at https://qlty.sh/user/settings/tokens
Path Parameters
Response
Changed files with diff coverage
Why data is empty, or null when the files were listed:
no_coverage: No coverage has been processed yet. It wasn't uploaded, or it's still processing.diff_too_large: The pull request changes more than 500 files, or GitHub couldn't return its diff.no_changed_files: GitHub reports no changed files. It may not have computed the diff yet.
no_coverage, diff_too_large, no_changed_files, null