orio-search/quick_test.http
2026-03-06 22:24:54 +05:30

540 lines
9.7 KiB
HTTP

### ============================================
### OrioSearch API - REST Client Tests
### ============================================
### Requires VS Code extension: REST Client (humao.rest-client)
### Start the stack first: docker compose up --build
@baseUrl = http://localhost:8000
@apiKey = your-secret-key-here
### ============================================
### Health & Info
### ============================================
### Health Check
GET {{baseUrl}}/health
###
### OpenAPI JSON spec
GET {{baseUrl}}/openapi.json
###
### LLM Tool Schema (OpenAI function-calling format)
GET {{baseUrl}}/tool-schema
###
### ============================================
### SEARCH - Basic
### ============================================
### Basic search (fast, snippets only)
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "python fastapi tutorial",
"max_results": 5
}
###
### Search with topic = news
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "artificial intelligence",
"topic": "news",
"max_results": 5
}
###
### Search with time range filter
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "latest python release",
"time_range": "week",
"max_results": 3
}
###
### Minimal search (just query, all defaults)
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "what is docker"
}
###
### ============================================
### SEARCH - Advanced (with content extraction)
### ============================================
### Advanced search - fetches and extracts full page content
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "how to use docker compose",
"search_depth": "advanced",
"max_results": 3
}
###
### Search with include_raw_content (basic depth + extracted content)
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "redis caching best practices",
"include_raw_content": true,
"max_results": 2
}
###
### ============================================
### SEARCH - Images
### ============================================
### Search with images
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "cute cats",
"include_images": true,
"max_results": 5
}
###
### Advanced search with images and extraction
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "machine learning architecture diagrams",
"search_depth": "advanced",
"include_images": true,
"max_results": 3
}
###
### ============================================
### SEARCH - Domain Filters
### ============================================
### Include only specific domains
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "python async",
"include_domains": ["docs.python.org", "realpython.com"],
"max_results": 5
}
###
### Exclude specific domains
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "javascript frameworks 2026",
"exclude_domains": ["medium.com", "w3schools.com"],
"max_results": 5
}
###
### ============================================
### SEARCH - Full featured (all params)
### ============================================
### Everything combined
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "self hosted search engine",
"search_depth": "advanced",
"topic": "general",
"max_results": 5,
"include_raw_content": true,
"include_images": true,
"exclude_domains": ["pinterest.com"],
"time_range": "month"
}
###
### ============================================
### SEARCH - SSE Streaming
### ============================================
### Note: REST Client shows raw SSE text.
### Events: result, image, extraction, done, error
### Stream basic search results
POST {{baseUrl}}/search/stream
Content-Type: application/json
Accept: text/event-stream
{
"query": "python async programming",
"max_results": 3
}
###
### Stream with images
POST {{baseUrl}}/search/stream
Content-Type: application/json
Accept: text/event-stream
{
"query": "cute cats",
"include_images": true,
"max_results": 3
}
###
### Stream advanced search with extraction
POST {{baseUrl}}/search/stream
Content-Type: application/json
Accept: text/event-stream
{
"query": "fastapi best practices",
"search_depth": "advanced",
"max_results": 2
}
###
### ============================================
### SEARCH - AI Answer Generation
### ============================================
### Requires LLM config enabled in config.yaml
### Works with OpenAI, Ollama, Groq, or any OpenAI-compatible API
### Search with AI answer (basic)
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "what is docker and why is it useful",
"include_answer": true,
"max_results": 5
}
###
### Search with AI answer + advanced depth
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "how to use docker compose",
"include_answer": true,
"search_depth": "advanced",
"max_results": 3
}
###
### Stream with AI answer (answer_chunk + answer_done events)
POST {{baseUrl}}/search/stream
Content-Type: application/json
Accept: text/event-stream
{
"query": "python async programming best practices",
"include_answer": true,
"max_results": 3
}
###
### Search without AI answer (answer field should be null)
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "test no answer",
"include_answer": false,
"max_results": 3
}
###
### ============================================
### EXTRACT - Content extraction
### ============================================
### Extract single URL (markdown format, default)
POST {{baseUrl}}/extract
Content-Type: application/json
{
"urls": ["https://httpbin.org/html"]
}
###
### Extract multiple URLs (tests Redis pipeline batching)
POST {{baseUrl}}/extract
Content-Type: application/json
{
"urls": [
"https://httpbin.org/html",
"https://httpbin.org/html",
"https://jsonplaceholder.typicode.com"
],
"format": "markdown"
}
###
### Extract with text format
POST {{baseUrl}}/extract
Content-Type: application/json
{
"urls": ["https://httpbin.org/html"],
"format": "text"
}
###
### Extract - mixed success and failure
POST {{baseUrl}}/extract
Content-Type: application/json
{
"urls": [
"https://httpbin.org/html",
"https://thisdomaindoesnotexist99999.com/page"
]
}
###
### ============================================
### AUTH - API Key Authentication
### ============================================
### Enable auth in config.yaml first:
### auth:
### enabled: true
### api_keys: ["your-secret-key-here"]
### Search with valid API key (200 when auth enabled)
POST {{baseUrl}}/search
Content-Type: application/json
Authorization: Bearer {{apiKey}}
{
"query": "test auth",
"max_results": 1
}
###
### Search without API key (401 when auth enabled)
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "test no auth",
"max_results": 1
}
###
### Search with invalid API key (403 when auth enabled)
POST {{baseUrl}}/search
Content-Type: application/json
Authorization: Bearer invalid-key-here
{
"query": "test bad auth",
"max_results": 1
}
###
### Extract with API key
POST {{baseUrl}}/extract
Content-Type: application/json
Authorization: Bearer {{apiKey}}
{
"urls": ["https://httpbin.org/html"]
}
###
### Stream with API key
POST {{baseUrl}}/search/stream
Content-Type: application/json
Authorization: Bearer {{apiKey}}
Accept: text/event-stream
{
"query": "auth stream test",
"max_results": 1
}
###
### ============================================
### Validation - Expected 422 errors
### ============================================
### Missing query field
POST {{baseUrl}}/search
Content-Type: application/json
{
"max_results": 5
}
###
### max_results out of range (max 20)
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "test",
"max_results": 50
}
###
### Invalid search_depth enum
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "test",
"search_depth": "ultra"
}
###
### Invalid topic enum
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "test",
"topic": "finance"
}
###
### Invalid time_range enum
POST {{baseUrl}}/search
Content-Type: application/json
{
"query": "test",
"time_range": "century"
}
###
### Empty body
POST {{baseUrl}}/search
Content-Type: application/json
{}
###
### Extract with no URLs (min 1)
POST {{baseUrl}}/extract
Content-Type: application/json
{
"urls": []
}
###
### Extract with too many URLs (max 20)
POST {{baseUrl}}/extract
Content-Type: application/json
{
"urls": [
"https://httpbin.org/html/1", "https://httpbin.org/html/2", "https://httpbin.org/html/3",
"https://httpbin.org/html/4", "https://httpbin.org/html/5", "https://httpbin.org/html/6",
"https://httpbin.org/html/7", "https://httpbin.org/html/8", "https://httpbin.org/html/9",
"https://httpbin.org/html/10", "https://httpbin.org/html/11", "https://httpbin.org/html/12",
"https://httpbin.org/html/13", "https://httpbin.org/html/14", "https://httpbin.org/html/15",
"https://httpbin.org/html/16", "https://httpbin.org/html/17", "https://httpbin.org/html/18",
"https://httpbin.org/html/19", "https://httpbin.org/html/20", "https://httpbin.org/html/21"
]
}
###
### Extract with invalid format
POST {{baseUrl}}/extract
Content-Type: application/json
{
"urls": ["https://httpbin.org/html"],
"format": "html"
}
###
### ============================================
### Request ID tracing
### ============================================
### Auto-generated X-Request-ID (check response headers)
GET {{baseUrl}}/health
###
### Custom X-Request-ID passed through
POST {{baseUrl}}/search
Content-Type: application/json
X-Request-ID: my-custom-trace-id-123
{
"query": "trace id test",
"max_results": 1
}
###