Optisway ana sayfa
Dokümantasyon menüsü

REST API referansı: Çalıştırmalar

Çalıştırma, bir testin tek bir yürütülmesidir: queued olarak başlar, running olur ve passed, failed veya error olarak biter. Biten çalıştırmalar kontrollerini ve bulgularını taşır; organizasyonun planı çalıştırma kanıtlarını içeriyorsa kanıtları ZIP olarak veya report.pdf gibi tek dosyalar hâlinde indirilebilir.

Run

Durumu, tetikleyicisi, süreleri, kontrolleri, bulguları ve kanıtlarıyla bir çalıştırma; artifacts.url ve artifacts.filesUrl v1 indirmelerini gösterir.

Alanlar: Run
AlanTürAçıklama
idstringÇalıştırmanın ondalık bir dize olarak kimliği; çalıştırmayı GET /runs/{id} ile yeniden okuyun.
testIdstringÇalışan testin sayısal kimliği.
testNamestringÇalışan testin adı.
testKind"availability" | "links" | "seo" | "vitals" | "visual" | "a11y" | "rest" | "graphql" | "script" | "journey"Çalışan testin türü.
projectIdstringTestin projesinin kimliği.
projectNamestringTestin projesinin adı.
status"queued" | "running" | "passed" | "failed" | "error"queued ve running hâlâ değişir; passed, failed ve error kesindir (error, çalıştırmanın tamamlanamadığı anlamına gelir).
trigger"manual" | "schedule" | "api"Çalıştırmayı neyin başlattığı: manual (uygulama), schedule (zamanlama) ya da api (bu API).
startedAtISO 8601 string | nullÇalıştırmanın başladığı zaman (UTC) ya da kuyrukta beklerken null.
finishedAtISO 8601 string | nullÇalıştırmanın bittiği zaman (UTC) ya da kesinleşene kadar null.
durationMsinteger | nullÇalıştırmanın milisaniye cinsinden süresi ya da kesinleşene kadar null.
summarystringSonucu tek bir İngilizce satırda verir, örneğin 503 Service Unavailable in 184 ms; çalıştırma bitene kadar boş bir dize.
checks.totalintegerÇalıştırmanın değerlendirdiği kontrol sayısı (her bulgu için bir tane, uyarılar dahil).
checks.passedintegerBaşarılı kontrol sayısı (severity değeri pass olan bulgular).
checks.failedintegerBaşarısız kontrol sayısı (severity değeri fail olan bulgular).
findingsFinding[]Çalıştırmanın tüm bulguları, kontrollerin onları ürettiği sırayla; kuyrukta beklerken boştur.
findings[].severity"pass" | "warn" | "fail"pass, warn (bakmaya değer, çalıştırmayı başarısız kılmaz) ya da fail (çalıştırmayı başarısız kılar).
findings[].codestringKontrolün değişmeyen makine kodu, örneğin status, response-time ya da broken-link.
findings[].messagestringKontrolün tespit ettiği şey, tek bir İngilizce cümleyle.
findings[].targetstring | nullBulgunun ilgili olduğu URL ya da sayfa öğesi; yoksa null.
findings[].valuenumber | nullBulgunun arkasındaki ölçülen sayı, unit ile birlikte okunur (status ile 503); yoksa null.
findings[].unitstring | nullvalue değerinin birimi: ms (milisaniye), s (saniye), score, count, ratio ya da status (bir HTTP durum kodu); yoksa null.
findings[].ruleIdstring | nullBir a11y-issue bulgusunun bildirdiği erişilebilirlik kuralı; image-alt ya da color-contrast gibi değişmeyen bir kimlik. Diğer tüm bulgularda null.
artifactsobject | nullÇalıştırmanın saklanan kanıt ZIP dosyası ya da hiçbir şey saklanmadıysa null.
artifacts.bytesintegerZIP dosyasının bayt cinsinden boyutu.
artifacts.videobooleanZIP dosyası bir ekran kaydı (video.webm) içeriyorsa true.
artifacts.urlstringZIP dosyasını indiren yol (GET /runs/{id}/artifacts).
artifacts.filesUrlstringZIP dosyasındaki tek bir girdiyi indiren yol; sonuna ?path=report.pdf ekleyin (GET /runs/{id}/files).
artifactErrorstring | nullKanıtların neden saklanamadığı (en fazla 200 karakter) ya da null; status değerini hiçbir zaman değiştirmez.
createdAtISO 8601 stringÇalıştırmanın kuyruğa alındığı zaman (UTC).
links.selfstringBu çalıştırmanın yolu (GET /runs/{id}).
links.teststringÇalışan testin yolu (GET /tests/{id}).
Örnek: RunJSON
{
  "id": "4821",
  "testId": "318",
  "testName": "Checkout page",
  "testKind": "availability",
  "projectId": "42",
  "projectName": "Acme Shop",
  "status": "failed",
  "trigger": "api",
  "startedAt": "2026-10-19T09:12:01.000Z",
  "finishedAt": "2026-10-19T09:12:03.140Z",
  "durationMs": 2140,
  "summary": "503 Service Unavailable in 184 ms",
  "checks": {
    "total": 3,
    "passed": 2,
    "failed": 1
  },
  "findings": [
    {
      "severity": "fail",
      "code": "status",
      "message": "503 Service Unavailable",
      "target": "https://shop.example.com/",
      "value": 503,
      "unit": "status",
      "ruleId": null
    },
    {
      "severity": "pass",
      "code": "redirect-chain",
      "message": "No redirects",
      "target": "https://shop.example.com/",
      "value": 0,
      "unit": "count",
      "ruleId": null
    },
    {
      "severity": "pass",
      "code": "response-time",
      "message": "184 ms",
      "target": "https://shop.example.com/",
      "value": 184,
      "unit": "ms",
      "ruleId": null
    }
  ],
  "artifacts": {
    "bytes": 48213,
    "video": false,
    "url": "/api/v1/runs/4821/artifacts",
    "filesUrl": "/api/v1/runs/4821/files"
  },
  "artifactError": null,
  "createdAt": "2026-10-19T09:12:00.000Z",
  "links": {
    "self": "/api/v1/runs/4821",
    "test": "/api/v1/tests/318"
  }
}

