Guardar overlay de traducción
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
Guardar overlay de traducción
Crea o actualiza un overlay de traducción de locale para una app.
PUT
/
v1
/
data-apps
/
{app_id}
/
translations
/
{locale}
Guardar overlay de traducción
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}
Autenticación: se requiere API key (Authorization: Bearer <API Key>). Solo el autor de la app.
Escribe campos de tarjeta y README opcional de un locale. La línea base del hash es el workspace (cae al último release si no hay borrador).
Solicitud
string
requerido
campo
string
requerido
Código de locale.
object
requerido
campo
integer
campo
Ejemplo de solicitud
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"
Respuesta
200 correcto
{
"data": {
"locale": "string",
"origin": "author",
"revision": 0,
"based_on_version": "string",
"based_on_hash": "string",
"stale": false,
"stale_paths": [
"string"
],
"warnings": [
{
"code": "string",
"params": {}
}
]
}
}
Errores
| HTTP | code | category | Descripción |
|---|---|---|---|
| 401 | unauthorized | forbidden | API key ausente o no válida. |
| 404 | *-not-found | not_found | El destino no existe o es invisible para la credencial actual. |
{"error": {code, category, message, retryable}}. Véase Errores.