Getting Started with Flux API
Flux API is FoxNose's content delivery system designed for retrieving content in your applications. Unlike the Management API which handles content creation and configuration, Flux API focuses purely on fast, reliable content delivery to end users.
What is Flux API?
Flux API provides read-only access to your published content through optimized endpoints. Each environment in your FoxNose project can host multiple Flux APIs, allowing you to create specialized content delivery endpoints for different applications, user types, or business requirements.
Key Characteristics
- Content Delivery Focused: Optimized for retrieving content, not managing it
- Environment-Specific: Each environment has its own Flux API endpoints
- Multiple APIs per Environment: Create specialized APIs for different use cases
- Optional Authentication: Public by default, with optional API key authentication
- High Performance: Built for fast content delivery at scale
Your First API Call
Let's start with a simple example. Every Flux API follows this URL pattern:
https://<ENVIRONMENT_KEY>.fxns.io/<API_PREFIX>/<FOLDER_PATH>/
Example: List Articles
If you have a blog with articles, your API call might look like this:
List Articles
curl https://7c9h4pwu.fxns.io/blog-v1/articles/
Response
{
"results": [
{
"_sys": {
"key": "dw2qC5qRwxuZ",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T14:20:00Z"
},
"title": "Getting Started with FoxNose",
"slug": "getting-started-foxnose",
"published": true,
"excerpt": "Learn the basics of content management..."
},
{
"_sys": {
"key": "mK8nP3tYvBcX",
"created_at": "2024-01-14T09:15:00Z",
"updated_at": "2024-01-14T16:45:00Z"
},
"title": "Advanced Content Strategies",
"slug": "advanced-content-strategies",
"published": true,
"excerpt": "Explore sophisticated content delivery patterns..."
}
],
"has_more": false,
"next": null,
"previous": null
}
Example: Get Specific Article
To retrieve a specific article, use its key:
Get Article
curl https://7c9h4pwu.fxns.io/blog-v1/articles/dw2qC5qRwxuZ/
Response
{
"_sys": {
"key": "dw2qC5qRwxuZ",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T14:20:00Z"
},
"title": "Getting Started with FoxNose",
"slug": "getting-started-foxnose",
"published": true,
"excerpt": "Learn the basics of content management...",
"content": "# Getting Started\n\nWelcome to FoxNose! This guide will help you...",
"author": {
"name": "Jane Smith",
"email": "jane@example.com"
},
"tags": ["tutorial", "getting-started", "cms"]
}
Available Operations
Flux API provides three main operations for content retrieval:
1. List Resources
Get multiple resources with optional filtering and pagination.
GET https://<ENVIRONMENT_KEY>.fxns.io/<API_PREFIX>/<FOLDER_PATH>
Use cases: Blog listings, product catalogs, navigation menus
2. Search Resources
Perform complex searches with full-text search, filters, and joins.
POST https://<ENVIRONMENT_KEY>.fxns.io/<API_PREFIX>/<FOLDER_PATH>/_search
Use cases: Site search, advanced filtering, cross-content queries
3. Get Single Resource
Retrieve a specific resource by its key.
GET https://<ENVIRONMENT_KEY>.fxns.io/<API_PREFIX>/<FOLDER_PATH>/<RESOURCE_KEY>
Use cases: Article pages, product details, specific content items
Common Parameters
Pagination
Control how many results you receive:
# Get first 10 results
curl "https://7c9h4pwu.fxns.io/blog-v1/articles/?limit=10"
# Get next page using cursor
curl "https://7c9h4pwu.fxns.io/blog-v1/articles/?limit=10&next=eyJrZXkiOiJkdzJxQzVxUnd4dVoifQ=="
Population
Load related content automatically:
# Load author information with articles
curl "https://7c9h4pwu.fxns.io/blog-v1/articles/?populate=author"
# Load multiple relationships
curl "https://7c9h4pwu.fxns.io/blog-v1/articles/?populate=author,category,tags"
Localization
Get content in specific languages:
# Get content in Spanish
curl "https://7c9h4pwu.fxns.io/blog-v1/articles/?return_locales=es"
# Get content with fallback to English
curl "https://7c9h4pwu.fxns.io/blog-v1/articles/?return_locales=es,en,fr&fallback_locales=true"
Read more about localization.
Error Handling
Flux API uses standard HTTP status codes and returns structured error responses:
{
"message": "Resource not found",
"error_code": "resource_not_found",
"detail": null
}
Read more about error codes.
Next Steps
Now that you understand the basics, explore these advanced features:
- Authentication - Secure your API with authentication
- Search API - Master complex queries and full-text search
- List Resources - Learn advanced filtering and pagination
- Get Resource - Optimize single resource retrieval
- Build Flux APIs - Create and configure your own APIs