Developer 101 — Content Modeling and the GraphQL API
Contents
Hands-on introduction to modeling content in Enonic and reading it through the Guillotine GraphQL API.
Introduction
This tutorial is for developers who define content types and build front-ends against Enonic’s GraphQL API. It covers content modeling, schema management and the Guillotine API, using the Enonic CLI, Content Studio and a local sandbox. Every chapter builds on the previous one, so you gain understanding incrementally while building a small content model of your own.
Along the way you will:
-
set up the CLI, a local sandbox and your own app
-
create content types and content in Content Studio
-
query your content through the Headless API
-
upload images and other media, and serve them scaled and cropped
-
model richer content with form items, sets and form fragments, rich text and mixins
-
publish your content and explore read and editorial permissions
-
export and import your content into another project
Two things to know before you start:
-
No coding. You will not write application code. You will edit YAML schemas, run GraphQL queries, and use ready-to-run cURL requests to test the API. There is nothing to compile or debug.
-
No pages. Sites, pages, layouts and parts - the whole page domain of Enonic - are left out entirely. To learn more about pages, check out the Next.js tutorial, the React4XP tutorial, or the My First Site tutorials.
The CMS reference documentation covers every topic in this tutorial in depth, and is the place to go once you know what you are looking for.
The completed example app on GitHub contains the finished schemas and sample content for comparison as you work through the tutorial. To explore the finished result, follow its README to build and install it in a separate sandbox. It uses the same app key (com.example.dev101) and content project identifier (my-first-project) as the exercises; installing it in your exercise sandbox would replace your app.
| When we mention "XP", we are referring to "Enonic XP", the platform behind Enonic. |
If you have any questions, or just want to get in touch, visit the Forum or join the Community Slack channel.
The first step is to get your tools in place. Good luck! 🙌