保持フラグ設定
curl --request PUT \
--url https://api.example.com/v1/datasets/{dataset_id}/retention \
--header 'Content-Type: application/json' \
--data '
{
"retained": true
}
'import requests
url = "https://api.example.com/v1/datasets/{dataset_id}/retention"
payload = { "retained": True }
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({retained: true})
};
fetch('https://api.example.com/v1/datasets/{dataset_id}/retention', 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/datasets/{dataset_id}/retention",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'retained' => true
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/v1/datasets/{dataset_id}/retention"
payload := strings.NewReader("{\n \"retained\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://api.example.com/v1/datasets/{dataset_id}/retention")
.header("Content-Type", "application/json")
.body("{\n \"retained\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/datasets/{dataset_id}/retention")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"retained\": true\n}"
response = http.request(request)
puts response.read_bodyDatasets
保持フラグ設定
長期保持フラグの設定/解除。
PUT
/
v1
/
datasets
/
{dataset_id}
/
retention
保持フラグ設定
curl --request PUT \
--url https://api.example.com/v1/datasets/{dataset_id}/retention \
--header 'Content-Type: application/json' \
--data '
{
"retained": true
}
'import requests
url = "https://api.example.com/v1/datasets/{dataset_id}/retention"
payload = { "retained": True }
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({retained: true})
};
fetch('https://api.example.com/v1/datasets/{dataset_id}/retention', 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/datasets/{dataset_id}/retention",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'retained' => true
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/v1/datasets/{dataset_id}/retention"
payload := strings.NewReader("{\n \"retained\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://api.example.com/v1/datasets/{dataset_id}/retention")
.header("Content-Type", "application/json")
.body("{\n \"retained\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/datasets/{dataset_id}/retention")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"retained\": true\n}"
response = http.request(request)
puts response.read_bodyPUT https://api-datahub.octoparse.com/v1/datasets/{dataset_id}/retention
認証:APIキー必須(Authorization: Bearer <API Key>)。
実行結果は作成から既定 90 日保持。保持フラグ付きデータセットは期限クリーンアップ対象外。フラグは明示的ユーザー宣言。読み取りでは延長されず、設定/解除は冪等。
自分のデータセットのみマーク可。他人・公開シード・存在しない id は 404。シードは自分の出力ではなく掃除対象でもないためマーク無意味。マークゲートは可視性より狭い。
リクエスト
パスパラメータ
string
必須
データセット id。
リクエスト body
boolean
必須
保持
true、解除 false。リクエスト例
curl -X PUT -H "Authorization: Bearer $OCTOPARSE_API_KEY" -H "Content-Type: application/json" -d '{"retained": true}' "https://api-datahub.octoparse.com/v1/datasets/ds_0bd5345d13d0/retention"
レスポンス
200 成功
{
"data": {
"dataset_id": "ds_0bd5345d13d0",
"retained": true
}
}
エラー
| HTTP | code | category | Description |
|---|---|---|---|
| 401 | unauthorized | forbidden | API キー欠落または無効。 |
| 404 | dataset-not-found | not_found | データセットが存在しない、自分のものでない、または公開シード(マーク不可)。 |
{"error": {code, category, message, retryable}} です。エラー を参照。
クライアントライブラリ
client.set_dataset_retention("ds_0bd5345d13d0", retained=True)
await client.setDatasetRetention("ds_0bd5345d13d0", true);