Create Risk Assessment
curl --request POST \
--url https://getunblocked.com/api/v1/risk-assessments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prUrl": "https://github.com/acme/backend/pull/123",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd"
}
'import requests
url = "https://getunblocked.com/api/v1/risk-assessments"
payload = {
"prUrl": "https://github.com/acme/backend/pull/123",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prUrl: 'https://github.com/acme/backend/pull/123',
headSha: '8a1b2c3d4e5f678901234567890123456789abcd'
})
};
fetch('https://getunblocked.com/api/v1/risk-assessments', 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://getunblocked.com/api/v1/risk-assessments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prUrl' => 'https://github.com/acme/backend/pull/123',
'headSha' => '8a1b2c3d4e5f678901234567890123456789abcd'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://getunblocked.com/api/v1/risk-assessments"
payload := strings.NewReader("{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://getunblocked.com/api/v1/risk-assessments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://getunblocked.com/api/v1/risk-assessments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "processing",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd",
"error": "Unable to retrieve the pull request diff.",
"score": "low",
"rationale": "The change is limited to a well-tested validation path."
}{
"message": "<string>",
"documentationUrl": "<string>"
}Code Reviews
Create Risk Assessment
Start an asynchronous risk assessment for the pull request identified by prUrl.
Optionally provide headSha to assess a specific commit; otherwise the current head is used.
The URL is normalized to identify the pull request, accepting equivalent pull request URL forms.
The response identifies the run and the head and base commits being analyzed.
Poll GET /risk-assessments/{riskAssessmentId} until the status is complete or failed.
This operation does not post comments, reviews, or statuses to the pull request or modify it.
POST
/
risk-assessments
Create Risk Assessment
curl --request POST \
--url https://getunblocked.com/api/v1/risk-assessments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prUrl": "https://github.com/acme/backend/pull/123",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd"
}
'import requests
url = "https://getunblocked.com/api/v1/risk-assessments"
payload = {
"prUrl": "https://github.com/acme/backend/pull/123",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prUrl: 'https://github.com/acme/backend/pull/123',
headSha: '8a1b2c3d4e5f678901234567890123456789abcd'
})
};
fetch('https://getunblocked.com/api/v1/risk-assessments', 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://getunblocked.com/api/v1/risk-assessments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prUrl' => 'https://github.com/acme/backend/pull/123',
'headSha' => '8a1b2c3d4e5f678901234567890123456789abcd'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://getunblocked.com/api/v1/risk-assessments"
payload := strings.NewReader("{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://getunblocked.com/api/v1/risk-assessments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://getunblocked.com/api/v1/risk-assessments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "processing",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd",
"error": "Unable to retrieve the pull request diff.",
"score": "low",
"rationale": "The change is limited to a well-tested validation path."
}{
"message": "<string>",
"documentationUrl": "<string>"
}Authorizations
Body
application/json
Response
Accepted - The run has been queued