RunSummary

lastRun içinde kullanılan kısa çalıştırma biçimi.

Alanlar: RunSummary
AlanTürAçıklama
idstringÇalıştırmanın ondalık bir dize olarak kimliği; çalıştırmayı GET /runs/{id} ile yeniden okuyun.
status"queued" | "running" | "passed" | "failed" | "error"queued ve running hâlâ değişir; passed, failed ve error kesindir (error, çalıştırmanın tamamlanamadığı anlamına gelir).
trigger"manual" | "schedule" | "api"Çalıştırmayı neyin başlattığı: manual (uygulama), schedule (zamanlama) ya da api (bu API).
startedAtISO 8601 string | nullÇalıştırmanın başladığı zaman (UTC) ya da kuyrukta beklerken null.
finishedAtISO 8601 string | nullÇalıştırmanın bittiği zaman (UTC) ya da kesinleşene kadar null.
durationMsinteger | nullÇalıştırmanın milisaniye cinsinden süresi ya da kesinleşene kadar null.
summarystringSonucu tek bir İngilizce satırda verir, örneğin 503 Service Unavailable in 184 ms; çalıştırma bitene kadar boş bir dize.
Örnek: RunSummaryJSON
{
  "id": "4821",
  "status": "failed",
  "trigger": "api",
  "startedAt": "2026-10-19T09:12:01.000Z",
  "finishedAt": "2026-10-19T09:12:03.140Z",
  "durationMs": 2140,
  "summary": "503 Service Unavailable in 184 ms"
}

NotificationRouting

Bir testin kuruluşun bildirim kanallarından hangilerine bildirim gönderdiği: hepsine ya da yalnızca seçilenlere.

Alanlar: NotificationRouting
AlanTürAçıklama
scope"all" | "selected"all (varsayılan): biten çalıştırmalar kuruluşun her etkin bildirim kanalına bildirim gönderir; selected: yalnızca channelIds içindeki kanallara. Her kanalın yalnızca başarısız çalıştırmalar ile her biten çalıştırma arasındaki kendi seçimi yine geçerlidir; üyelere giden çalıştırma e-postaları etkilenmez.
channelIdsstring[] (≤ 20 distinct channel ids, ascending)Seçilen kanalların artan sırayla kimlikleri (GET /notification-channels listesindeki NotificationChannel.id), all ile her zaman boştur; selected ile boş bir liste kanal bildirimi olmadığı anlamına gelir ve silinen bir kanal her listeden çıkar. Uygulamadan dışa aktarılan test dosyaları yönlendirmeyi içermez, çünkü kanal kimlikleri tek bir kuruluşa aittir.
Örnek: NotificationRoutingJSON
{
  "scope": "selected",
  "channelIds": [
    "12"
  ]
}

NotificationChannel

Kuruluşun bir bildirim kanalı: sağlayıcısı, adı, maskelenmiş hedefi ve ne zaman bildirim gönderdiği; webhook URL’si veya anahtarı asla yer almaz.

Alanlar: NotificationChannel
AlanTürAçıklama
idstringKanalın ondalık bir dize olarak kimliği; notificationRouting.channelIds içinde kullanın.
provider"slack" | "teams" | "pumble" | "pagerduty"Kanalın gönderdiği yer: slack, teams (Microsoft Teams), pumble veya pagerduty.
namestringKanalın Ayarlar’da gösterilen adı.
targetHintstringMaskelenmiş webhook adresi veya entegrasyon anahtarı, örneğin hooks.slack.com…Xk2f; tam değer hiçbir zaman döndürülmez.
onlyFailuresbooleanKanal yalnızca başarısız ve hatalı çalıştırmalar için bildirim alıyorsa true (PagerDuty, test yeniden başarılı olduğunda olayını da çözer), her biten çalıştırma için false.
activebooleanKanal duraklatıldığı sürece false: testler onu yine seçebilir, ancak kanal hiçbir şey almaz.
locale"en" | "de" | "tr"Kanala gönderilen her mesajın, çalıştırma bağlantıları dahil, yazıldığı dil: en (İngilizce), de (Almanca) veya tr (Türkçe); Ayarlar’da seçilir.
createdAtISO 8601 stringKanalın eklendiği zaman (UTC).
Örnek: NotificationChannelJSON
{
  "id": "12",
  "provider": "slack",
  "name": "Checkout team",
  "targetHint": "hooks.slack.com…Xk2f",
  "onlyFailures": true,
  "active": true,
  "locale": "en",
  "createdAt": "2026-10-05T09:00:00.000Z"
}

Çalıştırmaları listele GET /runs

Anahtarın kapsamındaki tüm çalıştırmaları en yeniden başlayarak listeler; isteğe bağlı project, test ve status filtreleri birlikte kullanılabilir. read erişimi gerekir. Örnek, 42 numaralı projenin başarısız çalıştırmalarını sayfa başına iki tane listeler; next daha eski çalıştırmalarla devam eder.

Gereken anahtar erişimi: Okuma

Parametreler

