5-Minute Quickstart
This quickstart configures the Aegean Voyages (aegeanvoyages.example) REST API using the files in site/modules/Headless/examples/real-world/.
Connect Your First Headless Client
Section titled “Connect Your First Headless Client”-
Issue a scoped Personal Access Token (
whk_*) via CLI (or Setup -> Headless):Terminal window php vendor/bin/wire headless:key:create "Aegean Frontend Storefront" \--scopes=pages:read,entries:read \--rate-limit=240 \--jsonCopy the one-time
whk_...plaintext secret returned in the output (only its hash is stored inheadless-keys). -
Query ProcessWire Pages & Entries Over REST:
Terminal window curl -H "X-Api-Key: whk_your_token_here" \"https://aegeanvoyages.example/api/v1/pages?template=yacht&limit=12&fields=id,title,home_port,weekly_rate_eur" -
Download Live OpenAPI 3.1 & TypeScript
.d.tsContracts:Terminal window curl "https://aegeanvoyages.example/api/v1/schema/openapi.json" -o openapi.jsoncurl "https://aegeanvoyages.example/api/v1/schema/typescript" -o src/types/processwire.d.ts -
Expose a Declarative
ResourceBlueprintinsite/ready.php:use Totoglu\Headless\Auth\AuthMode;use Totoglu\Headless\Resource\ResourceBlueprint;$wire->addHookAfter('Headless::registerProviders', static function (HookEvent $event): void {/** @var Headless $headless */$headless = $event->object;$headless->expose(new ResourceBlueprint(name: 'yachts',selector: 'template=yacht, sort=title',fields: ['id', 'name', 'title', 'home_port', 'cabins', 'weekly_rate_eur'],filterable: ['home_port', 'cabins'],searchable: ['title', 'summary'],readAuth: [AuthMode::Public],cacheTtl: 120));});Your resource is immediately live at
GET /api/v1/resources/yachts?filter[home_port][eq]=gocek.