This chapter covers the core features and capabilities of Form API Builder.
/api/{form}/schema returns the form definitionhttp.server — zero external dependencies, Python 3.10+ stdlib only# 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| Flag | Description |
|---|---|
--config FILE | JSON configuration file with form definitions |
--port N | Port to run the server on (default: 8000) |
--host HOST | Host to bind to (default: 0.0.0.0) |
--schema | Print the API schema and exit (don't start server) |
--demo | Start with a built-in demo configuration |
Follow this guide to get Form API Builder up and running in your environment.
For each form defined in your config, the following endpoints are generated:
| Method | Endpoint | Description |
|---|---|---|
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}/schema | Get the form schema definition |
GET /api/contacts?page=2&per_page=10
Response includes pagination metadata:
{
"data": [...],
"pagination": {
"page": 2,
"per_page": 10,
"total": 45,
"total_pages": 5
}
}{
"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 payloads include an X-Webhook-Signature header with an HMAC-SHA256 signature:
# 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)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)Get the full Form API Builder and unlock everything.
Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.
Access all interactive tools with complete data, all workload profiles, and the full scenario library.
Downloadable source code, configuration files, and working examples from every chapter.
Free updates for life. Every new chapter, tool, and improvement included.