Cancel a run
curl --request POST \
--url https://api-datahub.octoparse.com/v1/runs/{run_id}/cancel \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-datahub.octoparse.com/v1/runs/{run_id}/cancel"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-datahub.octoparse.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-datahub.octoparse.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",
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-datahub.octoparse.com/v1/runs/{run_id}/cancel"
req, _ := http.NewRequest("POST", 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.post("https://api-datahub.octoparse.com/v1/runs/{run_id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-datahub.octoparse.com/v1/runs/{run_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"run_id": "<string>",
"state": "PENDING",
"namespace": "<string>",
"app_name": "",
"app_version": "<string>",
"build_id": "<string>",
"run_kind": "production",
"input": {},
"progress": {
"done": 0,
"total": 123,
"status_text": "<string>"
},
"dataset_id": "<string>",
"partial": false,
"cancel_requested": false,
"triggered_by": "api",
"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>",
"qty": 123,
"unit_price": 123,
"amount": 123,
"label": "",
"unit_size": 123,
"raw_qty": 123
}
],
"total": 0,
"currency": "<string>",
"charged": true
},
"error": {
"code": "<string>",
"message": "<string>",
"category": "internal",
"retryable": false,
"retry_after": 123,
"item_index": 123,
"details": [
{}
]
},
"sample_records": [
{}
],
"warnings": [
{
"code": "<string>",
"event": "",
"detail": {},
"count": 0,
"updated_at": "<string>"
}
]
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Runs & Results
Cancel a run
Sets the cancel signal and briefly waits (up to 5 seconds) for the worker to respond, returning the current run state; cancelling a run that has already produced records keeps the partial results.
Same ownership gate as run detail: you can only cancel runs you started.
POST
/
v1
/
runs
/
{run_id}
/
cancel
Cancel a run
curl --request POST \
--url https://api-datahub.octoparse.com/v1/runs/{run_id}/cancel \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-datahub.octoparse.com/v1/runs/{run_id}/cancel"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-datahub.octoparse.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-datahub.octoparse.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",
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-datahub.octoparse.com/v1/runs/{run_id}/cancel"
req, _ := http.NewRequest("POST", 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.post("https://api-datahub.octoparse.com/v1/runs/{run_id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-datahub.octoparse.com/v1/runs/{run_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"run_id": "<string>",
"state": "PENDING",
"namespace": "<string>",
"app_name": "",
"app_version": "<string>",
"build_id": "<string>",
"run_kind": "production",
"input": {},
"progress": {
"done": 0,
"total": 123,
"status_text": "<string>"
},
"dataset_id": "<string>",
"partial": false,
"cancel_requested": false,
"triggered_by": "api",
"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>",
"qty": 123,
"unit_price": 123,
"amount": 123,
"label": "",
"unit_size": 123,
"raw_qty": 123
}
],
"total": 0,
"currency": "<string>",
"charged": true
},
"error": {
"code": "<string>",
"message": "<string>",
"category": "internal",
"retryable": false,
"retry_after": 123,
"item_index": 123,
"details": [
{}
]
},
"sample_records": [
{}
],
"warnings": [
{
"code": "<string>",
"event": "",
"detail": {},
"count": 0,
"updated_at": "<string>"
}
]
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}