http://localhost:5000/api
POST /auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123"
}Response:
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "user_id",
"name": "اسم المستخدم",
"email": "user@example.com",
"role": "patient"
}
}POST /auth/register
Content-Type: application/json
{
"name": "اسم المستخدم",
"email": "user@example.com",
"password": "password123",
"phone": "01234567890",
"role": "patient"
}PUT /auth/change-password
Authorization: Bearer <token>
Content-Type: application/json
{
"currentPassword": "old_password",
"newPassword": "new_password"
}GET /users/profile
Authorization: Bearer <token>PUT /users/profile
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "الاسم الجديد",
"phone": "01234567890",
"address": "العنوان الجديد"
}DELETE /users/profile
Authorization: Bearer <token>GET /doctorsQuery Parameters:
specialty- التخصصlocation- الموقعrating- التقييمpage- رقم الصفحةlimit- عدد النتائج
Response:
{
"success": true,
"doctors": [
{
"id": "doctor_id",
"name": "د. أحمد محمد",
"specialty": "أمراض القلب",
"rating": 4.8,
"experience": 10,
"location": "القاهرة",
"price": 200,
"image": "doctor_image_url"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 50,
"pages": 5
}
}GET /doctors/:idPOST /doctors
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "د. أحمد محمد",
"specialty": "أمراض القلب",
"experience": 10,
"location": "القاهرة",
"price": 200,
"description": "وصف الطبيب",
"education": "تعليم الطبيب",
"certifications": ["شهادة 1", "شهادة 2"]
}PUT /doctors/:id
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "الاسم الجديد",
"specialty": "التخصص الجديد",
"price": 250
}DELETE /doctors/:id
Authorization: Bearer <token>POST /bookings
Authorization: Bearer <token>
Content-Type: application/json
{
"doctorId": "doctor_id",
"date": "2024-01-15",
"time": "10:00",
"type": "normal",
"notes": "ملاحظات إضافية"
}GET /bookings
Authorization: Bearer <token>Query Parameters:
status- حالة الحجز (pending, confirmed, completed, cancelled)page- رقم الصفحةlimit- عدد النتائج
GET /bookings/:id
Authorization: Bearer <token>PUT /bookings/:id/status
Authorization: Bearer <token>
Content-Type: application/json
{
"status": "confirmed"
}DELETE /bookings/:id
Authorization: Bearer <token>POST /reviews
Authorization: Bearer <token>
Content-Type: application/json
{
"doctorId": "doctor_id",
"bookingId": "booking_id",
"rating": 5,
"comment": "تعليق على الطبيب"
}GET /doctors/:id/reviewsPUT /reviews/:id
Authorization: Bearer <token>
Content-Type: application/json
{
"rating": 4,
"comment": "التعليق المحدث"
}DELETE /reviews/:id
Authorization: Bearer <token>GET /notifications
Authorization: Bearer <token>PUT /notifications/:id/read
Authorization: Bearer <token>DELETE /notifications/:id
Authorization: Bearer <token>GET /admin/stats
Authorization: Bearer <token>Response:
{
"success": true,
"stats": {
"totalUsers": 1000,
"totalDoctors": 50,
"totalBookings": 5000,
"totalRevenue": 100000,
"monthlyStats": {
"users": 100,
"doctors": 5,
"bookings": 500,
"revenue": 10000
}
}
}GET /doctors/stats
Authorization: Bearer <token>GET /specialtiesPOST /specialties
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "أمراض القلب",
"description": "وصف التخصص"
}PUT /specialties/:id
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "الاسم الجديد",
"description": "الوصف الجديد"
}DELETE /specialties/:id
Authorization: Bearer <token>POST /bookings/:id/qr
Authorization: Bearer <token>Response:
{
"success": true,
"qrCode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}POST /qr/scan
Authorization: Bearer <token>
Content-Type: application/json
{
"qrData": "booking_data_from_qr_code"
}POST /bookings/:id/pdf
Authorization: Bearer <token>Response:
{
"success": true,
"pdfUrl": "http://localhost:5000/uploads/booking_123.pdf"
}GET /search/doctorsQuery Parameters:
q- كلمة البحثspecialty- التخصصlocation- الموقعminPrice- الحد الأدنى للسعرmaxPrice- الحد الأقصى للسعرrating- الحد الأدنى للتقييم
POST /notifications/email
Authorization: Bearer <token>
Content-Type: application/json
{
"to": "user@example.com",
"subject": "موضوع الرسالة",
"message": "محتوى الرسالة"
}| الكود | المعنى |
|---|---|
| 200 | نجح الطلب |
| 201 | تم الإنشاء بنجاح |
| 400 | طلب غير صحيح |
| 401 | غير مصرح |
| 403 | ممنوع |
| 404 | غير موجود |
| 409 | تعارض |
| 500 | خطأ في الخادم |
Authorization: Bearer <jwt_token>
Content-Type: application/json- 100 طلب في الدقيقة للمستخدمين العاديين
- 1000 طلب في الدقيقة للمديرين
// المسموح
Origin: http://localhost:3000
Origin: http://localhost:3001
Origin: http://localhost:3002// تسجيل الدخول
const login = async (email, password) => {
const response = await fetch('http://localhost:5000/api/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ email, password })
});
const data = await response.json();
return data;
};
// الحصول على الأطباء
const getDoctors = async (token) => {
const response = await fetch('http://localhost:5000/api/doctors', {
headers: {
'Authorization': `Bearer ${token}`
}
});
const data = await response.json();
return data;
};import axios from 'axios';
const api = axios.create({
baseURL: 'http://localhost:5000/api',
headers: {
'Content-Type': 'application/json'
}
});
// إضافة Token للطلبات
api.interceptors.request.use((config) => {
const token = localStorage.getItem('token');
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
});
// تسجيل الدخول
const login = async (email, password) => {
const response = await api.post('/auth/login', { email, password });
return response.data;
};# تسجيل الدخول
curl -X POST http://localhost:5000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "password123"}'
# الحصول على الأطباء
curl -X GET http://localhost:5000/api/doctors \
-H "Authorization: Bearer <token>"
# إنشاء حجز
curl -X POST http://localhost:5000/api/bookings \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"doctorId": "doctor_id", "date": "2024-01-15", "time": "10:00"}'{
"info": {
"name": "BookDoc API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Auth",
"item": [
{
"name": "Login",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"user@example.com\",\n \"password\": \"password123\"\n}"
},
"url": {
"raw": "{{baseUrl}}/auth/login",
"host": ["{{baseUrl}}"],
"path": ["auth", "login"]
}
}
}
]
}
]
}للمساعدة في استخدام API:
- راجع ملف
README.mdللحصول على دليل شامل - راجع ملف
DEVELOPMENT.mdللتطوير - راجع ملف
DEPLOYMENT.mdللنشر