Salva overlay di traduzione
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
Salva overlay di traduzione
Crea o aggiorna un overlay di traduzione locale per un’app.
PUT
/
v1
/
data-apps
/
{app_id}
/
translations
/
{locale}
Salva overlay di traduzione
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}
Autenticazione: API key obbligatoria (Authorization: Bearer <API Key>). Solo autore dell’app.
Scrive i campi della scheda e un README facoltativo per una locale. La base dell’hash è il workspace (con ripiego sull’ultima release). stale=true significa che l’overlay riguarda modifiche del draft non pubblicate. La locale sorgente non può essere usata come destinazione.
Richiesta
string
obbligatorio
campo
string
obbligatorio
Codice locale.
object
obbligatorio
campo
integer
campo
Esempio di richiesta
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"
Risposta
200 successo
{
"data": {
"locale": "string",
"origin": "author",
"revision": 0,
"based_on_version": "string",
"based_on_hash": "string",
"stale": false,
"stale_paths": [
"string"
],
"warnings": [
{
"code": "string",
"params": {}
}
]
}
}
Errori
| HTTP | code | category | Descrizione |
|---|---|---|---|
| 401 | unauthorized | forbidden | API key mancante o non valida. |
| 404 | *-not-found | not_found | Il target non esiste o è invisibile alla credenziale corrente. |
{"error": {code, category, message, retryable}}. Vedi Errori.