Restore a page-document version
Requires the configured page-editor feature (spaces by default) and current subject/page access. Workspace pages use a null subject; subject pages inherit their space access. Only page-owned documents are supported. Document and owner UUIDs must belong to the authenticated tenant. Writes the chosen snapshot as a new revision through the normal save rules, with a restoration label. base_revision is optional; supply it to detect a concurrent save. Mentions the actor cannot insert are removed and counted.
curl --request POST \
--url https://api.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"base_revision": 2
}
'import requests
url = "https://api.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore"
payload = { "base_revision": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({base_revision: 2})
};
fetch('https://api.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore', 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.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore",
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([
'base_revision' => 2
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore"
payload := strings.NewReader("{\n \"base_revision\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base_revision\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"base_revision\": 2\n}"
response = http.request(request)
puts response.read_body{
"data": {
"uuid": "<string>",
"owner_type": "<string>",
"owner_uuid": "<string>",
"profile": "<string>",
"revision": 123,
"updated_by": 123,
"updated_at": "2023-11-07T05:31:56Z",
"can_edit": true,
"can_manage_html": true,
"document": {
"type": "doc",
"content": [
{
"type": "paragraph",
"attrs": {
"id": "018fd5a0-1331-7000-8000-000000000123"
},
"content": [
{
"type": "text",
"text": "Program update"
}
]
}
]
},
"mentions_not_restored": 123
}
}{
"message": "Unauthorized",
"status": "error"
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"message": "Not Found",
"status": "error"
}{
"message": "<string>",
"code": "<string>",
"current_revision": 123
}{
"message": "<string>",
"code": "invalid_document",
"errors": [
{
"path": "<string>",
"message": "<string>"
}
]
}Authorizations
Passport bearer token authentication for legacy admin sessions.
Body
Request fields accepted by this operation. Omitted optional properties retain the behavior described above.
Validation: nullable|integer|min:1.
x >= 1Response
Restore a page-document version response.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"base_revision": 2
}
'import requests
url = "https://api.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore"
payload = { "base_revision": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({base_revision: 2})
};
fetch('https://api.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore', 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.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore",
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([
'base_revision' => 2
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore"
payload := strings.NewReader("{\n \"base_revision\": 2\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base_revision\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/page-documents/{document}/versions/{version}/restore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"base_revision\": 2\n}"
response = http.request(request)
puts response.read_body{
"data": {
"uuid": "<string>",
"owner_type": "<string>",
"owner_uuid": "<string>",
"profile": "<string>",
"revision": 123,
"updated_by": 123,
"updated_at": "2023-11-07T05:31:56Z",
"can_edit": true,
"can_manage_html": true,
"document": {
"type": "doc",
"content": [
{
"type": "paragraph",
"attrs": {
"id": "018fd5a0-1331-7000-8000-000000000123"
},
"content": [
{
"type": "text",
"text": "Program update"
}
]
}
]
},
"mentions_not_restored": 123
}
}{
"message": "Unauthorized",
"status": "error"
}{
"message": "Something went wrong. Please try again.",
"status": "error",
"error": "invalid_request",
"code": "DONOR_NOT_FOUND"
}{
"message": "Not Found",
"status": "error"
}{
"message": "<string>",
"code": "<string>",
"current_revision": 123
}{
"message": "<string>",
"code": "invalid_document",
"errors": [
{
"path": "<string>",
"message": "<string>"
}
]
}