Introduction to the GraphQL API schema
The GraphQL API uses a schema to describe which data types are available in your system and how you can query them. From this article, you’ll learn how the Prepr GraphQL API schema is generated and how you can use it to integrate content into your web app.
Schema generation
A schema is the definition of the content structure for your web app. In Prepr, a schema consists of several content types: models, components, and remote sources. Each of these content types comes with corresponding fields.
Before adding content to Prepr, we recommend you design a schema with your content structure in a design tool of your choice.
Prepr provides you with the GraphQL API you can use to integrate the content into your application. For each content type in Prepr, the GraphQL API creates a corresponding GraphQL type (opens in a new tab), including available fields. These types describe the set of possible data you can query from Prepr.
Each of the GraphQL types and GraphQL fields must have a unique name as follows:
- The Type name is in pascal-case with only alphanumeric characters.
- The Field name is in lower camel-case with alphanumeric characters and underscores only.
Some Type names are reserved for metadata or default types. You can check them out in Reserved terms.
The GraphQL API schema is generated automatically at request time, so it’s always current. We recommend browsing a schema with an API Explorer (opens in a new tab) to get a complete overview of GraphQL type definitions and filtering options applicable to your setup. Also, you can inspect your schema using GraphQL Introspection (opens in a new tab).
Find more information about supported GraphQL types and fields by following the links below:
Querying a schema
Prepr provides an interface based on the Apollo Explorer to test your requests before integrating them into production. Within the API Explorer, you can write and validate your GraphQL queries, make a test run of the queries, and receive responses from the Prepr API straightaway. Find more information in Draft your queries.
Once you run a query, it will be validated and executed against the GraphQL API schema. The GraphQL API uses standard HTTP status codes to indicate whether a request is successful. Check out Statuses and errors for more details.
Reserved terms
The following Type names are default types and reserved for metadata:
Boolean
BusinessHours
Context
Coordinates
CoordinatesCircle
DateTime
Directive
Enum
EnumValueDefinition
Field
Float
ID
Int
Interface
KeyValue
ListOf
Location
NonNull
Number
Object
Paragraph
Query
Quote
Resource
Resolve
Scalar
Stack
String
Text
TextFormat
Type
TypeWithFields
Union
UnresolvedField
Asset
AssetAlignment
Assets
CdnFile
Channel
Component
ContentIntegration
ContentIntegrations
ContentItem
ContentItems
Customer
CustomerScalar
Model
Publication
Publications
Story
Tag
User
ApplePodcast
BlueskyPost
FacebookPost
InstagramPost
SoundCloudPost
SpotifyPlaylist
ThreadsPost
TikTokPost
TwitterPost
VimeoPost
YouTubePost
ActiveCampaignEmbed
HubSpotEmbed
PipedriveEmbed
TypeformEmbed
Event
NavigationItem
embed
embeds
item
items
slug
Including all types starting with _
and ending with _DESC
or _ASC
.
Using one of the reserved terms as a field name will result in a schema collision error asking you to use a different name instead.
Was this article helpful?
We’d love to learn from your feedback