Js Craft CMS Query API
The core package for Vue and Nuxt Craft CMS. Use this as a foundation to build a query builder for Craft CMS with your preferred JavaScript framework.
Features
- Support for Main Element Types: Query addresses, assets, entries and users.
- Helper for Preview Mode: Easily add preview mode to your headless setup.
- Typesafe: Built with typescript in mind.
- Easy Adaptable: You can easily build your own custom wrapper with that core logic.
Examples
Want to see how it works?
app.ts
import { buildCraftQueryUrl } from 'js-craftcms-api';
// Build URL for fetching a single address
const url = buildCraftQueryUrl('entries')
.id(1)
.status('active')
.siteId(1)
.buildBaseUrl('one');
// Result: /v1/api/queryApi/customQuery?elementType=addresses&id=1&status=active&siteId=1&one=1
It is as simple as that. 🚀
Further Resources
- Craft Query API: A Craft CMS Plugin, that powers this stuff.
- Vue Craft CMS: A package to use the query builder in Vue.
- Nuxt Craft CMS: A package to use the query builder in Nuxt.