Deploying Queries
Learn how to deploy your queries as API endpoints
Deploying Queries
After building queries in Infactory, the next step is to deploy them as API endpoints that applications can use. This guide explains how to deploy queries, manage deployed APIs, and integrate them into your applications.
Understanding the Deploy Page
The Deploy page in Infactory provides tools for managing your deployed queries:
- Deployed Queries List: All queries that have been deployed as API endpoints
- Live APIs Section: Interactive Swagger documentation for testing your APIs
- API Key Management: Tools for creating and managing API keys
Deploying a Query
Once you’ve created and tested a query in the Build page, deploying it is simple:
Select a query to deploy
From the Build tab, select the query you want to deploy.
Click Deploy
Click the Deploy button at the top of the query editor.
Confirm deployment
Review the deployment summary and click Confirm to deploy the query.
View in Deploy tab
Navigate to the Deploy tab to see your newly deployed query in the list.
Testing Deployed Queries
You can test your deployed queries directly from the Deploy page:
- Click on the Live APIs section
- Find your deployed query in the Swagger documentation
- Click to expand the query details
- Enter values for any parameters (slots)
- Click Execute to run the query and see the results
API Architecture
Infactory provides two ways to interact with your deployed queries:
1. Unified API Endpoint
The unified endpoint allows you to send natural language questions and have Infactory automatically route them to the appropriate query:
Request Format
Response Format
2. Direct Query Endpoints
You can also call specific query endpoints directly with their parameters:
Request Format
Response Format
API Key Management
To secure your API endpoints, Infactory uses API keys:
Creating an API Key
- Navigate to the API Keys section in the Deploy tab
- Click Create New Key
- Enter a name for the key (e.g., “Development”, “Production”)
- Select which projects this key should have access to
- Click Create
- Save the displayed API key securely - it will only be shown once
Using API Keys
Include your API key in all requests to the Infactory API:
Code Examples
Here are examples of how to integrate with Infactory APIs in different languages:
JavaScript/TypeScript
Python
Response Handling
When working with Infactory API responses, consider these best practices:
Error Handling
Always check for and handle errors in your API calls:
Working with Response Data
The structured data in the response can be used directly in your application:
Using the Response with Visualization Libraries
You can easily integrate Infactory API responses with popular visualization libraries:
Chart.js Example
Streaming Responses
For queries that might return large datasets, Infactory supports streaming responses:
Best Practices
- Use the Unified Endpoint for natural language interfaces where users might ask a variety of questions
- Use Direct Query Endpoints for specific, predefined operations in your application
- Implement Proper Error Handling to give users helpful feedback when things go wrong
- Cache Common Results to improve performance and reduce API calls
- Implement Rate Limiting in your application to avoid hitting API limits
- Secure Your API Keys and never expose them in client-side code
Next Steps
Now that you know how to deploy queries and integrate with the Infactory API, learn how to explore and test your queries in the Exploring Queries guide.
Was this page helpful?