Parametreler: GET /runs
AdKonumTürZorunluAçıklamaÖrnek
projectSorgu dizesistring (numeric project id)HayırYalnızca bu projedeki testlerin çalıştırmalarını döndürür (sayısal kimlik).42
testSorgu dizesistring (numeric id or tst_… id)HayırYalnızca bu testin çalıştırmalarını döndürür (sayısal kimlik ya da tst_… kimliği).tst_7k2m9q4xh3vd
statusSorgu dizesi"queued" | "running" | "passed" | "failed" | "error"HayırYalnızca bu durumdaki çalıştırmaları döndürür.failed
limitSorgu dizesiinteger, 1–50, default 20HayırBir sayfadaki çalıştırma sayısı: 1 ile 50 arasında bir tam sayı; belirtilmezse bir sayfada 20 çalıştırma bulunur.2
beforeSorgu dizesistring (run id)HayırYalnızca bu çalıştırma kimliğinden daha eski çalıştırmaları döndürür; genellikle bu değeri kendiniz vermek yerine next bağlantısını izlersiniz.4790

Örnek istek

curl --fail-with-body -sS "https://optisway.com/api/v1/runs?project=42&status=failed&limit=2" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY"
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
const url = "https://optisway.com/api/v1/runs?project=42&status=failed&limit=2";
const response = await fetch(url, {
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
  },
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
const { items } = await response.json();
for (const item of items) console.log(item.id, item.status, item.summary);
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
response = requests.get(
    "https://optisway.com/api/v1/runs?project=42&status=failed&limit=2",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
for item in response.json()["items"]:
    print(item["id"], item["status"], item["summary"])
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/runs?project=42&status=failed&limit=2")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
JSON.parse(response.body)["items"].each do |item|
  puts [item["id"], item["status"], item["summary"]].join("  ")
end
<?php
$curl = curl_init("https://optisway.com/api/v1/runs?project=42&status=failed&limit=2");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
  ],
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
foreach (json_decode($body, true)["items"] as $item) {
  echo $item["id"], "  ", $item["status"], "  ", $item["summary"], "\n";
}
// Java 11+: save as Main.java and run `java Main.java`
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/runs?project=42&status=failed&limit=2";
    HttpRequest request = HttpRequest.newBuilder(URI.create(url))
        .header("Authorization", "Bearer " + System.getenv("OPTISWAY_API_KEY"))
        .build();
    HttpResponse<String> response = HttpClient.newHttpClient()
        .send(request, HttpResponse.BodyHandlers.ofString());
    if (response.statusCode() >= 300) {
      String error = response.body();
      System.err.println(response.statusCode() + " " + field(error, "error") + ": "
          + field(error, "message"));
      System.exit(1);
    }
    // { "items": [...], "next": ... } -- any JSON library (Jackson, Gson, org.json) parses it;
    // this example stays dependency-free and prints the raw JSON.
    System.out.println(response.body());
  }

  /** The first string value of a JSON key (dependency-free; Jackson or Gson parse JSON properly). */
  static String field(String json, String key) {
    Matcher match = Pattern.compile("\"" + key + "\"\\s*:\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|null)")
        .matcher(json);
    return match.find() ? match.group(1) : null;
  }
}
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
	"os"
)

func main() {
	url := "https://optisway.com/api/v1/runs?project=42&status=failed&limit=2"
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("OPTISWAY_API_KEY"))
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	if resp.StatusCode >= 300 {
		var envelope struct {
			Error   string `json:"error"`
			Message string `json:"message"`
		}
		_ = json.NewDecoder(resp.Body).Decode(&envelope)
		fmt.Fprintf(os.Stderr, "%d %s: %s\n", resp.StatusCode, envelope.Error, envelope.Message)
		os.Exit(1)
	}
	var body map[string]any
	if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
		panic(err)
	}
	for _, raw := range body["items"].([]any) {
		item := raw.(map[string]any)
		fmt.Println(item["id"], item["status"], item["summary"])
	}
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/runs?project=42&status=failed&limit=2";
using var response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode)
{
  var envelope = await response.Content.ReadFromJsonAsync<JsonElement>();
  var error = envelope.GetProperty("error");
  var message = envelope.GetProperty("message");
  Console.Error.WriteLine($"{(int)response.StatusCode} {error}: {message}");
  Environment.Exit(1);
}
var body = await response.Content.ReadFromJsonAsync<JsonElement>();
foreach (var item in body.GetProperty("items").EnumerateArray())
{
  Console.WriteLine(string.Join("  ",
    item.GetProperty("id"), item.GetProperty("status"), item.GetProperty("summary")));
}

Örnek yanıt

Döndürür: items (Run nesneleri) ve next (bir sonraki sayfanın yolu ya da son sayfada null) alanlarını içeren bir nesne.

Durum: 200 OK

Başlıklar: Content-Type: application/json; charset=utf-8 Cache-Control: no-store

