RESTful API để tạo nội dung tự động bằng AI. Tích hợp OpenAI GPT và Google Search để tạo ra những bài viết chất lượng cao.
API sử dụng JWT (JSON Web Token) để xác thực. Sau khi đăng nhập, bạn sẽ nhận được token để sử dụng cho các request khác.
Authorization: Bearer YOUR_JWT_TOKEN_HERE
Đăng ký tài khoản mới
{
"name": "Nguyễn Văn A",
"email": "[email protected]",
"password": "password123",
"confirm_password": "password123"
}
Đăng nhập vào hệ thống
{
"email": "[email protected]",
"password": "password123"
}
Đăng nhập bằng Google OAuth
{
"token": "google_id_token_here"
}
Lấy thông tin profile người dùng
Requires: Authorization headerTạo bài viết mới
{
"keyword": "cách làm bánh cupcake",
"language": "vi",
"tone": "friendly",
"content_suggestion": "Bổ sung thông tin về nguyên liệu..."
}
Tìm kiếm thông tin trên Google
{
"keyword": "cách làm bánh cupcake",
"article_id": "123",
"num_results": 10
}
Tạo outline bằng AI
{
"keyword": "cách làm bánh cupcake",
"language": "vi",
"tone": "friendly",
"content_suggestion": "...",
"article_id": "123"
}
Tạo nội dung bằng AI
{
"article_id": "123",
"keyword": "cách làm bánh cupcake",
"language": "vi",
"tone": "friendly",
"outline": "I. Giới thiệu...",
"content_suggestion": "..."
}
Lấy danh sách bài viết
Lấy cài đặt người dùng
Cập nhật API keys
{
"openai_api_key": "sk-...",
"google_search_api_key": "AIza...",
"google_cse_id": "017..."
}
Cập nhật prompts tùy chỉnh
{
"outline_prompt": "Custom outline prompt...",
"content_prompt": "Custom content prompt..."
}
Code | Status | Mô tả |
---|---|---|
200 | OK | Request thành công |
201 | Created | Tạo mới thành công |
400 | Bad Request | Request không hợp lệ |
401 | Unauthorized | Chưa xác thực |
403 | Forbidden | Không có quyền truy cập |
404 | Not Found | Không tìm thấy resource |
422 | Validation Error | Dữ liệu không hợp lệ |
429 | Rate Limit | Vượt quá giới hạn request |
500 | Server Error | Lỗi máy chủ |
// Đăng nhập
const loginResponse = await fetch('https://dlpanda.net/api/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: '[email protected]',
password: 'password123'
})
});
const loginData = await loginResponse.json();
const token = loginData.data.token;
// Tạo bài viết
const createResponse = await fetch('https://dlpanda.net/api/content/create-article', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
keyword: 'cách làm bánh cupcake',
language: 'vi',
tone: 'friendly'
})
});
const articleData = await createResponse.json();
import requests
# Đăng nhập
login_response = requests.post('https://dlpanda.net/api/auth/login', json={
'email': '[email protected]',
'password': 'password123'
})
token = login_response.json()['data']['token']
# Tạo bài viết
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
article_response = requests.post('https://dlpanda.net/api/content/create-article',
headers=headers,
json={
'keyword': 'cách làm bánh cupcake',
'language': 'vi',
'tone': 'friendly'
}
)
# Đăng nhập
curl -X POST https://dlpanda.net/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"password123"}'
# Tạo bài viết (với token)
curl -X POST https://dlpanda.net/api/content/create-article \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-d '{"keyword":"cách làm bánh cupcake","language":"vi","tone":"friendly"}'