21. Field Groups API | Field Forge - Custom Fields, Built for Speed
Download Log in

21. Field Groups API

Developer Guide

CRUD operations for field group definitions via REST.

GET /fieldforge/v1/field-groups

List all field groups.

bash
curl -s -u "$AUTH" 
  "https://example.com/wp-json/fieldforge/v1/field-groups"
Response:
json
[
  {
    "id": 1,
    "title": "Product Fields",
    "fields": [
      {
        "key": "field_abc123",
        "label": "Price",
        "name": "price",
        "type": "number",
        "required": true
      }
    ],
    "location_rules": [
      [{ "param": "post_type", "operator": "==", "value": "product" }]
    ],
    "menu_order": 0,
    "status": "publish",
    "created_at": "2024-01-15 10:30:00",
    "updated_at": "2024-03-20 14:22:00"
  }
]

POST /fieldforge/v1/field-groups

Create a new field group.

bash
curl -s -X POST -u "$AUTH" 
  -H "Content-Type: application/json" 
  "https://example.com/wp-json/fieldforge/v1/field-groups" 
  -d '{
    "title": "Event Details",
    "fields": [
      { "key": "field_evt_date", "label": "Event Date", "name": "event_date", "type": "date_picker", "required": true },
      { "key": "field_evt_loc", "label": "Location", "name": "event_location", "type": "text" }
    ],
    "location_rules": [
      [{ "param": "post_type", "operator": "==", "value": "event" }]
    ]
  }'
Response: { "id": 5 }

PUT /fieldforge/v1/field-groups/{id}

Update an existing field group. Send the full updated object.

bash
curl -s -X PUT -u "$AUTH" 
  -H "Content-Type: application/json" 
  "https://example.com/wp-json/fieldforge/v1/field-groups/5" 
  -d '{ "title": "Event Details (Updated)", "fields": [ ... ] }'
Response: { "success": true }

DELETE /fieldforge/v1/field-groups/{id}

Delete a field group and its associated field values.

bash
curl -s -X DELETE -u "$AUTH" 
  "https://example.com/wp-json/fieldforge/v1/field-groups/5"
Response: { "success": true }

Forge AI Assistant Online

Hi! I'm the Field Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs