Skip to main content
EazeMyAPI allows you to write custom database queries and expose them as API endpoints. This feature is useful when you need more control than the automatically generated CRUD APIs. With custom queries you can:
  • Join multiple tables
  • Filter complex data
  • Create custom reports
  • Build advanced API endpoints

When to Use Custom Queries

Use custom queries when:
  • You need JOIN operations
  • You want custom filters
  • You need aggregated data
  • You want custom endpoints for frontend apps

Example Use Cases

  • Fetch posts by category
  • Get user statistics
  • Build dashboard analytics
  • Filter records by multiple conditions

Example Query

Example query that retrieves posts by category:

Generated API Endpoint

Once a custom query is saved, EazeMyAPI automatically generates an API endpoint.

Example


Example API Request


Example API Response


Creating a Custom Query

To create a custom query in the dashboard:
  1. Open your Project
  2. Navigate to Queries or Custom Queries
  3. Click Create Query
  4. Write your SQL query
  5. Save the query
Once saved, an API endpoint will automatically be generated.

Query Parameters

Custom queries can accept parameters.

Example Query

Example API Request


Best Practices

When writing custom queries:
  • Keep queries optimized
  • Use indexes when possible
  • Avoid returning unnecessary columns
  • Validate input parameters
  • Use parameter binding (avoid raw string injection)
Well-written queries improve API performance and security.
Learn how database tables work: Database Schema Understand API endpoints: API Endpoints