curl --request GET \
--url https://api.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot', 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.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot",
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.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot"
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.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot")
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{
"base_sha": "<string>",
"files": [
{
"additions": 1,
"category": "implementation",
"deletions": 1,
"path": "<string>",
"status": "added",
"head": {
"content": "<string>",
"kind": "text"
},
"patch": "<string>",
"previous_path": "<string>"
}
],
"head_sha": "<string>",
"kind": "ready",
"truncated": true
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}Get the snapshot of a pull request head: its changed files against the base tip, their patches and their contents at the head
Reads, in one call, everything the Diff tab draws at a pull request’s head: GitHub’s changed-file listing of ref against the base branch at base_sha, each file’s unified patch, and each file’s content at the head.
Use this tool when you need to:
- Show a pull request’s changed files with their patches and head contents without one GitHub call per file
- Poll a head’s snapshot until its capture finishes
Examples:
- GET /pull-requests//review/head-snapshot?ref=1a954628a960aaef81d7b2d4521929579f3541e6&base_sha=1405df66cbe219b0bf6355bc3d60361a8376b6b4
- GET /pull-requests/6f1c2a9e-3b7d-4c55-9a2e-0d8b1f4e7c21/review/head-snapshot?org_id=0b9d3e57-2c1a-4f6e-8d7b-5a4c3e2f1d09&ref=1a954628a960aaef81d7b2d4521929579f3541e6&base_sha=1405df66cbe219b0bf6355bc3d60361a8376b6b4
Hints:
- pullRequestID is the pull request’s uuid; ref and base_sha are required full lowercase 40-hex SHAs; org_id (uuid) is optional, resolved as getPullRequest resolves it. The schema answers 422 for a missing or malformed value.
- ref and base_sha must be the head_sha and base_sha the PullRequest currently names: GitHub lists only the current head against the current base, so a reader still showing an earlier listing, or a pull request whose mirror has not learned both, is told the pull request moved with 409 (no domain code, unlike the pinned diff read’s head_moved), and the PullRequest’s next read names the new ones.
- Answers a union on kind. capturing: the first reader to find no snapshot claims its capture and enqueues it, and every reader meanwhile is answered capturing, enqueues nothing and reads again shortly. failed: the capture gave up after its retries, with error, and retryPullRequestReviewHeadSnapshotCapture starts it again. ready: the snapshot, captured once and then served from storage.
- A ready snapshot holds head_sha, base_sha, truncated and files, each with its patch where GitHub gives one and, for a file with a patch that exists at the head, head: kind text with content, binary or too_large, or omitted with a reason when the snapshot carries no content for it (its text would have overrun the snapshot’s 32 MiB text budget, or GitHub did not find or serve it at capture), in which case getPullRequestReviewFile serves it.
- ready is immutable, so a browser caches it for the listing’s life (Cache-Control private, max-age=31536000, immutable); it is sent gzip-encoded to a client whose Accept-Encoding accepts gzip (or every coding), as plain JSON to one that does not, and refused with 406 to one that accepts neither, and the answer varies on Accept-Encoding. capturing and failed are never cached.
- Use getPullRequestGithubDiff instead for a live listing pinned by expected_head_sha, and getPullRequestReviewFile for one file at a reviewed commit.
- Any member of an owning organization (one with a review run of the pull request or a non-archived project on its repository) may call it, a viewer included, and no GitHub connection is needed. A pull request that does not exist, one no organization of the caller owns and an org_id that does not own it answer the same 404.
- When no owner admits the caller, a billing member is refused with 403 org_role_insufficient and a member of a suspended organization with 403 org_suspended; an agent host’s grant is refused with 403 agent_host_route_not_allowed, and 503 answers when the membership check is unavailable.
curl --request GET \
--url https://api.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot', 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.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot",
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.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot"
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.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/pull-requests/{pullRequestID}/review/head-snapshot")
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{
"base_sha": "<string>",
"files": [
{
"additions": 1,
"category": "implementation",
"deletions": 1,
"path": "<string>",
"status": "added",
"head": {
"content": "<string>",
"kind": "text"
},
"patch": "<string>",
"previous_path": "<string>"
}
],
"head_sha": "<string>",
"kind": "ready",
"truncated": true
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
The pull request's owning organization to act in: the org_id the PullRequest carries. Omitted, getPullRequest and the review page's operations (its review, file, head snapshot and stack) act in the owning organization getPullRequest ranks first, and a console operation refuses with 422 org_id_required when more than one of the caller's organizations owns the pull request.
^[0-9a-f]{40}$^[0-9a-f]{40}$Response
The head's snapshot, that its capture is under way, or that the capture gave up