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"
}
'import requests
url = "https://getunblocked.com/api/v1/risk-assessments"
payload = { "prUrl": "https://github.com/acme/backend/pull/123" }
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'})
};
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'
]),
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}")
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}")
.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}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "processing",
"gitHeadSha": "8a1b2c3d4e5f678901234567890123456789abcd",
"gitBaseSha": "7a1b2c3d4e5f678901234567890123456789abcd",
"error": "Unable to retrieve the pull request diff.",
"score": "low",
"rationale": "The change is limited to a well-tested validation path."
}{
"status": 400
}{
"status": 400
}{
"status": 400
}{
"status": 400
}{
"status": 400
}{
"status": 400
}Create Risk Assessment
Draft - not available. The specification is subject to change.
Start an asynchronous risk assessment for the pull request identified by prUrl.
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.
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"
}
'import requests
url = "https://getunblocked.com/api/v1/risk-assessments"
payload = { "prUrl": "https://github.com/acme/backend/pull/123" }
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'})
};
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'
]),
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}")
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}")
.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}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "processing",
"gitHeadSha": "8a1b2c3d4e5f678901234567890123456789abcd",
"gitBaseSha": "7a1b2c3d4e5f678901234567890123456789abcd",
"error": "Unable to retrieve the pull request diff.",
"score": "low",
"rationale": "The change is limited to a well-tested validation path."
}{
"status": 400
}{
"status": 400
}{
"status": 400
}{
"status": 400
}{
"status": 400
}{
"status": 400
}Authorizations
The API key to authenticate requests. Obtainable from the web dashboard.
Body
The pull request URL. Equivalent URL forms are normalized to identify the pull request.
"https://github.com/acme/backend/pull/123"
Response
Accepted - The run has been queued
The ID of a resource that can be retrieved from the service.
The status of an asynchronous run. Poll while processing. Complete and failed are terminal states.
processing, complete, failed "processing"
The head commit SHA analyzed by this risk assessment.
"8a1b2c3d4e5f678901234567890123456789abcd"
The base commit SHA analyzed by this risk assessment.
"7a1b2c3d4e5f678901234567890123456789abcd"
An error message present when status is failed; omitted otherwise.
"Unable to retrieve the pull request diff."
The assessed risk level, present when status is complete; omitted otherwise.
lowest, low, medium, high, highest "low"
The explanation of the risk score in Markdown, present when status is complete; omitted otherwise.
"The change is limited to a well-tested validation path."