Skip to main content

API Generation Guide

Transform your database schema into a fully functional REST API in seconds.

Learn how Endora automatically generates production-ready APIs with authentication, validation, documentation, and testing interfaces.

What You'll Learn

  • Automatic API generation process
  • Generated endpoint structure
  • Authentication and security
  • API testing and validation
  • Documentation generation
  • Performance optimization

API Generation Overview

Endpoints

See how Endora transforms your database schema into a complete REST API with all the features you need.

Understanding API Generation

What Gets Generated?

For each table in your schema, Endora automatically creates:

  • Complete CRUD Operations: Create, Read, Update, Delete
  • Authentication: API key-based security
  • Validation: Input validation and data sanitization
  • Documentation: Interactive Swagger UI
  • Testing Interface: Built-in API testing tools
  • Analytics: Usage monitoring and performance metrics

Generated Endpoint Structure

POST   /table-name          # Create new record
GET /table-name # List all records (paginated)
GET /table-name/{id} # Get specific record
PUT /table-name/{id} # Update entire record
PATCH /table-name/{id} # Partial update
DELETE /table-name/{id} # Delete record

Generated API Features

Automatic CRUD Operations

Create (POST)

POST /users
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

{
"name": "John Doe",
"email": "john@example.com",
"age": 30
}

Read (GET)

# Get all users
GET /users?page=1&limit=10&sort=name&order=asc

# Get specific user
GET /users/123

Update (PUT/PATCH)

# Full update
PUT /users/123
{
"name": "John Smith",
"email": "john.smith@example.com",
"age": 31
}

# Partial update
PATCH /users/123
{
"age": 31
}

Delete (DELETE)

DELETE /users/123

Pagination

GET /users?page=2&limit=20

Sorting

GET /users?sort=created_at&order=desc

Filtering

GET /users?filter[status]=active&filter[age]=25
GET /users?search=john

Include Relationships

GET /users?include=posts,comments

Testing Your API

Built-in Swagger UI

  1. Open Testing Interface: Go to "API Docs".
  2. Authenticate: Register and Login to get access token. Pass it in Authorize interface.
  3. Explore Endpoints: Browse all available operations
  4. Test Requests: Send real requests and see responses

Testing Workflow

1. Authentication

Authorization: Bearer YOUR_API_KEY

2. Test Create Operation

POST /users
{
"name": "Test User",
"email": "test@example.com",
"age": 25
}

3. Test Read Operations

GET /users
GET /users/1

4. Test Update Operations

PUT /users/1
{
"name": "Updated User",
"email": "updated@example.com",
"age": 26
}

5. Test Delete Operation

DELETE /users/1

Integration Examples

JavaScript/Node.js

// Fetch all users
const response = await fetch("https://api.endora.space/v1/your-project/users", {
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
});
const users = await response.json();

// Create a new user
const newUser = await fetch("https://api.endora.space/v1/your-project/users", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "John Doe",
email: "john@example.com",
age: 30,
}),
});

Python

import requests

# Get all users
response = requests.get(
'https://api.endora.space/v1/your-project/users',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
users = response.json()

# Create a new user
new_user = requests.post(
'https://api.endora.space/v1/your-project/users',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'name': 'John Doe',
'email': 'john@example.com',
'age': 30
}
)

Best Practices

API Design

Use RESTful Conventions

Follow REST principles for consistent, predictable APIs

Implement Proper Error Handling

Return meaningful error messages with appropriate HTTP status codes

Add Request Validation

Validate all inputs to ensure data quality and security

Document Everything

Provide comprehensive documentation for all endpoints

Performance Optimization

Use Pagination

Implement pagination for large datasets to improve performance

Add Caching

Use caching strategies to reduce database load

Monitor Performance

Track API performance and optimize based on usage patterns

Scale Horizontally

Design for horizontal scaling as your API grows

Next Steps

Your API is Ready!

After generating your API:

  1. Test All Endpoints: Verify functionality using Swagger UI
  2. Configure Security: Set up authentication
  3. Monitor Usage: Track performance and usage patterns
  4. Integrate: Start using your API in applications

Learn More

Advanced Features


Ready to deploy your API? Learn about deployment →