Call an endpoint from a page
Pass route parameters, choose methods and cancel a call.
Before you begin: Create a custom endpoint.
Path Params
Rule input (JSON)
Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.
Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.
Theme code passes path parameters by name:
Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →
The endpoint receives "Ada" as $request.params.username. A direct HTTP caller can make the equivalent request to /fb-endpoints/username/Ada.
GET, PATCH, and DELETE Calls
Each named endpoint owns its HTTP method. Theme code calls all of them through the same helper and never repeats the method or public route.
Rule input (JSON)
Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.
Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.
Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →
The GET call opts into guest access. PATCH and DELETE keep the helper's authenticated default, and Frontbacked attaches any available authentication to every call.
Canceling A Call
Use an AbortSignal when a request becomes obsolete, such as when someone types a new search before the previous search finishes:
Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →
A canceled call returns { ok: false, aborted: true }. Cancellation stops the browser from waiting for the result, but work that has already started may still finish.
Continue with Make actions safe to retry.