APIs Mementos¶
Mementos cho phép người dùng định nghĩa các bộ sưu tập tài liệu có thể được truy cập bởi các ứng dụng. Tài liệu này phác thảo các API Memento có sẵn.
Danh sách Memento¶
GET /mementos/¶
Ví dụ Yêu cầu¶
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn.
const fetchMementos = async () => {
const response = await fetch('https://api.rememberizer.ai/api/v1/mementos/', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN'
}
});
const data = await response.json();
console.log(data);
};
fetchMementos();
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn.
import requests
def fetch_mementos():
headers = {
"Authorization": "Bearer YOUR_JWT_TOKEN"
}
response = requests.get(
"https://api.rememberizer.ai/api/v1/mementos/",
headers=headers
)
data = response.json()
print(data)
fetch_mementos()
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn.
Tạo Memento¶
POST /mementos/¶
Ví dụ Yêu Cầu¶
curl -X POST
https://api.rememberizer.ai/api/v1/mementos/
-H "Authorization: Bearer YOUR_JWT_TOKEN"
-H "Content-Type: application/json"
-d '{"name": "Tài liệu Công việc"}'
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn.
const createMemento = async () => {
const response = await fetch('https://api.rememberizer.ai/api/v1/mementos/', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Tài liệu Công việc'
})
});
const data = await response.json();
console.log(data);
};
createMemento();
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn.
import requests
import json
def create_memento():
headers = {
"Authorization": "Bearer YOUR_JWT_TOKEN",
"Content-Type": "application/json"
}
payload = {
"name": "Tài liệu Công việc"
}
response = requests.post(
"https://api.rememberizer.ai/api/v1/mementos/",
headers=headers,
data=json.dumps(payload)
)
data = response.json()
print(data)
create_memento()
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn.
Lấy Chi Tiết Memento¶
GET /mementos/{id}/¶
Ví dụ Yêu cầu¶
curl -X GET
https://api.rememberizer.ai/api/v1/mementos/123/
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn và 123 bằng ID memento thực tế.
const getMementoDetails = async (mementoId) => {
const response = await fetch(`https://api.rememberizer.ai/api/v1/mementos/${mementoId}/`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN'
}
});
const data = await response.json();
console.log(data);
};
getMementoDetails(123);
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn và 123 bằng ID memento thực tế.
import requests
def get_memento_details(memento_id):
headers = {
"Authorization": "Bearer YOUR_JWT_TOKEN"
}
response = requests.get(
f"https://api.rememberizer.ai/api/v1/mementos/{memento_id}/",
headers=headers
)
data = response.json()
print(data)
get_memento_details(123)
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn và 123 bằng ID memento thực tế.
Quản lý Tài liệu Memento¶
POST /mementos/memento_document/{memento_id}/¶
Ví dụ Yêu cầu¶
curl -X POST
https://api.rememberizer.ai/api/v1/mementos/memento_document/123/
-H "Authorization: Bearer YOUR_JWT_TOKEN"
-H "Content-Type: application/json"
-d '{
"memento": "123",
"add": ["document_id_1", "document_id_2"],
"folder_add": ["folder_id_1"],
"remove": ["document_id_3"]
}'
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn và sử dụng các ID tài liệu và thư mục thực tế.
const manageMementoDocuments = async (mementoId) => {
const response = await fetch(`https://api.rememberizer.ai/api/v1/mementos/memento_document/${mementoId}/`, {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
memento: mementoId,
add: ["document_id_1", "document_id_2"],
folder_add: ["folder_id_1"],
remove: ["document_id_3"]
})
});
const data = await response.json();
console.log(data);
};
manageMementoDocuments(123);
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn và sử dụng các ID tài liệu và thư mục thực tế.
import requests
import json
def manage_memento_documents(memento_id):
headers = {
"Authorization": "Bearer YOUR_JWT_TOKEN",
"Content-Type": "application/json"
}
payload = {
"memento": memento_id,
"add": ["document_id_1", "document_id_2"],
"folder_add": ["folder_id_1"],
"remove": ["document_id_3"]
}
response = requests.post(
f"https://api.rememberizer.ai/api/v1/mementos/memento_document/{memento_id}/",
headers=headers,
data=json.dumps(payload)
)
data = response.json()
print(data)
manage_memento_documents(123)
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn và sử dụng các ID tài liệu và thư mục thực tế.
Xóa Memento¶
DELETE /mementos/{id}/¶
Ví dụ Yêu cầu¶
curl -X DELETE
https://api.rememberizer.ai/api/v1/mementos/123/
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn và 123 bằng ID memento thực tế.
const deleteMemento = async (mementoId) => {
const response = await fetch(`https://api.rememberizer.ai/api/v1/mementos/${mementoId}/`, {
method: 'DELETE',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN'
}
});
if (response.status === 204) {
console.log("Memento đã được xóa thành công");
} else {
console.error("Xóa memento không thành công");
}
};
deleteMemento(123);
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn và 123 bằng ID memento thực tế.
import requests
def delete_memento(memento_id):
headers = {
"Authorization": "Bearer YOUR_JWT_TOKEN"
}
response = requests.delete(
f"https://api.rememberizer.ai/api/v1/mementos/{memento_id}/",
headers=headers
)
if response.status_code == 204:
print("Memento đã được xóa thành công")
else:
print("Xóa memento không thành công")
delete_memento(123)
Info
Để thử nghiệm cuộc gọi API này, hãy thay thế YOUR_JWT_TOKEN bằng mã thông báo JWT thực tế của bạn và 123 bằng ID memento thực tế.