Yanıt gövdesi: Çalıştırmaları listeleJSON
{
  "items": [
    {
      "id": "4821",
      "testId": "318",
      "testName": "Checkout page",
      "testKind": "availability",
      "projectId": "42",
      "projectName": "Acme Shop",
      "status": "failed",
      "trigger": "api",
      "startedAt": "2026-10-19T09:12:01.000Z",
      "finishedAt": "2026-10-19T09:12:03.140Z",
      "durationMs": 2140,
      "summary": "503 Service Unavailable in 184 ms",
      "checks": {
        "total": 3,
        "passed": 2,
        "failed": 1
      },
      "findings": [
        {
          "severity": "fail",
          "code": "status",
          "message": "503 Service Unavailable",
          "target": "https://shop.example.com/",
          "value": 503,
          "unit": "status",
          "ruleId": null
        },
        {
          "severity": "pass",
          "code": "redirect-chain",
          "message": "No redirects",
          "target": "https://shop.example.com/",
          "value": 0,
          "unit": "count",
          "ruleId": null
        },
        {
          "severity": "pass",
          "code": "response-time",
          "message": "184 ms",
          "target": "https://shop.example.com/",
          "value": 184,
          "unit": "ms",
          "ruleId": null
        }
      ],
      "artifacts": {
        "bytes": 48213,
        "video": false,
        "url": "/api/v1/runs/4821/artifacts",
        "filesUrl": "/api/v1/runs/4821/files"
      },
      "artifactError": null,
      "createdAt": "2026-10-19T09:12:00.000Z",
      "links": {
        "self": "/api/v1/runs/4821",
        "test": "/api/v1/tests/318"
      }
    },
    {
      "id": "4790",
      "testId": "318",
      "testName": "Checkout page",
      "testKind": "availability",
      "projectId": "42",
      "projectName": "Acme Shop",
      "status": "failed",
      "trigger": "schedule",
      "startedAt": "2026-10-18T09:12:02.000Z",
      "finishedAt": "2026-10-18T09:12:12.310Z",
      "durationMs": 10310,
      "summary": "The page could not be loaded: No response within 10 s.",
      "checks": {
        "total": 1,
        "passed": 0,
        "failed": 1
      },
      "findings": [
        {
          "severity": "fail",
          "code": "fetch-error",
          "message": "No response within 10 s.",
          "target": "https://shop.example.com/",
          "value": null,
          "unit": null,
          "ruleId": null
        }
      ],
      "artifacts": {
        "bytes": 41877,
        "video": false,
        "url": "/api/v1/runs/4790/artifacts",
        "filesUrl": "/api/v1/runs/4790/files"
      },
      "artifactError": null,
      "createdAt": "2026-10-18T09:12:00.000Z",
      "links": {
        "self": "/api/v1/runs/4790",
        "test": "/api/v1/tests/318"
      }
    }
  ],
  "next": "/api/v1/runs?project=42&status=failed&limit=2&before=4790"
}

Alabileceğiniz hatalar

  • invalid_request 400 Bir yol, filtre veya limit geçersiz ya da JSON gövdesi okunamıyor, çok büyük veya geçersiz.
  • unauthorized 401 Anahtar eksik, hatalı biçimli, bilinmiyor, iptal edilmiş veya süresi dolmuş ya da onu oluşturan kişi artık üye değil.
  • rate_limited 429 Anahtar çok fazla istek gönderdi; Retry-After içindeki saniye kadar bekleyin.
  • unavailable 503 Bizim tarafımızda geçici bir sorun var; daha sonra tekrar deneyin.

Çalıştırmayı getir GET /runs/{id}

Bir çalıştırmayı getirir: durumu, zamanları, kontrol sayıları, tüm bulguları ve yapıt indirme yolları. read erişimi gerekir; başlattığınız bir çalıştırmayı status değeri passed, failed ya da error olana kadar 10 saniyede bir okuyun. Örnek, sayfa 503 yanıtı verdiği için başarısız olan 4821 numaralı çalıştırmayı gösterir.

Gereken anahtar erişimi: Okuma

Parametreler

Parametreler: GET /runs/{id}
AdKonumTürZorunluAçıklamaÖrnek
idYolstring (numeric run id)EvetÇalıştırmanın Run.id alanında ve başlatılan bir çalıştırmanın Location başlığında döndürülen sayısal kimliği.4821

Örnek istek

curl --fail-with-body -sS "https://optisway.com/api/v1/runs/4821" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY"
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
const url = "https://optisway.com/api/v1/runs/4821";
const response = await fetch(url, {
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
  },
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
const body = await response.json();
console.log(`Status: ${body.status}`);
console.log(`Summary: ${body.summary}`);
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
response = requests.get(
    "https://optisway.com/api/v1/runs/4821",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
body = response.json()
print("Status:", body["status"])
print("Summary:", body["summary"])
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/runs/4821")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
body = JSON.parse(response.body)
puts "Status: #{body["status"]}"
puts "Summary: #{body["summary"]}"
<?php
$curl = curl_init("https://optisway.com/api/v1/runs/4821");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
  ],
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
$data = json_decode($body, true);
echo "Status: {$data['status']}\n";
echo "Summary: {$data['summary']}\n";
// Java 11+: save as Main.java and run `java Main.java`
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/runs/4821";
    HttpRequest request = HttpRequest.newBuilder(URI.create(url))
        .header("Authorization", "Bearer " + System.getenv("OPTISWAY_API_KEY"))
        .build();
    HttpResponse<String> response = HttpClient.newHttpClient()
        .send(request, HttpResponse.BodyHandlers.ofString());
    if (response.statusCode() >= 300) {
      String error = response.body();
      System.err.println(response.statusCode() + " " + field(error, "error") + ": "
          + field(error, "message"));
      System.exit(1);
    }
    String body = response.body();
    System.out.println("Status: " + field(body, "status"));
    System.out.println("Summary: " + field(body, "summary"));
  }

  /** The first string value of a JSON key (dependency-free; Jackson or Gson parse JSON properly). */
  static String field(String json, String key) {
    Matcher match = Pattern.compile("\"" + key + "\"\\s*:\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|null)")
        .matcher(json);
    return match.find() ? match.group(1) : null;
  }
}
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
	"os"
)

