diff --git a/docs/MIGRATION_GUIDE_v1.md b/docs/MIGRATION_GUIDE_v1.md index 96bc9d856..e10f95be5 100644 --- a/docs/MIGRATION_GUIDE_v1.md +++ b/docs/MIGRATION_GUIDE_v1.md @@ -41,7 +41,7 @@ with get_user_db_session(username="user", password="pass") as session: #### Endpoint Structure - **v0.x**: `/api/v1/quick_summary` -- **v1.0**: `/research/api/start` +- **v1.0**: `/api/start_research` #### Authentication Flow ```python @@ -61,7 +61,7 @@ csrf = session.get("http://localhost:5000/auth/csrf-token").json()["csrf_token"] # 3. Make API requests with CSRF token response = session.post( - "http://localhost:5000/research/api/start", + "http://localhost:5000/api/start_research", json={"query": "test"}, headers={"X-CSRF-Token": csrf} ) @@ -177,7 +177,7 @@ class LDRClient: def start_research(self, query, **kwargs): return self.session.post( - f"{self.base_url}/research/api/start", + f"{self.base_url}/api/start_research", json={"query": query, **kwargs}, headers={"X-CSRF-Token": self.csrf_token} ) diff --git a/docs/api-quickstart.md b/docs/api-quickstart.md index 5a5096495..cc789b8b7 100644 --- a/docs/api-quickstart.md +++ b/docs/api-quickstart.md @@ -85,7 +85,7 @@ csrf_token = csrf_response.json()["csrf_token"] # 4. Make API requests with CSRF header headers = {"X-CSRF-Token": csrf_token} api_response = session.post( - "http://localhost:5000/research/api/start", + "http://localhost:5000/api/start_research", json={ "query": "What is quantum computing?", "model": "gpt-3.5-turbo", @@ -124,12 +124,12 @@ with get_user_db_session(username="your_username", password="your_password") as ### Research Endpoints -All research endpoints are under `/research/api/`: +Research endpoints are under `/api/`: -- `POST /research/api/start` - Start new research -- `GET /research/api/research/{id}/status` - Check research status -- `GET /research/api/research/{id}/result` - Get research results -- `POST /research/api/research/{id}/terminate` - Stop running research +- `POST /api/start_research` - Start new research +- `GET /api/research/{id}/status` - Check research status +- `GET /api/report/{id}` - Get research results +- `POST /api/terminate/{id}` - Stop running research ### Settings Endpoints @@ -152,7 +152,7 @@ Settings endpoints are under `/settings/api/`: 2. **Settings Snapshot**: Programmatic API calls need settings_snapshot parameter 3. **Per-User Databases**: Each user has their own encrypted database 4. **CSRF Protection**: State-changing requests require CSRF token -5. **New Endpoint Structure**: APIs moved under blueprint prefixes (e.g., `/research/api/`) +5. **New Endpoint Structure**: Research APIs are under `/api/` (e.g., `/api/start_research`) ## Example: Complete Research Flow @@ -173,7 +173,7 @@ headers = {"X-CSRF-Token": csrf} # Start research research = session.post( - "http://localhost:5000/research/api/start", + "http://localhost:5000/api/start_research", json={ "query": "Latest advances in quantum computing", "model": "gpt-3.5-turbo", @@ -188,7 +188,7 @@ research_id = research["research_id"] # Poll for results while True: status = session.get( - f"http://localhost:5000/research/api/research/{research_id}/status" + f"http://localhost:5000/api/research/{research_id}/status" ).json() if status["status"] in ["completed", "failed"]: @@ -199,7 +199,7 @@ while True: # Get final results results = session.get( - f"http://localhost:5000/research/api/research/{research_id}/result" + f"http://localhost:5000/api/report/{research_id}" ).json() print(f"Summary: {results['summary']}") diff --git a/examples/api_usage/README.md b/examples/api_usage/README.md index e30b4fb58..de18de94f 100644 --- a/examples/api_usage/README.md +++ b/examples/api_usage/README.md @@ -134,7 +134,7 @@ print(response.json()) 1. **Authentication Required**: All endpoints now require login 2. **Settings Snapshot**: Programmatic API needs `settings_snapshot` parameter -3. **New Endpoints**: API routes moved (e.g., `/api/v1/quick_summary` → `/research/api/start`) +3. **New Endpoints**: API routes moved (e.g., `/api/v1/quick_summary` → `/api/start_research`) 4. **CSRF Protection**: POST/PUT/DELETE requests need CSRF token ### Migration Guide diff --git a/examples/api_usage/UPGRADE_NOTICE.md b/examples/api_usage/UPGRADE_NOTICE.md index 4fbdb5c06..002e55994 100644 --- a/examples/api_usage/UPGRADE_NOTICE.md +++ b/examples/api_usage/UPGRADE_NOTICE.md @@ -56,7 +56,7 @@ with get_user_db_session(username="user", password="pass") as session: - **"No settings context available"**: Pass `settings_snapshot` to API functions - **"Encrypted database requires password"**: Use `get_user_db_session()` with credentials - **"CSRF token missing"**: Get CSRF token before POST/PUT/DELETE requests -- **404 errors**: Check new endpoint paths (e.g., `/research/api/start`) +- **404 errors**: Check new endpoint paths (e.g., `/api/start_research`) ## Need Help? diff --git a/examples/api_usage/http/advanced/http_api_examples.py b/examples/api_usage/http/advanced/http_api_examples.py index 25b9d04c0..d7554079f 100755 --- a/examples/api_usage/http/advanced/http_api_examples.py +++ b/examples/api_usage/http/advanced/http_api_examples.py @@ -139,7 +139,7 @@ class LDRClient: } response = self.session.post( - f"{self.base_url}/research/api/start", + f"{self.base_url}/api/start_research", json=payload, headers=self._get_headers(), ) @@ -152,15 +152,13 @@ class LDRClient: def get_research_status(self, research_id: str) -> Dict[str, Any]: """Get the status of a research task.""" response = self.session.get( - f"{self.base_url}/research/api/research/{research_id}/status" + f"{self.base_url}/api/research/{research_id}/status" ) return response.json() def get_research_result(self, research_id: str) -> Dict[str, Any]: """Get the results of a completed research task.""" - response = self.session.get( - f"{self.base_url}/research/api/research/{research_id}/result" - ) + response = self.session.get(f"{self.base_url}/api/report/{research_id}") return response.json() def wait_for_research( diff --git a/examples/api_usage/http/advanced/simple_http_example.py b/examples/api_usage/http/advanced/simple_http_example.py index b70db0479..edcc96e97 100755 --- a/examples/api_usage/http/advanced/simple_http_example.py +++ b/examples/api_usage/http/advanced/simple_http_example.py @@ -234,9 +234,7 @@ def main(): ) # Get results - results_response = session.get( - f"{API_URL}/research/api/research/{research_id}/result" - ) + results_response = session.get(f"{API_URL}/api/report/{research_id}") if results_response.status_code == 200: results = results_response.json() @@ -286,7 +284,7 @@ def main(): while results_retries < max_results_retries: results_response = session.get( - f"{API_URL}/api/research/{research_id}/report" + f"{API_URL}/api/report/{research_id}" ) if results_response.status_code == 200: