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>"
}Modifier un brouillon de contenu
Applique des modifications exactes par recherche-remplacement au corps de l’article d’un brouillon. Déterministe, sans modèle d’IA : votre texte de remplacement est inséré tel quel (utilisez l’endpoint revise pour une réécriture IA à partir d’une instruction). Le texte à rechercher doit apparaître exactement une fois dans le corps actuel ; zéro ou plusieurs correspondances font échouer tout l’appel avec 400 et rien n’est enregistré. Allongez donc le texte recherché jusqu’à le rendre unique. Les modifications s’appliquent dans l’ordre, les suivantes voient les résultats précédents et le lot est enregistré comme une seule nouvelle version, récupérable via les endpoints de versions. Transmettez expected_version_number depuis l’endpoint de brouillon pour obtenir 409 si une nouvelle version a été enregistrée après votre lecture (révision, modification ou restauration). L’enregistrement automatique de l’application modifie le corps sans créer de version ; cette divergence est détectée par les points de recherche eux-mêmes, car un texte déplacé ou disparu fait échouer l’appel.
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>"
}Paramètres de chemin
Corps
Cette page vous a-t-elle été utile ?