func main() {
	url := "https://optisway.com/api/v1/runs/4821"
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("OPTISWAY_API_KEY"))
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	if resp.StatusCode >= 300 {
		var envelope struct {
			Error   string `json:"error"`
			Message string `json:"message"`
		}
		_ = json.NewDecoder(resp.Body).Decode(&envelope)
		fmt.Fprintf(os.Stderr, "%d %s: %s\n", resp.StatusCode, envelope.Error, envelope.Message)
		os.Exit(1)
	}
	var body map[string]any
	if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
		panic(err)
	}
	fmt.Println("Status:", body["status"])
	fmt.Println("Summary:", body["summary"])
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/runs/4821";
using var response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode)
{
  var envelope = await response.Content.ReadFromJsonAsync<JsonElement>();
  var error = envelope.GetProperty("error");
  var message = envelope.GetProperty("message");
  Console.Error.WriteLine($"{(int)response.StatusCode} {error}: {message}");
  Environment.Exit(1);
}
var body = await response.Content.ReadFromJsonAsync<JsonElement>();
Console.WriteLine($"Status: {body.GetProperty("status")}");
Console.WriteLine($"Summary: {body.GetProperty("summary")}");

Örnek yanıt

Döndürür: Bir Run nesnesi.

Durum: 200 OK

Başlıklar: Content-Type: application/json; charset=utf-8 Cache-Control: no-store

Yanıt gövdesi: Çalıştırmayı getirJSON
{
  "id": "4821",
  "testId": "318",
  "testName": "Checkout page",
  "testKind": "availability",
  "projectId": "42",
  "projectName": "Acme Shop",
  "status": "failed",
  "trigger": "api",
  "startedAt": "2026-10-19T09:12:01.000Z",
  "finishedAt": "2026-10-19T09:12:03.140Z",
  "durationMs": 2140,
  "summary": "503 Service Unavailable in 184 ms",
  "checks": {
    "total": 3,
    "passed": 2,
    "failed": 1
  },
  "findings": [
    {
      "severity": "fail",
      "code": "status",
      "message": "503 Service Unavailable",
      "target": "https://shop.example.com/",
      "value": 503,
      "unit": "status",
      "ruleId": null
    },
    {
      "severity": "pass",
      "code": "redirect-chain",
      "message": "No redirects",
      "target": "https://shop.example.com/",
      "value": 0,
      "unit": "count",
      "ruleId": null
    },
    {
      "severity": "pass",
      "code": "response-time",
      "message": "184 ms",
      "target": "https://shop.example.com/",
      "value": 184,
      "unit": "ms",
      "ruleId": null
    }
  ],
  "artifacts": {
    "bytes": 48213,
    "video": false,
    "url": "/api/v1/runs/4821/artifacts",
    "filesUrl": "/api/v1/runs/4821/files"
  },
  "artifactError": null,
  "createdAt": "2026-10-19T09:12:00.000Z",
  "links": {
    "self": "/api/v1/runs/4821",
    "test": "/api/v1/tests/318"
  }
}

Alabileceğiniz hatalar

  • not_found 404 Kaynak yok veya anahtarın kapsamı dışında.
  • unauthorized 401 Anahtar eksik, hatalı biçimli, bilinmiyor, iptal edilmiş veya süresi dolmuş ya da onu oluşturan kişi artık üye değil.
  • rate_limited 429 Anahtar çok fazla istek gönderdi; Retry-After içindeki saniye kadar bekleyin.
  • unavailable 503 Bizim tarafımızda geçici bir sorun var; daha sonra tekrar deneyin.

Yapıt ZIP dosyasını indir GET /runs/{id}/artifacts

Çalıştırmanın kanıtlarını tek bir ZIP dosyası olarak indirir: PDF raporu, manifest.json ve test türüne göre ekran görüntüleri, kanıt görüntüleri, video ve görsel karşılaştırma resimleri. read erişimi gerekir; yapıt saklanmamış bir çalıştırma 404 not_found, organizasyonun planı çalıştırma kanıtlarını içermiyorsa 422 plan_limit_reached yanıtı verir (daha önce saklanan bir ZIP dosyası indirilmeye devam eder). Örnek, 4821 numaralı çalıştırmanın ZIP dosyasını Content-Disposition başlığındaki adla kaydeder.

Gereken anahtar erişimi: Okuma

Parametreler

Parametreler: GET /runs/{id}/artifacts
AdKonumTürZorunluAçıklamaÖrnek
idYolstring (numeric run id)EvetÇalıştırmanın Run.id alanında ve başlatılan bir çalıştırmanın Location başlığında döndürülen sayısal kimliği.4821

Örnek istek

curl --fail-with-body -sS -o run-4821.zip "https://optisway.com/api/v1/runs/4821/artifacts" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY" \
  -w "HTTP %{http_code}, wrote %{size_download} bytes\n"
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
import { writeFile } from "node:fs/promises";

