Modèles
Modifier un modèle
PUT
/
api
/
v1
/
templates
/
{template}
Modifier un modèle
curl --request PUT \
--url https://{host}/api/v1/templates/{template} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"styles": "a { color: #006C4D; }"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({styles: 'a { color: #006C4D; }'})
};
fetch('https://{host}/api/v1/templates/{template}', 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://{host}/api/v1/templates/{template}",
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([
'styles' => 'a { color: #006C4D; }'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://{host}/api/v1/templates/{template}"
payload = { "styles": "a { color: #006C4D; }" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"editor": "blocks",
"content": "<string>",
"styles": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"message": "Unauthenticated."
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "Le champ email doit être une adresse e-mail valide.",
"errors": {}
}Autorisations
Jeton d'API. Aptitude « read » : routes GET seulement. « read + write » : toutes les routes.
En-têtes
Rejouez une écriture sans risque : la même clé rend la première réponse pendant 24 heures (en-tête Idempotent-Replay: true).
Maximum string length:
255Paramètres de chemin
L'identifiant (uuid) du modèle.
Corps
application/json
Réponse
Le modèle modifié.
Show child attributes
Show child attributes
⌘I
Modifier un modèle
curl --request PUT \
--url https://{host}/api/v1/templates/{template} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"styles": "a { color: #006C4D; }"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({styles: 'a { color: #006C4D; }'})
};
fetch('https://{host}/api/v1/templates/{template}', 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://{host}/api/v1/templates/{template}",
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([
'styles' => 'a { color: #006C4D; }'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://{host}/api/v1/templates/{template}"
payload = { "styles": "a { color: #006C4D; }" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"editor": "blocks",
"content": "<string>",
"styles": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"message": "Unauthenticated."
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "Le champ email doit être une adresse e-mail valide.",
"errors": {}
}