翻訳を保存
curl --request PUT \
--url https://api.example.com/v1/data-apps/{app_id}/translations/{locale} \
--header 'Content-Type: application/json' \
--data '
{
"entries": {},
"expected_revision": 123
}
'import requests
url = "https://api.example.com/v1/data-apps/{app_id}/translations/{locale}"
payload = {
"entries": {},
"expected_revision": 123
}
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({entries: {}, expected_revision: 123})
};
fetch('https://api.example.com/v1/data-apps/{app_id}/translations/{locale}', 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/data-apps/{app_id}/translations/{locale}",
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([
'entries' => [
],
'expected_revision' => 123
]),
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/data-apps/{app_id}/translations/{locale}"
payload := strings.NewReader("{\n \"entries\": {},\n \"expected_revision\": 123\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/data-apps/{app_id}/translations/{locale}")
.header("Content-Type", "application/json")
.body("{\n \"entries\": {},\n \"expected_revision\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/data-apps/{app_id}/translations/{locale}")
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 \"entries\": {},\n \"expected_revision\": 123\n}"
response = http.request(request)
puts response.read_bodyPublishing
翻訳を保存
App のロケール翻訳オーバーレイを作成/更新。
PUT
/
v1
/
data-apps
/
{app_id}
/
translations
/
{locale}
翻訳を保存
curl --request PUT \
--url https://api.example.com/v1/data-apps/{app_id}/translations/{locale} \
--header 'Content-Type: application/json' \
--data '
{
"entries": {},
"expected_revision": 123
}
'import requests
url = "https://api.example.com/v1/data-apps/{app_id}/translations/{locale}"
payload = {
"entries": {},
"expected_revision": 123
}
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({entries: {}, expected_revision: 123})
};
fetch('https://api.example.com/v1/data-apps/{app_id}/translations/{locale}', 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/data-apps/{app_id}/translations/{locale}",
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([
'entries' => [
],
'expected_revision' => 123
]),
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/data-apps/{app_id}/translations/{locale}"
payload := strings.NewReader("{\n \"entries\": {},\n \"expected_revision\": 123\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/data-apps/{app_id}/translations/{locale}")
.header("Content-Type", "application/json")
.body("{\n \"entries\": {},\n \"expected_revision\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/data-apps/{app_id}/translations/{locale}")
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 \"entries\": {},\n \"expected_revision\": 123\n}"
response = http.request(request)
puts response.read_bodyPUT https://api-datahub.octoparse.com/v1/data-apps/{app_id}/translations/{locale}
認証:APIキー必須(Authorization: Bearer <API Key>)。 App 作者のみ。
1 ロケールのカード欄と任意 README を書く。ハッシュ基準はワークスペース(なければ最新 Release)。stale=true は未公開下書き向け。ソースロケールはここでは上書き不可。
リクエスト
string
必須
field
string
必須
Locale code.
object
必須
field
integer
field
リクエスト例
curl -X PUT \
-H "Authorization: Bearer $OCTOPARSE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"entries": {"identity.name": "Product Review Lookup", "identity.summary": "Fetch public reviews by product id"}, "readme": "# Product Review Lookup\n…"}' \
"https://api-datahub.octoparse.com/v1/data-apps/carol/reviews-query/translations/en"
レスポンス
200 成功
{
"data": {
"locale": "string",
"origin": "author",
"revision": 0,
"based_on_version": "string",
"based_on_hash": "string",
"stale": false,
"stale_paths": [
"string"
],
"warnings": [
{
"code": "string",
"params": {}
}
]
}
}
エラー
| HTTP | code | category | Description |
|---|---|---|---|
| 401 | unauthorized | forbidden | API キー欠落または無効。 |
| 404 | *-not-found | not_found | 対象が存在しないか、現資格から不可視。 |
{"error": {code, category, message, retryable}} です。エラー を参照。