const url = "https://optisway.com/api/v1/runs/4821/artifacts";
const response = await fetch(url, {
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
  },
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
const bytes = Buffer.from(await response.arrayBuffer());
await writeFile("run-4821.zip", bytes);
console.log(`Saved run-4821.zip (${bytes.length} bytes)`);
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
response = requests.get(
    "https://optisway.com/api/v1/runs/4821/artifacts",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
with open("run-4821.zip", "wb") as file:
    file.write(response.content)
print(f"Saved run-4821.zip ({len(response.content)} bytes)")
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/runs/4821/artifacts")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
File.binwrite("run-4821.zip", response.body)
puts "Saved run-4821.zip (#{response.body.bytesize} bytes)"
<?php
$curl = curl_init("https://optisway.com/api/v1/runs/4821/artifacts");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
  ],
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
file_put_contents("run-4821.zip", $body);
echo "Saved run-4821.zip (" . strlen($body) . " bytes)\n";
// Java 11+: save as Main.java and run `java Main.java`
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/runs/4821/artifacts";
    HttpRequest request = HttpRequest.newBuilder(URI.create(url))
        .header("Authorization", "Bearer " + System.getenv("OPTISWAY_API_KEY"))
        .build();
    HttpResponse<byte[]> response = HttpClient.newHttpClient()
        .send(request, HttpResponse.BodyHandlers.ofByteArray());
    if (response.statusCode() >= 300) {
      String error = new String(response.body(), StandardCharsets.UTF_8);
      System.err.println(response.statusCode() + " " + field(error, "error") + ": "
          + field(error, "message"));
      System.exit(1);
    }
    Files.write(Path.of("run-4821.zip"), response.body());
    System.out.println("Saved run-4821.zip (" + response.body().length + " bytes)");
  }

  /** The first string value of a JSON key (dependency-free; Jackson or Gson parse JSON properly). */
  static String field(String json, String key) {
    Matcher match = Pattern.compile("\"" + key + "\"\\s*:\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|null)")
        .matcher(json);
    return match.find() ? match.group(1) : null;
  }
}
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	url := "https://optisway.com/api/v1/runs/4821/artifacts"
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("OPTISWAY_API_KEY"))
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	if resp.StatusCode >= 300 {
		var envelope struct {
			Error   string `json:"error"`
			Message string `json:"message"`
		}
		_ = json.NewDecoder(resp.Body).Decode(&envelope)
		fmt.Fprintf(os.Stderr, "%d %s: %s\n", resp.StatusCode, envelope.Error, envelope.Message)
		os.Exit(1)
	}
	file, err := os.Create("run-4821.zip")
	if err != nil {
		panic(err)
	}
	defer file.Close()
	size, err := io.Copy(file, resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Saved run-4821.zip (%d bytes)\n", size)
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/runs/4821/artifacts";
using var response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode)
{
  var envelope = await response.Content.ReadFromJsonAsync<JsonElement>();
  var error = envelope.GetProperty("error");
  var message = envelope.GetProperty("message");
  Console.Error.WriteLine($"{(int)response.StatusCode} {error}: {message}");
  Environment.Exit(1);
}
var bytes = await response.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync("run-4821.zip", bytes);
Console.WriteLine($"Saved run-4821.zip ({bytes.Length} bytes)");

Örnek yanıt

Döndürür: ZIP dosyasının kendisi (application/zip).

Durum: 200 OK

Başlıklar: Content-Type: application/zip Content-Disposition: attachment; filename="checkout-page-run-4821.zip" Cache-Control: no-store

Gövde JSON değil, ZIP dosyasının kendisidir; onu bir dosyaya yazın. Hatalar yine JSON hata nesnesiyle yanıtlanır.

Alabileceğiniz hatalar

  • not_found 404 Kaynak yok veya anahtarın kapsamı dışında.
  • plan_limit_reached 422 Organizasyonun planı buna izin vermiyor: test sınırına ulaşıldı, bu test türü plana dahil değil veya (artefakt indirmelerinde) çalıştırma kanıtları plana dahil değil.
  • unauthorized 401 Anahtar eksik, hatalı biçimli, bilinmiyor, iptal edilmiş veya süresi dolmuş ya da onu oluşturan kişi artık üye değil.
  • rate_limited 429 Anahtar çok fazla istek gönderdi; Retry-After içindeki saniye kadar bekleyin.
  • unavailable 503 Bizim tarafımızda geçici bir sorun var; daha sonra tekrar deneyin.

Tek bir yapıt dosyasını indir GET /runs/{id}/files

Çalıştırmanın ZIP dosyasındaki tek bir girdiyi, örneğin PDF raporunu, geri kalanı olmadan indirir. read erişimi gerekir; olası hiçbir girdiyi adlandırmayan bir path 400 invalid_request, bu ZIP dosyasında bulunmayan bir girdi 404 not_found, çalıştırma kanıtlarını içermeyen bir planda ZIP dosyası olmayan bir çalıştırma 422 plan_limit_reached yanıtı verir. Örnek, 4821 numaralı çalıştırmanın report.pdf dosyasını kaydeder.

Gereken anahtar erişimi: Okuma

Parametreler

Parametreler: GET /runs/{id}/files
AdKonumTürZorunluAçıklamaÖrnek
idYolstring (numeric run id)EvetÇalıştırmanın Run.id alanında ve başlatılan bir çalıştırmanın Location başlığında döndürülen sayısal kimliği.4821
pathSorgu dizesistring (entry inside the ZIP, e.g. report.pdf)EvetÇalıştırmanın ZIP dosyasındaki girdi: report.pdf, video.webm, manifest.json, screenshots/<name>.jpg, screenshots_proof/<name>.jpg ya da visual/<width>x<height>-(baseline|current|diff).png.report.pdf

Örnek istek

curl --fail-with-body -sS -o report.pdf \
  "https://optisway.com/api/v1/runs/4821/files?path=report.pdf" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY" \
  -w "HTTP %{http_code}, wrote %{size_download} bytes\n"
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
import { writeFile } from "node:fs/promises";

