본문 내용으로 건너뛰기

GraphQL API

clepit의 GraphQL 표면은 문서 모델을 다룹니다. 워크스페이스, 페이지, 블록, 댓글, 검색, 리비전, 공유입니다. 모든 요청에 액세스 토큰이 필요합니다.

JSON
{
  "method": "POST",
  "url": "https://api.clepit.com/graphql",
  "headers": { "Authorization": "Bearer <access token>" }
}

Playground

A graphical explorer is served at GET /graphql in every environment except production.

https://staging.api.clepit.com/graphql

Reading a page tree

GraphQL
query PageTree($workspaceId: String!) {
  pages(workspaceId: $workspaceId) {
    id
    title
    parentId
    position
  }
}

Saving a document

Blocks are stored generically as type plus data, so a block type the server has never seen round-trips untouched rather than being rewritten.

GraphQL
mutation SaveDocument($id: String!, $blocks: [BlockInput!]!) {
  saveDocument(id: $id, blocks: $blocks) {
    id
    updatedAt
  }
}

Subscriptions

Subscribe over WebSocket at wss://api.clepit.com/graphql/ws

JSON
{
  "type": "connection_init",
  "payload": { "Authorization": "Bearer <access token>" }
}