Contents

Chapter 1

Features

This chapter covers the core features and capabilities of Form API Builder.

Features

  • Auto-generated CRUD endpoints: GET, POST, PUT, DELETE from form definitions
  • JSON file store: persistent storage with no database required
  • Pagination: page/per_page query parameters on list endpoints
  • Webhooks: notify external URLs on create/update/delete with HMAC signatures
  • API key authentication: protect endpoints with configurable API keys
  • CORS support: configurable cross-origin headers
  • Field validation: validate submissions against form field definitions
  • Schema endpoint: GET /api/{form}/schema returns the form definition
  • Built on http.server — zero external dependencies, Python 3.10+ stdlib only

Quick Start

bash
# Start the API server with a form config
python src/form_api_builder.py --config examples/api_config.json --port 8080

# Start with the built-in demo
python src/form_api_builder.py --demo

# Print the generated schema
python src/form_api_builder.py --config examples/api_config.json --schema

CLI Reference

FlagDescription
--config FILEJSON configuration file with form definitions
--port NPort to run the server on (default: 8000)
--host HOSTHost to bind to (default: 0.0.0.0)
--schemaPrint the API schema and exit (don't start server)
--demoStart with a built-in demo configuration
Chapter 2

API Endpoints

Follow this guide to get Form API Builder up and running in your environment.

API Endpoints

For each form defined in your config, the following endpoints are generated:

MethodEndpointDescription
GET/api/{slug}List all submissions (paginated)
POST/api/{slug}Create a new submission
GET/api/{slug}/{id}Get a specific submission
PUT/api/{slug}/{id}Update a submission
DELETE/api/{slug}/{id}Delete a submission
GET/api/{slug}/schemaGet the form schema definition

Pagination

GET /api/contacts?page=2&per_page=10

Response includes pagination metadata:

json
{
  "data": [...],
  "pagination": {
    "page": 2,
    "per_page": 10,
    "total": 45,
    "total_pages": 5
  }
}

Configuration

json
{
  "server": {
    "host": "0.0.0.0",
    "port": 8000,
    "cors_origins": ["*"]
  },
  "auth": {
    "api_key": "YOUR_API_KEY_HERE",
    "header": "X-API-Key"
  },
  "storage": {
    "dir": "./data"
  },
  "webhooks": [
    {
      "url": "https://api.example.com/webhooks/form-submit",
      "events": ["create", "update", "delete"],
      "secret": "YOUR_WEBHOOK_SECRET_HERE"
    }
  ],
  "forms": [
    {
      "slug": "contacts",
      "title": "Contact Form",
      "fields": [
        {
          "name": "name",
          "type": "text",
          "label": "Full Name",
          "required": true
        },
        {
          "name": "email",
          "type": "email",
          "label": "Email Address",
          "required": true
        },
        {
          "name": "message",
          "type": "textarea",
          "label": "Message",
          "required": true,
          "maxLength": 2000
        }
      ]
    }
  ]
}

Webhook HMAC Signatures

Webhook payloads include an X-Webhook-Signature header with an HMAC-SHA256 signature:

python
# Verify on the receiving end:
import hmac, hashlib
expected = hmac.new(
    secret.encode(),
    request_body,
    hashlib.sha256
).hexdigest()
assert hmac.compare_digest(expected, received_signature)

Programmatic Usage

python
from form_api_builder import FormAPIServer, load_config

# Load config
config = load_config("examples/api_config.json")

# Start server
server = FormAPIServer(config)
server.start()  # Blocks, serving on configured host:port

# Or use the data store directly
from form_api_builder import JSONStore

store = JSONStore("./data", "contacts")
entry_id = store.create({"name": "Jane Smith", "email": "jane@example.com"})
entry = store.get(entry_id)
store.update(entry_id, {"name": "Jane Doe"})
store.delete(entry_id)

# List with pagination
results = store.list(page=1, per_page=10)
Chapter 3
🔒 Available in full product

Example: Testing the API

You’ve reached the end of the free preview

Get the full Form API Builder and unlock everything.

All Chapters

Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.

Full Tool Suite

Access all interactive tools with complete data, all workload profiles, and the full scenario library.

Source Files

Downloadable source code, configuration files, and working examples from every chapter.

Lifetime Updates

Free updates for life. Every new chapter, tool, and improvement included.

Buy Now — $29 →
📦 Free sample included — download another copy for the full product.
Form API Builder v1.0.0 — Free Preview