Making Requests
Using the Postman Collection
Petal App Manager includes a comprehensive Postman collection with pre-configured requests for all petals and proxies.
Files Included:
PetalAppManager.postman_collection.json- Complete API collectionlocal_petal-app-manager.postman_environment.json- Environment variables
Setup:
Import Collection:
Open Postman
Click Import → Upload Files
Select
PetalAppManager.postman_collection.json
Import Environment:
Import
local_petal-app-manager.postman_environment.jsonSet as active environment (top-right dropdown)
Environment Variables:
{ "API_URL": "http://localhost:9000", "org_id": "e8fc2cd9-f040-4229-84c0-62ea693b99f6", "device_id": "Instance-a92c5505-ccdb-4ac7-b0fe-74f4fa5fc5b9" }
Collection Structure:
petal-leafsdk - Mission planning and execution
petal-flight-log - Flight log management and downloads
petal-warehouse - Data warehousing operations
petal-user-journey-coordinator - User journey management
Cloud - Cloud data operations
bucket - S3 bucket operations
mqtt - MQTT client operations
mavftp - MAVLink file transfer
Quick Test:
Select Health Check request
Click Send
Verify response:
{"status": "ok"}
Using the /docs Interface
Accessing Swagger UI
Primary Interface:
Features:
Interactive API documentation
Built-in request testing
Real-time response validation
Automatic request formatting
Interactive API Testing
1. Basic Health Check:
Navigate to default section
Click GET /health
Click “Try it out” → “Execute”
View response:
{"status": "ok"}
2. Detailed Health Check:
Find GET /health/detailed
Click “Try it out” → “Execute”
View detailed proxy status and petal information
3. Petal Requests:
Expand petal sections (e.g., petal-flight-log)
Select an endpoint (e.g., GET /petals/petal-flight-log/flight-records)
Click “Try it out” → “Execute”
View petal-specific responses
4. Admin Controls:
Navigate to petal-proxies-control section
Test GET /api/petal-proxies-control/status
Use POST endpoints to enable/disable components
5. Request Body Examples:
For POST requests with JSON bodies:
{
"petals": ["flight_records"],
"action": "ON"
}
Using ReDoc
Alternative Documentation:
Benefits:
Clean, readable API documentation
Better for reference and understanding
Hierarchical organization
Detailed schema descriptions
Use Cases:
Understanding API structure
Reading detailed endpoint descriptions
Viewing request/response schemas
API reference during development
Example API Calls
Health Check:
curl http://localhost:9000/health
Detailed Health:
curl http://localhost:9000/health/detailed
System Status:
curl http://localhost:9000/api/petal-proxies-control/status
Enable Petal:
curl -X POST "http://localhost:9000/api/petal-proxies-control/petals/control" \
-H "Content-Type: application/json" \
-d '{"petals": ["flight_records"], "action": "ON"}'
Flight Records:
curl http://localhost:9000/petals/petal-flight-log/flight-records
Mission Planning:
curl -X POST "http://localhost:9000/petals/petal-mission-planner/mission/plan" \
-H "Content-Type: application/json" \
-d '{"mission_data": "example"}'
Cloud Operations:
curl -X POST "http://localhost:9000/cloud/scan-table" \
-H "Content-Type: application/json" \
-d '{"table_name": "example"}'
Quick Testing Workflow
1. Verify System:
# Basic health
curl http://localhost:9000/health
# Detailed status
curl http://localhost:9000/health/detailed
2. Check Configuration:
# Current config
curl http://localhost:9000/api/petal-proxies-control/status
# All components
curl http://localhost:9000/api/petal-proxies-control/components/list
3. Test Petal Endpoints:
# Flight records
curl http://localhost:9000/petals/petal-flight-log/flight-records
# Available logs
curl http://localhost:9000/petals/petal-flight-log/available-ulogs
4. Use Interactive Interface:
Visit http://localhost:9000/docs for graphical testing
Use http://localhost:9000/admin-dashboard for system management
Tip
Best Practice: Start with the Admin Dashboard (http://localhost:9000/admin-dashboard) to understand system status, then use Swagger UI (http://localhost:9000/docs) for detailed API testing.