| # Test your FastAPI endpoints | |
| GET http://127.0.0.1:8000/ | |
| Accept: application/json | |
| ### Authentication Endpoints | |
| # Register a new user | |
| POST http://127.0.0.1:8000/auth/register | |
| Content-Type: application/json | |
| { | |
| "username": "testuser", | |
| "email": "[email protected]", | |
| "password": "securepassword", | |
| "role": "admin" | |
| } | |
| ### Login Endpoint Test | |
| POST http://127.0.0.1:8000/auth/login | |
| Content-Type: application/json | |
| { | |
| "email": "[email protected]", | |
| "password": "securepassword" | |
| } | |
| ### Farm Management Endpoints | |
| # Create a new group (requires admin role, assuming a token is provided) | |
| POST http://127.0.0.1:8000/groups/ | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| Content-Type: application/json | |
| { | |
| "group_name": "Test Farm Group", | |
| "farmers": [ | |
| "farmer_id_1", | |
| "farmer_id_2" | |
| ], | |
| "created_by": "admin_id" | |
| } | |
| ### Get group by ID | |
| GET http://127.0.0.1:8000/groups/{group_id} | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| ### Update a group | |
| PUT http://127.0.0.1:8000/groups/{group_id} | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| Content-Type: application/json | |
| { | |
| "group_name": "Updated Farm Group" | |
| } | |
| ### Delete a group | |
| DELETE http://127.0.0.1:8000/groups/{group_id} | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| ### Health Records Endpoints | |
| # Log a health record | |
| POST http://127.0.0.1:8000/health/ | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| Content-Type: application/json | |
| { | |
| "farm_id": "test_farm_id", | |
| "disease_type": "Coccidiosis", | |
| "treatment_given": "Anti-coccidial medication", | |
| "logged_by": "admin_id" | |
| } | |
| ### Get health records by farm ID | |
| GET http://127.0.0.1:8000/health/test_farm_id | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| ### Task Management Endpoints | |
| # Create a new task | |
| POST http://127.0.0.1:8000/tasks/ | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| Content-Type: application/json | |
| { | |
| "task_description": "Feed the chickens", | |
| "assigned_to": "farmer_id", | |
| "status": "pending", | |
| "due_date": "2024-12-31T23:59:59Z" | |
| } | |
| ### Get task by ID | |
| GET http://127.0.0.1:8000/tasks/{task_id} | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| # Update a task | |
| PUT http://127.0.0.1:8000/tasks/{task_id} | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| Content-Type: application/json | |
| { | |
| "task_description": "Feed the chickens - updated", | |
| "status": "in-progress" | |
| } | |
| ### Delete a task | |
| DELETE http://127.0.0.1:8000/tasks/{task_id} | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| ### Inventory Management Endpoints | |
| # Add an inventory item | |
| POST http://127.0.0.1:8000/inventory/ | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| Content-Type: application/json | |
| { | |
| "item_name": "Chicken Feed", | |
| "quantity": 100, | |
| "status": "in-stock", | |
| "updated_by": "admin_id" | |
| } | |
| ### Get inventory item by ID | |
| GET http://127.0.0.1:8000/inventory/{item_id} | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| # Update an inventory item | |
| PUT http://127.0.0.1:8000/inventory/{item_id} | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| Content-Type: application/json | |
| { | |
| "quantity": 150, | |
| "status": "in-stock" | |
| } | |
| # Delete an inventory item | |
| DELETE http://127.0.0.1:8000/inventory/{item_id} | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| ### Disease Detection Endpoint | |
| # Predict disease from an uploaded image (replace image.png with actual test image path) | |
| POST http://127.0.0.1:8000/disease_detection/predict_disease/ | |
| Authorization: Bearer {{ACCESS_TOKEN}} | |
| Content-Type: multipart/form-data | |
| --boundary | |
| Content-Disposition: form-data; name="file"; filename="image.png" | |
| Content-Type: image/png | |
| < ./path/to/your/image.png | |
| --boundary-- | |