51 lines
1.2 KiB
Markdown
51 lines
1.2 KiB
Markdown
# Quick API Test Commands
|
|
|
|
## Test from your local machine
|
|
|
|
### 1. Health Check
|
|
```
|
|
curl http://10.0.10.30:6800/health
|
|
```
|
|
|
|
### 2. Ready Check
|
|
```
|
|
curl http://10.0.10.30:6800/ready
|
|
```
|
|
|
|
### 3. Register User
|
|
```
|
|
curl -X POST http://10.0.10.30:6800/api/auth/register \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"email": "test@example.com", "password": "SecurePassword123!", "username": "testuser"}'
|
|
```
|
|
|
|
### 4. Login
|
|
```
|
|
curl -X POST http://10.0.10.30:6800/api/auth/login \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"email": "test@example.com", "password": "SecurePassword123!"}'
|
|
```
|
|
|
|
### 5. Get User Profile (with token)
|
|
```
|
|
TOKEN=$(curl -s -X POST http://10.0.10.30:6800/api/auth/login \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"email": "test@example.com", "password": "SecurePassword123!"}' \
|
|
| jq -r '.access_token')
|
|
|
|
curl http://10.0.10.30:6800/api/users/me \
|
|
-H "Authorization: Bearer $TOKEN"
|
|
```
|
|
|
|
## Test from the server
|
|
```
|
|
cd backend
|
|
./scripts/test-api.sh
|
|
```
|
|
|
|
## Expected Results
|
|
|
|
- Health Check: `+`{"status":"ok"}`+`
|
|
- Ready Check: `+`{"status":"ready"}`+`
|
|
- Register: `+`{"message": "User registered successfully", "user_id": "..."}`+`
|
|
- Login: `+`{"access_token": "...", "refresh_token": "...", "token_type": "bearer"}`+`
|