docs: update API documentation for single POST upsert endpoint
- Replace separate POST/PUT endpoints with unified POST upsert endpoint - Add comprehensive API usage examples with automatic ID generation - Simplify content management to single endpoint for create/update operations - Document element_context for backend ID generation and version control features
This commit is contained in:
29
README.md
29
README.md
@@ -297,6 +297,35 @@ export INSERTR_SITE_ID="production"
|
||||
- **Links/Buttons** (`a`, `button`) → Text + URL fields
|
||||
- **Containers** (`div`, `section`) → Expand to viable children
|
||||
|
||||
## 🔌 API Reference
|
||||
|
||||
### **Simple Content Management**
|
||||
```bash
|
||||
# Create or update content (single endpoint for both)
|
||||
curl -X POST http://localhost:8080/api/content?site_id=demo \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"value": "New content", "type": "text"}'
|
||||
|
||||
# Get all content for a site
|
||||
curl http://localhost:8080/api/content?site_id=demo
|
||||
|
||||
# Get specific content by ID
|
||||
curl http://localhost:8080/api/content/content-id?site_id=demo
|
||||
|
||||
# View edit history
|
||||
curl http://localhost:8080/api/content/content-id/versions?site_id=demo
|
||||
|
||||
# Rollback to previous version
|
||||
curl -X POST http://localhost:8080/api/content/content-id/rollback \
|
||||
-d '{"version_id": 123}'
|
||||
```
|
||||
|
||||
**Key Features:**
|
||||
- **Single POST endpoint** handles both create and update (upsert)
|
||||
- **Automatic ID generation** from element context if no ID provided
|
||||
- **Version control** preserves all changes with user attribution
|
||||
- **Auto-enhancement** updates static files when content changes
|
||||
|
||||
## 🔧 Development Workflow
|
||||
|
||||
### **Live Development with Hot Reload**
|
||||
|
||||
Reference in New Issue
Block a user