const url = "https://optisway.com/api/v1/runs/4821/files?path=report.pdf";
const response = await fetch(url, {
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
  },
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
const bytes = Buffer.from(await response.arrayBuffer());
await writeFile("report.pdf", bytes);
console.log(`Saved report.pdf (${bytes.length} bytes)`);
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
response = requests.get(
    "https://optisway.com/api/v1/runs/4821/files?path=report.pdf",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
with open("report.pdf", "wb") as file:
    file.write(response.content)
print(f"Saved report.pdf ({len(response.content)} bytes)")
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/runs/4821/files?path=report.pdf")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
File.binwrite("report.pdf", response.body)
puts "Saved report.pdf (#{response.body.bytesize} bytes)"
<?php
$curl = curl_init("https://optisway.com/api/v1/runs/4821/files?path=report.pdf");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
  ],
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
file_put_contents("report.pdf", $body);
echo "Saved report.pdf (" . strlen($body) . " bytes)\n";
// Java 11+: save as Main.java and run `java Main.java`
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/runs/4821/files?path=report.pdf";
    HttpRequest request = HttpRequest.newBuilder(URI.create(url))
        .header("Authorization", "Bearer " + System.getenv("OPTISWAY_API_KEY"))
        .build();
    HttpResponse<byte[]> response = HttpClient.newHttpClient()
        .send(request, HttpResponse.BodyHandlers.ofByteArray());
    if (response.statusCode() >= 300) {
      String error = new String(response.body(), StandardCharsets.UTF_8);
      System.err.println(response.statusCode() + " " + field(error, "error") + ": "
          + field(error, "message"));
      System.exit(1);
    }
    Files.write(Path.of("report.pdf"), response.body());
    System.out.println("Saved report.pdf (" + response.body().length + " bytes)");
  }

  /** The first string value of a JSON key (dependency-free; Jackson or Gson parse JSON properly). */
  static String field(String json, String key) {
    Matcher match = Pattern.compile("\"" + key + "\"\\s*:\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|null)")
        .matcher(json);
    return match.find() ? match.group(1) : null;
  }
}
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	url := "https://optisway.com/api/v1/runs/4821/files?path=report.pdf"
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("OPTISWAY_API_KEY"))
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	if resp.StatusCode >= 300 {
		var envelope struct {
			Error   string `json:"error"`
			Message string `json:"message"`
		}
		_ = json.NewDecoder(resp.Body).Decode(&envelope)
		fmt.Fprintf(os.Stderr, "%d %s: %s\n", resp.StatusCode, envelope.Error, envelope.Message)
		os.Exit(1)
	}
	file, err := os.Create("report.pdf")
	if err != nil {
		panic(err)
	}
	defer file.Close()
	size, err := io.Copy(file, resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Saved report.pdf (%d bytes)\n", size)
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/runs/4821/files?path=report.pdf";
using var response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode)
{
  var envelope = await response.Content.ReadFromJsonAsync<JsonElement>();
  var error = envelope.GetProperty("error");
  var message = envelope.GetProperty("message");
  Console.Error.WriteLine($"{(int)response.StatusCode} {error}: {message}");
  Environment.Exit(1);
}
var bytes = await response.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync("report.pdf", bytes);
Console.WriteLine($"Saved report.pdf ({bytes.Length} bytes)");

Örnek yanıt

Döndürür: Kendi içerik türüyle dosyanın kendisi (rapor için application/pdf).

Durum: 200 OK

Başlıklar: Content-Type: application/pdf Cache-Control: no-store X-Content-Type-Options: nosniff

Gövde JSON değil, istenen dosyanın kendisidir; onu bir dosyaya yazın. Content-Type girdiye uyar: application/pdf, image/jpeg, image/png, video/webm ya da application/json.

Alabileceğiniz hatalar

  • invalid_request 400 Bir yol, filtre veya limit geçersiz ya da JSON gövdesi okunamıyor, çok büyük veya geçersiz.
  • not_found 404 Kaynak yok veya anahtarın kapsamı dışında.
  • plan_limit_reached 422 Organizasyonun planı buna izin vermiyor: test sınırına ulaşıldı, bu test türü plana dahil değil veya (artefakt indirmelerinde) çalıştırma kanıtları plana dahil değil.
  • unauthorized 401 Anahtar eksik, hatalı biçimli, bilinmiyor, iptal edilmiş veya süresi dolmuş ya da onu oluşturan kişi artık üye değil.
  • rate_limited 429 Anahtar çok fazla istek gönderdi; Retry-After içindeki saniye kadar bekleyin.
  • unavailable 503 Bizim tarafımızda geçici bir sorun var; daha sonra tekrar deneyin.

Bildirim kanallarını listele GET /notification-channels

Anahtarın kuruluşuna ait bildirim kanallarını, yani sahiplerin ve yöneticilerin Ayarlar → Entegrasyonlar → Bildirim kanalları bölümünde eklediği ve kimlikleri notificationRouting.channelIds içine yazılan Slack, Microsoft Teams, Pumble ve PagerDuty hedeflerini listeler; webhook URL’si veya entegrasyon anahtarı hiçbir zaman döndürülmez, yalnızca maskelenmiş targetHint döner. read erişimi gerekir ve liste sayfalanmaz; kanallar kuruluşa aittir, bu yüzden tek bir projeyle sınırlı bir anahtar da hepsini görür. Örnek, ödeme ekibinin 12 numaralı Slack kanalını ve duraklatılmış 15 numaralı PagerDuty hizmetini listeler.

Gereken anahtar erişimi: Okuma

Parametreler

Bu uç nokta parametre almaz.

Örnek istek

curl --fail-with-body -sS "https://optisway.com/api/v1/notification-channels" \
  -H "Authorization: Bearer $OPTISWAY_API_KEY"
// Node.js 18+: save as optisway.mjs and run `node optisway.mjs`
const url = "https://optisway.com/api/v1/notification-channels";
const response = await fetch(url, {
  headers: {
    Authorization: `Bearer ${process.env.OPTISWAY_API_KEY}`,
  },
});
if (!response.ok) {
  const { error, message } = await response.json();
  console.error(`${response.status} ${error}: ${message}`);
  process.exit(1);
}
const { items } = await response.json();
for (const item of items) console.log(item.id, item.provider, item.name);
# pip install requests
import os
import sys

