Docs
API Examples
API Examples Small REST examples for generated Enfyra table routes. Replace {appUrl} with your app URL, for example http://localhost:3000 . Authentication Login curl -X POST "{appUrl}/api/login" \ -H "Content-Type: application/json" \ -d '{"email":"[email protected]","password":"
API Examples
Small REST examples for generated Enfyra table routes.
Replace {appUrl} with your app URL, for example http://localhost:3000.
Authentication
Login
curl -X POST "{appUrl}/api/login" \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"password"}'
Current User
curl "{appUrl}/api/me" \
-H "Authorization: Bearer <accessToken>"
Logout
curl -X POST "{appUrl}/api/logout" \
-H "Authorization: Bearer <accessToken>"
Records
List Rows
GET {appUrl}/api/post?fields=id,title,createdAt&limit=20
Find One Row By Id
GET {appUrl}/api/post?filter={"id":{"_eq":123}}&limit=1
Create Row
curl -X POST "{appUrl}/api/post" \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-d '{"title":"Hello","status":"draft"}'
Update Row
curl -X PATCH "{appUrl}/api/post/123" \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-d '{"status":"published"}'
Delete Row
curl -X DELETE "{appUrl}/api/post/123" \
-H "Authorization: Bearer <accessToken>"
Query
Equality Filter
GET {appUrl}/api/post?filter={"status":{"_eq":"published"}}
Contains Filter
GET {appUrl}/api/post?filter={"title":{"_contains":"release"}}
Relation Filter
GET {appUrl}/api/post?filter={"author":{"id":{"_eq":7}}}
Sort
GET {appUrl}/api/post?sort=-createdAt
Count Rows
GET {appUrl}/api/post?fields=id&limit=1&meta=totalCount
Count Filtered Rows
GET {appUrl}/api/post?fields=id&limit=1&meta=filterCount&filter={"status":{"_eq":"published"}}
Fields
Select Fields
GET {appUrl}/api/post?fields=id,title,author.email
Exclude A Large Field
GET {appUrl}/api/route_handler_definition?fields=-compiledCode
Exclude Nested Field
GET {appUrl}/api/post?fields=-author.avatar
Relations
Load Related Fields
GET {appUrl}/api/post?fields=id,title,author.id,author.email
Deep Load Children
GET {appUrl}/api/post?fields=id,title&deep={"comments":{"fields":"id,body","limit":5}}
Deep Load With Nested Exclusion
GET {appUrl}/api/post?fields=id,title&deep={"comments":{"fields":"-compiledCode,-author.avatar","limit":5}}
Sort Parent Rows By Child Count
GET {appUrl}/api/post?fields=id,title&sort=-_count(comments)
Sort Parent Rows By Latest Child
GET {appUrl}/api/post?fields=id,title&sort=-_max(comments.createdAt)