ื“ืœื’ ืœืชื•ื›ืŸ ื”ืจืืฉื™

GraphQL API Overview

Using the Gauzy GraphQL API alongside the REST API.

Endpointโ€‹

POST /graphql

GraphQL Playground: http://localhost:3000/graphql

Authenticationโ€‹

Include JWT token in the request headers:

{
"Authorization": "Bearer YOUR_TOKEN"
}

Example Queriesโ€‹

Fetch Employeesโ€‹

query {
employees(
filter: { organizationId: "org-uuid", isActive: true }
paging: { limit: 10, offset: 0 }
) {
edges {
node {
id
user {
firstName
lastName
email
}
startedWorkOn
isActive
}
}
totalCount
}
}

Fetch Tasksโ€‹

query {
tasks(
filter: { projectId: "project-uuid", status: "TODO" }
sorting: [{ field: createdAt, direction: DESC }]
) {
edges {
node {
id
title
status
priority
assignees {
id
user {
firstName
lastName
}
}
}
}
totalCount
}
}

Mutationsโ€‹

Create Taskโ€‹

mutation {
createOneTask(
input: {
task: {
title: "New Task via GraphQL"
status: "TODO"
priority: "HIGH"
projectId: "project-uuid"
organizationId: "org-uuid"
tenantId: "tenant-uuid"
}
}
) {
id
title
status
}
}

Update Employeeโ€‹

mutation {
updateOneEmployee(
input: { id: "employee-uuid", update: { isActive: false } }
) {
id
isActive
}
}

Subscriptionsโ€‹

subscription {
timerStatusChanged {
employeeId
running
duration
}
}

GraphQL vs RESTโ€‹

FeatureGraphQLREST
Data fetchingClient specifies shapeFixed responses
Over-fetchingNoCommon
Under-fetchingNoRequires joins
TypingStrong schemaOpenAPI/Swagger
CachingMore complexStandard HTTP cache