実行を取消
curl --request POST \
--url https://api.example.com/v1/runs/{run_id}/cancelimport requests
url = "https://api.example.com/v1/runs/{run_id}/cancel"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/runs/{run_id}/cancel', 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.example.com/v1/runs/{run_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.example.com/v1/runs/{run_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/runs/{run_id}/cancel")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/runs/{run_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"run_id": "<string>",
"namespace": "<string>",
"app_name": "<string>",
"app_version": "<string>",
"build_id": "<string>",
"run_kind": "<string>",
"state": {},
"input": {},
"progress": {
"done": 123,
"total": 123,
"status_text": "<string>"
},
"dataset_id": "<string>",
"partial": true,
"cancel_requested": true,
"triggered_by": "<string>",
"upstream_ref": "<string>",
"created_at": "<string>",
"started_at": "<string>",
"first_started_at": "<string>",
"finished_at": "<string>",
"usage": {
"metrics": {},
"duration_ms": 123
},
"billing": {
"events": [
{
"event": "<string>",
"label": "<string>",
"qty": 123,
"unit_price": 123,
"amount": 123,
"unit_size": 123,
"raw_qty": 123
}
],
"total": 123,
"currency": "<string>",
"charged": true
},
"error": {
"code": "<string>",
"category": "<string>",
"message": "<string>",
"retryable": true,
"retry_after": 123,
"item_index": 123,
"details": [
{}
]
},
"sample_records": [
{}
],
"warnings": [
{
"code": "<string>",
"event": "<string>",
"detail": {},
"count": 123,
"updated_at": "<string>"
}
]
}Runs & Results
実行を取消
取消シグナルを送り現在の実行オブジェクトを返す。
POST
/
v1
/
runs
/
{run_id}
/
cancel
実行を取消
curl --request POST \
--url https://api.example.com/v1/runs/{run_id}/cancelimport requests
url = "https://api.example.com/v1/runs/{run_id}/cancel"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/runs/{run_id}/cancel', 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.example.com/v1/runs/{run_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.example.com/v1/runs/{run_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/runs/{run_id}/cancel")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/runs/{run_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"run_id": "<string>",
"namespace": "<string>",
"app_name": "<string>",
"app_version": "<string>",
"build_id": "<string>",
"run_kind": "<string>",
"state": {},
"input": {},
"progress": {
"done": 123,
"total": 123,
"status_text": "<string>"
},
"dataset_id": "<string>",
"partial": true,
"cancel_requested": true,
"triggered_by": "<string>",
"upstream_ref": "<string>",
"created_at": "<string>",
"started_at": "<string>",
"first_started_at": "<string>",
"finished_at": "<string>",
"usage": {
"metrics": {},
"duration_ms": 123
},
"billing": {
"events": [
{
"event": "<string>",
"label": "<string>",
"qty": 123,
"unit_price": 123,
"amount": 123,
"unit_size": 123,
"raw_qty": 123
}
],
"total": 123,
"currency": "<string>",
"charged": true
},
"error": {
"code": "<string>",
"category": "<string>",
"message": "<string>",
"retryable": true,
"retry_after": 123,
"item_index": 123,
"details": [
{}
]
},
"sample_records": [
{}
],
"warnings": [
{
"code": "<string>",
"event": "<string>",
"detail": {},
"count": 123,
"updated_at": "<string>"
}
]
}POST https://api-datahub.octoparse.com/v1/runs/{run_id}/cancel
認証:APIキー必須(Authorization: Bearer <API Key>)。
取消シグナルを送り、実行側の応答を短時間(最大 5 秒)待ってから現在の実行オブジェクトを返す。キュー中は即停止。実行中は通常数秒以内に協調停止するが、最終状態は「実行を取得」で確認。
所有権は実行詳細と同じ: 自分が開始した実行のみ取消可。取消後、終端は「実行を取得」で確認。
リクエスト
パスパラメータ
string
必須
実行 id。
リクエスト例
curl -X POST \
-H "Authorization: Bearer $OCTOPARSE_API_KEY" \
"https://api-datahub.octoparse.com/v1/runs/run_c62bc0fb8df2/cancel"
レスポンス
200 成功
{
"data": {
"run_id": "run_c62bc0fb8df2",
"namespace": "carol",
"app_name": "probe-b",
"app_version": "0.1.0",
"build_id": null,
"run_kind": "production",
"state": "SUCCEEDED",
"input": {
"product": "p-now"
},
"progress": {
"done": 20,
"total": null,
"status_text": null
},
"dataset_id": "ds_0bd5345d13d0",
"partial": false,
"cancel_requested": false,
"triggered_by": "api",
"upstream_ref": null,
"created_at": "2026-09-15T07:45:40.411993+00:00",
"started_at": "2026-09-15T07:45:40.419610+00:00",
"first_started_at": "2026-09-15T07:45:40.419610+00:00",
"finished_at": "2026-09-15T07:45:40.822250+00:00",
"usage": {
"metrics": {
"records_collected": 20
},
"duration_ms": 402
},
"billing": {
"events": [
{
"event": "record",
"label": "One record",
"qty": 20.0,
"unit_price": 0.001,
"amount": 0.02,
"unit_size": null,
"raw_qty": null
}
],
"total": 0.02,
"currency": "USD",
"charged": true
},
"error": null,
"sample_records": null,
"warnings": []
}
}
data に包まれます。フィールド:
string
必須
—
string
—
string
—
string
—
string
—
string
—
enum
必須
値:
PENDING / QUEUED / RUNNING / SUCCEEDED / PARTIALLY_SUCCEEDED / FAILED / CANCELLED / EXPIRED。object
—
string
—
boolean
—
boolean
取消要求済みで収束中なら
true(協調停止/部分結果回収)。終端では常に false(サーバ正規化)。state から導出不要。string
—
string
—
string
—
string
—
string
ワーカーが初めて実行を引き受けた時刻。
started_at と違いリトライで上書きされないため壁時計の基準: queued = first_started_at - created_at、総壁時間 = finished_at - first_started_at。started_at から queued を取ると以前の試行を待ちと誤算。未割当のみ null。string
—
object
object[]
—
エラー
| HTTP | code | category | Description |
|---|---|---|---|
| 401 | unauthorized | forbidden | API キー欠落または無効。 |
| 404 | run-not-found | not_found | 実行が存在しないか、現在のアカウント開始ではない。 |
| 409 | run-terminal | invalid_input | 実行は既に終了、取消不可。 |
{"error": {code, category, message, retryable}} です。エラー を参照。
クライアントライブラリ
run = client.cancel("run_c62bc0fb8df2")
print(run["state"], run["partial"])
const run = await client.cancel("run_c62bc0fb8df2");
console.log(run.state, run.partial);