curl --request POST \
--url https://api.athenahq.ai/api/v1/content/{content_id}/edit \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"website_id": "<string>",
"edits": [
{
"find": "<string>",
"replace": "<string>"
}
],
"expected_version_number": 2
}
'import requests
url = "https://api.athenahq.ai/api/v1/content/{content_id}/edit"
payload = {
"website_id": "<string>",
"edits": [
{
"find": "<string>",
"replace": "<string>"
}
],
"expected_version_number": 2
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
website_id: '<string>',
edits: [{find: '<string>', replace: '<string>'}],
expected_version_number: 2
})
};
fetch('https://api.athenahq.ai/api/v1/content/{content_id}/edit', 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.athenahq.ai/api/v1/content/{content_id}/edit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'website_id' => '<string>',
'edits' => [
[
'find' => '<string>',
'replace' => '<string>'
]
],
'expected_version_number' => 2
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.athenahq.ai/api/v1/content/{content_id}/edit"
payload := strings.NewReader("{\n \"website_id\": \"<string>\",\n \"edits\": [\n {\n \"find\": \"<string>\",\n \"replace\": \"<string>\"\n }\n ],\n \"expected_version_number\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.post("https://api.athenahq.ai/api/v1/content/{content_id}/edit")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"website_id\": \"<string>\",\n \"edits\": [\n {\n \"find\": \"<string>\",\n \"replace\": \"<string>\"\n }\n ],\n \"expected_version_number\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.athenahq.ai/api/v1/content/{content_id}/edit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"website_id\": \"<string>\",\n \"edits\": [\n {\n \"find\": \"<string>\",\n \"replace\": \"<string>\"\n }\n ],\n \"expected_version_number\": 2\n}"
response = http.request(request)
puts response.read_body{
"content_id": "<string>",
"body": "<string>",
"version_number": 123,
"version_id": "<string>",
"body_word_count": 123,
"previous_body_word_count": 123
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Editar borrador de contenido
Aplica sustituciones exactas al cuerpo del borrador de un artículo. Es determinista, sin IA: el texto de reemplazo se inserta literalmente (usa revise si quieres una reescritura por instrucciones). El texto buscado de cada edición debe aparecer exactamente una vez; cero o varias coincidencias hacen fallar toda la llamada con 400 sin guardar nada. Amplíalo hasta hacerlo único. Las ediciones se aplican en orden y ven los resultados anteriores; el lote se registra como una nueva versión recuperable. Pasa expected_version_number del endpoint de borrador para recibir 409 si hay una nueva versión desde tu lectura (revisión, edición o restauración). El autoguardado cambia el cuerpo sin crear versión, pero las anclas detectan la divergencia si el texto buscado ha cambiado o desaparecido.
curl --request POST \
--url https://api.athenahq.ai/api/v1/content/{content_id}/edit \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"website_id": "<string>",
"edits": [
{
"find": "<string>",
"replace": "<string>"
}
],
"expected_version_number": 2
}
'import requests
url = "https://api.athenahq.ai/api/v1/content/{content_id}/edit"
payload = {
"website_id": "<string>",
"edits": [
{
"find": "<string>",
"replace": "<string>"
}
],
"expected_version_number": 2
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
website_id: '<string>',
edits: [{find: '<string>', replace: '<string>'}],
expected_version_number: 2
})
};
fetch('https://api.athenahq.ai/api/v1/content/{content_id}/edit', 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.athenahq.ai/api/v1/content/{content_id}/edit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'website_id' => '<string>',
'edits' => [
[
'find' => '<string>',
'replace' => '<string>'
]
],
'expected_version_number' => 2
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.athenahq.ai/api/v1/content/{content_id}/edit"
payload := strings.NewReader("{\n \"website_id\": \"<string>\",\n \"edits\": [\n {\n \"find\": \"<string>\",\n \"replace\": \"<string>\"\n }\n ],\n \"expected_version_number\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.post("https://api.athenahq.ai/api/v1/content/{content_id}/edit")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"website_id\": \"<string>\",\n \"edits\": [\n {\n \"find\": \"<string>\",\n \"replace\": \"<string>\"\n }\n ],\n \"expected_version_number\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.athenahq.ai/api/v1/content/{content_id}/edit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"website_id\": \"<string>\",\n \"edits\": [\n {\n \"find\": \"<string>\",\n \"replace\": \"<string>\"\n }\n ],\n \"expected_version_number\": 2\n}"
response = http.request(request)
puts response.read_body{
"content_id": "<string>",
"body": "<string>",
"version_number": 123,
"version_id": "<string>",
"body_word_count": 123,
"previous_body_word_count": 123
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Parámetros de ruta
Cuerpo
¿Esta página le ayudó?