コードスキャンのメトリクスを取得
curl --request GET \
--url https://api.devin.ai/v3/organizations/{org_id}/code-scans/metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.devin.ai/v3/organizations/{org_id}/code-scans/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.devin.ai/v3/organizations/{org_id}/code-scans/metrics', 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.devin.ai/v3/organizations/{org_id}/code-scans/metrics",
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.devin.ai/v3/organizations/{org_id}/code-scans/metrics"
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.devin.ai/v3/organizations/{org_id}/code-scans/metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/organizations/{org_id}/code-scans/metrics")
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{
"avg_pr_open_duration_seconds": 123,
"avg_pr_time_to_merge_seconds": 123,
"open_critical_findings_count": 123,
"open_high_findings_count": 123,
"open_low_findings_count": 123,
"open_medium_findings_count": 123,
"prs_closed_count": 123,
"prs_created_count": 123,
"prs_merged_count": 123,
"prs_open_count": 123,
"repos_scanned_count": 123,
"scans_count": 123
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}コードスキャン(組織)
コードスキャンのメトリクスを取得(Devin API)
v3 API を使用して、単一の組織における指定期間の Devin コードスキャン、検出結果、修復用PRの集計メトリクスを取得します
GET
/
v3
/
organizations
/
{org_id}
/
code-scans
/
metrics
コードスキャンのメトリクスを取得
curl --request GET \
--url https://api.devin.ai/v3/organizations/{org_id}/code-scans/metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.devin.ai/v3/organizations/{org_id}/code-scans/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.devin.ai/v3/organizations/{org_id}/code-scans/metrics', 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.devin.ai/v3/organizations/{org_id}/code-scans/metrics",
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.devin.ai/v3/organizations/{org_id}/code-scans/metrics"
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.devin.ai/v3/organizations/{org_id}/code-scans/metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devin.ai/v3/organizations/{org_id}/code-scans/metrics")
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{
"avg_pr_open_duration_seconds": 123,
"avg_pr_time_to_merge_seconds": 123,
"open_critical_findings_count": 123,
"open_high_findings_count": 123,
"open_low_findings_count": 123,
"open_medium_findings_count": 123,
"prs_closed_count": 123,
"prs_created_count": 123,
"prs_merged_count": 123,
"prs_open_count": 123,
"repos_scanned_count": 123,
"scans_count": 123
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}{
"status": 123,
"title": "<string>",
"detail": "<string>",
"errors": [
{}
],
"instance": "<string>",
"type": "about:blank"
}権限
ViewCodeScans 権限を持つサービスユーザーまたはパーソナルアクセストークンが必要です。
時間フィルター
time_after および time_before クエリパラメータが必要です。
time_afterとtime_beforeはどちらも、UTC として解釈される秒単位の Unix タイムスタンプです。time_afterはtime_beforeより前の時刻である必要があります。time_afterとtime_beforeの間の期間は100 日以下である必要があります。- メトリクスの対象は、この期間内に作成されたコードスキャンです。
承認
サービスユーザーの認証情報(接頭辞: cog_)
パスパラメータ
組織ID(プレフィックス: org-)
例:
"org-abc123def456"
レスポンス
成功レスポンス
コードスキャンのメトリクスのレスポンスモデル。
すべてのメトリクスは、指定した期間内に作成されたコードスキャンを対象としています。検出結果と修復用PRは、それらを生成したスキャンに紐付けられます。
PRがオープン状態にある(またはあった)平均時間(秒)。完了したPRでは作成からマージまたはクローズまで、オープン中のPRでは作成から現在までを指します。PRが1件も作成されていない場合は Null。
PRの作成からマージまでの平均時間(秒)。マージ済みのPRが1件もない場合は Null。
重大度がcriticalの未解決の検出結果数。
重大度がhighの未解決の検出結果数。
重大度がlowの未解決の検出結果数。
重大度がmediumの未解決の検出結果数。
マージされずにクローズされた修復用PRの数。
スキャンの修復セッションによって作成されたPRの数。
マージされた修復用PRの数。
現在オープン状態の修復用PRの数。
スキャン対象となった一意のリポジトリ数。
指定した期間内に作成されたコードスキャンの数。

