シークレットの作成・更新
curl --request PUT \
--url https://api.example.com/v1/secrets/{name} \
--header 'Content-Type: application/json' \
--data '
{
"value": "<string>"
}
'import requests
url = "https://api.example.com/v1/secrets/{name}"
payload = { "value": "<string>" }
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({value: '<string>'})
};
fetch('https://api.example.com/v1/secrets/{name}', 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/secrets/{name}",
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([
'value' => '<string>'
]),
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/secrets/{name}"
payload := strings.NewReader("{\n \"value\": \"<string>\"\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/secrets/{name}")
.header("Content-Type", "application/json")
.body("{\n \"value\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/secrets/{name}")
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 \"value\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"mask": "<string>",
"updated_at": "<string>"
}Secrets
シークレットの作成・更新
シークレット値を書き込み。
PUT
/
v1
/
secrets
/
{name}
シークレットの作成・更新
curl --request PUT \
--url https://api.example.com/v1/secrets/{name} \
--header 'Content-Type: application/json' \
--data '
{
"value": "<string>"
}
'import requests
url = "https://api.example.com/v1/secrets/{name}"
payload = { "value": "<string>" }
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({value: '<string>'})
};
fetch('https://api.example.com/v1/secrets/{name}', 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/secrets/{name}",
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([
'value' => '<string>'
]),
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/secrets/{name}"
payload := strings.NewReader("{\n \"value\": \"<string>\"\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/secrets/{name}")
.header("Content-Type", "application/json")
.body("{\n \"value\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/secrets/{name}")
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 \"value\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"mask": "<string>",
"updated_at": "<string>"
}PUT https://api-datahub.octoparse.com/v1/secrets/{name}
認証:APIキー必須(Authorization: Bearer <API Key>)。
上流資格情報シークレットを作成またはローテーション。平文は書き込み時のみ。読み取りでは返さない。
リクエスト
パスパラメータ
string
必須
シークレット名。英数字とアンダースコア。App からは
env.<name>。リクエスト body
string
必須
平文シークレット値。
リクエスト例
curl -X PUT -H "Authorization: Bearer $OCTOPARSE_API_KEY" -H "Content-Type: application/json" -d '{"value": "sk-live-example"}' "https://api-datahub.octoparse.com/v1/secrets/EXAMPLE_API_KEY"
レスポンス
200 成功
{
"data": {
"name": "EXAMPLE_API_KEY",
"mask": "sk-****mple",
"updated_at": "2026-09-01T08:00:00+00:00"
}
}
data に包まれます。フィールド:
string
必須
Secret name.
string
必須
書き込み後のマスク値。
string
必須
更新時刻(ISO 8601)。
エラー
| HTTP | code | category | Description |
|---|---|---|---|
| 400 | invalid-input | invalid_input | 名前または値が無効。 |
| 401 | unauthorized | forbidden | API キー欠落または無効。 |
{"error": {code, category, message, retryable}} です。エラー を参照。