This directory contains shell scripts for testing all the Task Manager API endpoints. Each script uses curl for HTTP requests and jq for JSON parsing.
api-tests/
├── config.sh # Configuration and helper functions
├── auth/ # Authentication endpoints
│ ├── signup.sh # Create new user account
│ ├── login.sh # Login with email and password
│ ├── resend-otp.sh # Resend OTP to email
│ └── verify-otp.sh # Verify OTP and get tokens
├── user/ # User profile endpoints
│ ├── profile.sh # Get current user's profile
│ ├── get.sh # Get another user's public profile
│ └── update.sh # Update current user's profile
├── task/ # Task management endpoints
│ ├── create.sh # Create a new task
│ ├── list.sh # List all tasks
│ ├── get.sh # Get specific task details
│ ├── update.sh # Update task information
│ └── delete.sh # Delete a task
└── organization/ # Organization management endpoints
├── create.sh # Create a new organization
├── list.sh # List all organizations
├── get.sh # Get organization details
├── update.sh # Update organization information
└── delete.sh # Delete an organization
bash- Shell interpretercurl- Command-line HTTP clientjq- JSON query processor
On macOS (using Homebrew):
brew install curl jqOn Ubuntu/Debian:
sudo apt-get install curl jqOn Windows (using Git Bash):
- Git Bash includes curl
- Install jq from: https://stedolan.github.io/jq/download/
First-time signup:
bash api-tests/auth/signup.shThis creates a new account and sends an OTP to the email. Save the email displayed.
Verify OTP:
bash api-tests/auth/verify-otp.shEnter the OTP you received via email. This will save your access token.
Or Login (if already verified):
bash api-tests/auth/login.shLogs in with email and password, saves the access token.
Resend OTP:
bash api-tests/auth/resend-otp.shRequest a new OTP (useful during development/testing).
Get Current User Profile:
bash api-tests/user/profile.shShows your own profile information including ID, email, name, and verification status.
Get Another User's Profile:
bash api-tests/user/get.shShows another user's public profile (ID, name, creation date). Enter a user ID when prompted.
Update Your Profile:
bash api-tests/user/update.shUpdates your profile information (currently supports name updates).
Create Organization:
bash api-tests/organization/create.shCreates a new organization. The ID is automatically saved.
List Organizations:
bash api-tests/organization/list.shShows all your organizations in a table format.
Get Organization Details:
bash api-tests/organization/get.shShows detailed information about a specific organization.
Update Organization:
bash api-tests/organization/update.shUpdates organization name and/or description.
Delete Organization:
bash api-tests/organization/delete.shDeletes an organization (requires confirmation).
Create Task:
bash api-tests/task/create.shCreates a new task. You'll need an organization ID. The task ID is automatically saved.
List Tasks:
bash api-tests/task/list.shShows all tasks for an organization in table format.
Get Task Details:
bash api-tests/task/get.shShows detailed information about a specific task.
Update Task:
bash api-tests/task/update.shUpdates task title, description, status, or due date.
Delete Task:
bash api-tests/task/delete.shDeletes a task (requires confirmation).
- Access tokens are saved to
/tmp/access_token.txt - Refresh tokens are saved to
/tmp/refresh_token.txt - Scripts automatically use saved tokens for authenticated requests
- Organization IDs are saved to
/tmp/org_id.txt - Task IDs are saved to
/tmp/task_id.txt - You can reuse these without re-entering them
- 🟢 Green: Success messages
- 🔴 Red: Error messages
- 🟡 Yellow: Warning/info messages
- 🔵 Blue: Headers
- All responses are pretty-printed with jq
- Tables format data for easy reading
- Errors are extracted and displayed clearly
Edit config.sh to change:
API_BASE_URL- Default:http://localhost:8080/api/v1CONTENT_TYPE- Default:application/json
API_BASE_URL="http://localhost:8080/api/v1"# 1. Sign up
bash api-tests/auth/signup.sh
# 2. Verify OTP
bash api-tests/auth/verify-otp.sh
# 3. Get your profile
bash api-tests/user/profile.sh
# 4. Update your profile
bash api-tests/user/update.sh
# 5. Create organization
bash api-tests/organization/create.sh
# 6. Create task
bash api-tests/task/create.sh
# 7. List tasks
bash api-tests/task/list.sh
# 8. Update task
bash api-tests/task/update.sh
# 9. Get task details
bash api-tests/task/get.shchmod +x api-tests/**/*.sh
chmod +x api-tests/config.shRun authentication script first:
bash api-tests/auth/login.shInstall jq for your operating system.
Make sure your API server is running:
docker-compose up{
"success": true,
"message": "Operation successful",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"email": "user@example.com"
}
}{
"success": false,
"message": "Error description",
"error_code": "ERROR_CODE",
"details": {
"field": "error details"
}
}- All tokens and IDs are saved to
/tmp/on Linux/macOS or system temp directory on Windows - Scripts are interactive - they prompt for required input
- Optional fields can be skipped by pressing Enter without typing
- Tokens expire after a certain time - you may need to login again
For API documentation, see the project README.