Back to Prisma1

Index

docs/1.21/prisma-graphql-api/index.mdx

1.34.121.9 KB
Original Source

import Collapse from 'components/Markdown/Collapse'

export const meta = { title: 'Prisma GraphQL API', position: 5 }

Use Prisma GraphQL API

Every Prisma service exposes a GraphQL API with CRUD and realtime operations for the types defined in the service's datamodel. This API is called the Prisma API.

The GraphQL schema defining the types and operations of the Prisma API is referred to as the Prisma GraphQL schema. It is automatically generated by Prisma.

<Collapse title="Try out the Prisma API in a GrapQL Playground">

Click here to explore a Prisma API in a GraphQL Playground.

The Prisma API is based on the following datamodel:

graphql
type Post {
  id: ID! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
  isPublished: Boolean! @default(value: "false")
  title: String!
  text: String!
  author: User!
}

type User {
  id: ID! @unique
  email: String! @unique
  password: String!
  name: String!
  posts: [Post!]!
}
</Collapse>

This chapter explains everything you need to know about the Prisma API and how it can be used in various contexts.

PageDescription
Using the Prisma APILearn about various ways to consume the Prisma API using plain HTTP (e.g. curl and fetch).
AuthenticationLearn how to protect your Prisma API using the service secret.
ConceptsLearn about the most important API concepts such as batching, Relay connections, transactions, cascading deletes, ...
QueriesLearn about the auto-generated queries in the Prisma API.
MutationsLearn about the auto-generated mutations in the Prisma API.
SubscriptionsLearn about the auto-generated subscriptions in the Prisma API.
Error HandlingLearn how Prisma deals with errors in API requests.