Axuz Developers

POST /me/notes/{noteID}/versions/{versionNum}/restore

Aplica title/body da versão escolhida na nota corrente.

  • Access: Signed in
  • Service: https://api.axuz.net

Accepted authentication

  • sessionCookie — Sessão plena Axuz (cookie de sessão da casa). Sessão restrita é 403 enrollment_required.
  • bearerSession — JWT de acesso da sessão em `Authorization: Bearer`.
  • personalToken — Token pessoal (`axp_...`) criado em `POST /me/api-tokens`; escopo do próprio usuário.

Aplica title/body da versão escolhida na nota corrente.

Motivo: trigger BEFORE UPDATE captura o estado pré-restore em nova versão, então o usuário nunca perde o conteúdo que estava prestes a ser sobrescrito. Filtro deleted_at IS NULL evita restaurar sobre nota na lixeira.

Entradas: userID do JWT; {noteID} e {versionNum} pela URL.

Retorno: 200 com PersonalNote pós-restore; 400 noteID/versionNum inválidos; 401 sem auth; 404 nota/versão inexistentes ou nota na lixeira; 500 erro DB.

Parameters

NameInTypeRequiredDescription
noteIDpathstringyes
versionNumpathstringyes

Request body

Corpo JSON. O schema detalhado deste endpoint ainda não está tipado na spec; veja a descrição da operação.

application/json

NameTypeRequiredDescription
(corpo)objectno
{}

Responses

200

TBD

400

NoteID/versionNum inválidos

NameTypeRequiredDescription
errorstringyes

401

Sem credencial valida

NameTypeRequiredDescription
errorstringyes

404

Nota/versão inexistentes ou nota na lixeira

NameTypeRequiredDescription
errorstringyes

429

Limite de requisições excedido.

NameTypeRequiredDescription
errorstringyes

500

Erro DB

NameTypeRequiredDescription
errorstringyes

Examples

"Try it" is turned off in this reference. Use the examples with your test credential.

curl

curl -sS -X POST 'https://api.axuz.net/me/notes/NOTE_ID/versions/VERSION_NUM/restore' \
  -H "Authorization: Bearer $AXUZ_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Node.js

const res = await fetch("https://api.axuz.net/me/notes/NOTE_ID/versions/VERSION_NUM/restore", {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());

Python

import os
import requests

res = requests.request(
    "POST",
    "https://api.axuz.net/me/notes/NOTE_ID/versions/VERSION_NUM/restore",
    headers={
        "Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
    },
    json={},
    timeout=30,
)
res.raise_for_status()
print(res.json())