You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Correct GraphQL mutation capabilities and add official guidance section
- Correct misconception that GraphQL cannot create/modify content
- Add GraphQL mutation examples (createPage, updatePage, deletePage)
- Add Official Guidance section documenting lack of explicit Atlassian guidance
- Add practical considerations for choosing between GraphQL and REST APIs
- Document beta status and performance considerations from community discussions
Copy file name to clipboardExpand all lines: pages/Atlassian___Confluence___API___Concept___GraphQL vs REST.md
+44-2Lines changed: 44 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ tags:: [[Diataxis/Explanation]]
13
13
- ## Key Principles
14
14
- **Query Efficiency**: GraphQL enables fetching multiple related resources in a single request, while REST typically requires multiple endpoint calls
15
15
- **Data Control**: GraphQL clients specify exactly what fields they need, reducing over-fetching of unnecessary data
16
+
- **Write Operations**: Both APIs support CRUD operations, but with different approaches. GraphQL provides mutations like `createPage`, `updatePage`, and `deletePage` for content management. REST provides comprehensive endpoints including dedicated operations like copying pages (`POST /wiki/rest/api/content/{id}/copy`) that don't have direct GraphQL equivalents
16
17
- **Schema Evolution**: GraphQL uses continuous schema evolution with beta fields and deprecation periods, while REST relies on explicit versioning (v1, v2)
17
18
- **Flexibility vs Stability**: REST provides stable, versioned endpoints with predictable behavior, while GraphQL offers flexibility but may change more frequently
18
19
- **Tooling Maturity**: REST benefits from extensive tooling and community support, while GraphQL provides newer tools like GraphQL Explorer for query discovery
@@ -24,8 +25,9 @@ tags:: [[Diataxis/Explanation]]
24
25
- Versioning handled through URL paths (`/api/v1/`, `/api/v2/`)
25
26
- Authentication via OAuth 2.0 or Basic auth
26
27
- **GraphQL API Approach**:
27
-
- Single endpoint for all queries (typically `/graphql`)
28
+
- Single endpoint for all queries and mutations (typically `/graphql`)
28
29
- Clients send queries specifying exact fields and relationships needed
30
+
- Mutations available for creating, updating, and deleting content (e.g., `createPage`, `updatePage`, `deletePage`)
29
31
- Query language allows nested data fetching in one request
- Result: Single mutation request to create and return the new page
71
+
- **Duplicating Pages**: While both APIs can duplicate pages, REST provides a dedicated copy endpoint (`POST /wiki/rest/api/content/{id}/copy`), while GraphQL requires fetching the original page content via query, then creating a new page via mutation
51
72
- **Performance Trade-off**: While GraphQL can reduce request count, it may take longer for complex queries compared to optimized REST v2 endpoints in some scenarios
73
+
- ## Official Guidance
74
+
- **Atlassian has not provided explicit, comprehensive guidance** on when to choose GraphQL vs REST APIs for Confluence
75
+
- Documentation focuses on describing capabilities rather than prescribing when to use each API
76
+
- Developers must evaluate both APIs based on their specific use cases and requirements
77
+
- **Considerations for Choosing**:
78
+
- **Use REST API** when:
79
+
- You need mature, stable, well-documented interfaces
80
+
- Your use case requires specialized operations (e.g., direct page copying)
81
+
- You prioritize maximum feature coverage and tooling support
82
+
- You have existing REST integrations or team familiarity with REST
83
+
- **Consider GraphQL API** when:
84
+
- You need efficient data retrieval with related entities in single queries
85
+
- You want to minimize over-fetching and reduce request count
86
+
- You can work with evolving APIs (GraphQL was in beta as of March 2022)
87
+
- Your use case benefits from schema introspection and strongly-typed queries
88
+
- **Performance Note**: Community testing has shown REST v1 may outperform GraphQL and REST v2 in some scenarios, suggesting performance evaluation is use-case specific
89
+
- **Beta Status**: GraphQL APIs were released in beta as of March 2022, emphasizing that they are still evolving and subject to change based on user feedback
90
+
- **Deprecation Concerns**: Developer community discussions have raised concerns about REST v1 deprecation and the readiness of newer APIs to fully replace older versions
91
+
- See also: [Confluence GraphQL API Documentation](https://developer.atlassian.com/cloud/confluence/graphql/), [Community Performance Discussion](https://community.developer.atlassian.com/t/performance-rest-vs-graphql/69254)
52
92
- ## Misconceptions
53
93
- GraphQL is always faster than REST → **False**. Performance depends on query complexity and server implementation. Some GraphQL queries may be slower than equivalent REST calls
94
+
- GraphQL cannot create or modify content → **False**. GraphQL provides mutations like `createPage`, `updatePage`, and `deletePage` for content management operations. Both APIs support write operations, though REST may offer more specialized endpoints (like direct page copying)
95
+
- GraphQL can do everything REST can do → **Partially false**. While GraphQL has mutations for CRUD operations, REST may have specialized endpoints that don't have direct GraphQL equivalents (e.g., dedicated copy endpoints). For duplicating pages, REST's copy endpoint is more straightforward than GraphQL's query-then-create approach
54
96
- REST v2 is just an updated version of v1 → **False**. REST v2 was redesigned for performance and removed expansions, requiring a different approach to data retrieval
55
-
- GraphQL eliminates the need for REST → **False**. Both APIs serve different purposes. REST may be simpler for straightforward CRUD operations, while GraphQL excels at complex nested data retrieval
97
+
- GraphQL eliminates the need for REST → **False**. Both APIs serve different purposes. REST may have specialized operations and better tooling for certain workflows, while GraphQL excels at complex nested data retrieval and provides a unified interface for queries and mutations
56
98
- GraphQL beta fields are unstable and shouldn't be used → **Partially true**. Beta fields can change without notice and are intended for experimentation, but they provide access to newer features
0 commit comments