import requests

api_key = os.environ["OPTISWAY_API_KEY"]
response = requests.get(
    "https://optisway.com/api/v1/notification-channels",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
if not response.ok:
    envelope = response.json()
    print(f"{response.status_code} {envelope['error']}: {envelope['message']}", file=sys.stderr)
    sys.exit(1)
for item in response.json()["items"]:
    print(item["id"], item["provider"], item["name"])
require "json"
require "net/http"
require "uri"

uri = URI("https://optisway.com/api/v1/notification-channels")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OPTISWAY_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
unless response.is_a?(Net::HTTPSuccess)
  envelope = JSON.parse(response.body)
  warn "#{response.code} #{envelope["error"]}: #{envelope["message"]}"
  exit 1
end
JSON.parse(response.body)["items"].each do |item|
  puts [item["id"], item["provider"], item["name"]].join("  ")
end
<?php
$curl = curl_init("https://optisway.com/api/v1/notification-channels");
curl_setopt_array($curl, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("OPTISWAY_API_KEY"),
  ],
]);
$body = curl_exec($curl);
if ($body === false) {
  fwrite(STDERR, curl_error($curl) . "\n");
  exit(1);
}
$status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($status < 200 || $status >= 300) {
  $envelope = json_decode($body, true);
  fwrite(STDERR, "$status {$envelope['error']}: {$envelope['message']}\n");
  exit(1);
}
foreach (json_decode($body, true)["items"] as $item) {
  echo $item["id"], "  ", $item["provider"], "  ", $item["name"], "\n";
}
// Java 11+: save as Main.java and run `java Main.java`
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
  public static void main(String[] args) throws Exception {
    String url = "https://optisway.com/api/v1/notification-channels";
    HttpRequest request = HttpRequest.newBuilder(URI.create(url))
        .header("Authorization", "Bearer " + System.getenv("OPTISWAY_API_KEY"))
        .build();
    HttpResponse<String> response = HttpClient.newHttpClient()
        .send(request, HttpResponse.BodyHandlers.ofString());
    if (response.statusCode() >= 300) {
      String error = response.body();
      System.err.println(response.statusCode() + " " + field(error, "error") + ": "
          + field(error, "message"));
      System.exit(1);
    }
    // { "items": [...], "next": ... } -- any JSON library (Jackson, Gson, org.json) parses it;
    // this example stays dependency-free and prints the raw JSON.
    System.out.println(response.body());
  }

  /** The first string value of a JSON key (dependency-free; Jackson or Gson parse JSON properly). */
  static String field(String json, String key) {
    Matcher match = Pattern.compile("\"" + key + "\"\\s*:\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|null)")
        .matcher(json);
    return match.find() ? match.group(1) : null;
  }
}
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
	"os"
)

func main() {
	url := "https://optisway.com/api/v1/notification-channels"
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("OPTISWAY_API_KEY"))
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	if resp.StatusCode >= 300 {
		var envelope struct {
			Error   string `json:"error"`
			Message string `json:"message"`
		}
		_ = json.NewDecoder(resp.Body).Decode(&envelope)
		fmt.Fprintf(os.Stderr, "%d %s: %s\n", resp.StatusCode, envelope.Error, envelope.Message)
		os.Exit(1)
	}
	var body map[string]any
	if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
		panic(err)
	}
	for _, raw := range body["items"].([]any) {
		item := raw.(map[string]any)
		fmt.Println(item["id"], item["provider"], item["name"])
	}
}
// .NET 8: `dotnet new console`, replace Program.cs with this file, then `dotnet run`
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
  new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OPTISWAY_API_KEY"));
var url = "https://optisway.com/api/v1/notification-channels";
using var response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode)
{
  var envelope = await response.Content.ReadFromJsonAsync<JsonElement>();
  var error = envelope.GetProperty("error");
  var message = envelope.GetProperty("message");
  Console.Error.WriteLine($"{(int)response.StatusCode} {error}: {message}");
  Environment.Exit(1);
}
var body = await response.Content.ReadFromJsonAsync<JsonElement>();
foreach (var item in body.GetProperty("items").EnumerateArray())
{
  Console.WriteLine(string.Join("  ",
    item.GetProperty("id"), item.GetProperty("provider"), item.GetProperty("name")));
}

Örnek yanıt

Döndürür: items dizisi NotificationChannel nesnelerini içeren bir nesne.

Durum: 200 OK

Başlıklar: Content-Type: application/json; charset=utf-8 Cache-Control: no-store

Yanıt gövdesi: Bildirim kanallarını listeleJSON
{
  "items": [
    {
      "id": "12",
      "provider": "slack",
      "name": "Checkout team",
      "targetHint": "hooks.slack.com…Xk2f",
      "onlyFailures": true,
      "active": true,
      "locale": "en",
      "createdAt": "2026-10-05T09:00:00.000Z"
    },
    {
      "id": "15",
      "provider": "pagerduty",
      "name": "Shop on-call",
      "targetHint": "…9c41",
      "onlyFailures": true,
      "active": false,
      "locale": "de",
      "createdAt": "2026-10-06T11:30:00.000Z"
    }
  ]
}

Alabileceğiniz hatalar

  • unauthorized 401 Anahtar eksik, hatalı biçimli, bilinmiyor, iptal edilmiş veya süresi dolmuş ya da onu oluşturan kişi artık üye değil.
  • rate_limited 429 Anahtar çok fazla istek gönderdi; Retry-After içindeki saniye kadar bekleyin.
  • unavailable 503 Bizim tarafımızda geçici bir sorun var; daha sonra tekrar deneyin.