Spaces:
Running
Running
π§ͺ API Testing Guide - Using /docs Interface
π Access Your API Documentation
Visit: https://Manjesh501-hackrx.hf.space/docs
You'll see the interactive Swagger UI documentation with all your API endpoints.
π Step-by-Step Testing Guide
1. Basic Endpoints Testing
GET / (Root Endpoint)
- Find the endpoint: Look for
GET /
in the documentation - Click "Try it out" button
- Click "Execute"
- Expected Response:
{
"message": "HackRx 6.0 - Intelligent Query-Retrieval System",
"version": "1.0.0",
"status": "running",
"endpoints": {
"main": "api/v1/hackrx/run",
"legacy": "hackrx/run",
"detailed": "api/v1/hackrx/run/detailed",
"health": "health",
"docs": "docs",
"test": "test"
}
}
GET /health (Health Check)
- Find the endpoint: Look for
GET /health
- Click "Try it out"
- Click "Execute"
- Expected Response:
{
"status": "healthy",
"message": "HackRx 6.0 is running",
"services": {
"query_service": true,
"embedding_service": true,
"llm_service": true,
"pinecone_service": false
}
}
GET /test (Test Endpoint)
- Find the endpoint: Look for
GET /test
- Click "Try it out"
- Click "Execute"
- Expected Response:
{
"message": "Test endpoint working!",
"status": "success",
"app_loaded": true,
"mode": "app.py"
}
2. Main API Endpoints Testing
POST /api/v1/hackrx/run (Main Query Processing)
- Find the endpoint: Look for
POST /api/v1/hackrx/run
- Click "Try it out"
- Fill in the request body:
{
"documents": "https://example.com/document.pdf",
"questions": [
"What is the main topic of this document?",
"What are the key points discussed?"
]
}
- Click "Execute"
- Expected Response: JSON with query results
POST /hackrx/run (Legacy Query Processing)
- Find the endpoint: Look for
POST /hackrx/run
- Click "Try it out"
- Fill in the request body:
{
"query": "What is the main topic of this document?",
"document_url": "https://example.com/document.pdf"
}
- Click "Execute"
- Expected Response: JSON with query results
POST /api/v1/hackrx/run/detailed (Detailed Query Processing)
- Find the endpoint: Look for
POST /api/v1/hackrx/run/detailed
- Click "Try it out"
- Fill in the request body:
{
"documents": "https://example.com/document.pdf",
"questions": [
"What is the main topic of this document?",
"What are the key points discussed?"
]
}
- Click "Execute"
- Expected Response: Detailed JSON with query results and metadata
POST /api/v1/analyze-document (Document Analysis)
- Find the endpoint: Look for
POST /api/v1/analyze-document
- Click "Try it out"
- Fill in the request body:
{
"document_url": "https://example.com/document.pdf"
}
- Click "Execute"
- Expected Response: Document analysis results
POST /api/v1/summarize-document (Document Summarization)
- Find the endpoint: Look for
POST /api/v1/summarize-document
- Click "Try it out"
- Fill in the request body:
{
"document_url": "https://example.com/document.pdf"
}
- Click "Execute"
- Expected Response: Document summary
π― What You'll See in /docs
Interface Elements:
- Endpoint List: All available API endpoints
- Try it out buttons: For interactive testing
- Request/Response Schemas: Shows expected data formats
- Execute buttons: Run the API calls
- Response Section: Shows actual API responses
- Status Codes: HTTP response codes (200, 400, 500, etc.)
Testing Workflow:
- Browse endpoints in the documentation
- Click "Try it out" for any endpoint
- Fill in required parameters (if any)
- Click "Execute" to run the API call
- Review the response in the results section
- Check status codes and response data
π Expected Results
Successful Responses:
- Status Code: 200 OK
- Response: JSON data with results
- Headers: Proper content-type headers
Error Responses:
- Status Code: 400, 404, 500, etc.
- Response: Error message in JSON format
- Example:
{"error": "Invalid request format"}
π Testing Tips
For GET Endpoints:
- No request body needed
- Just click "Try it out" β "Execute"
For POST Endpoints:
- Fill in the request body with JSON
- Use the example schemas provided
- Make sure JSON is properly formatted
Common Test Data:
{
"documents": "https://example.com/document.pdf",
"questions": ["What is this document about?"]
}
Error Testing:
- Try invalid JSON formats
- Test with missing required fields
- Use invalid URLs to test error handling
π Quick Test Checklist
- GET / - Returns app information
- GET /health - Shows healthy status
- GET /test - Returns test success message
- POST /api/v1/hackrx/run - Processes queries
- POST /hackrx/run - Legacy query processing
- POST /api/v1/hackrx/run/detailed - Detailed processing
- POST /api/v1/analyze-document - Document analysis
- POST /api/v1/summarize-document - Document summarization
π Benefits of Using /docs
- Interactive Testing: No need for external tools
- Real-time Results: See responses immediately
- Schema Validation: Automatic format checking
- Error Handling: Clear error messages
- Documentation: Built-in API reference
- Easy Sharing: Share the /docs URL with others
Your API is now fully testable through the interactive documentation! π