|
61 | 61 | </tbody> |
62 | 62 | </table> |
63 | 63 |
|
| 64 | +<div class="notice"> |
| 65 | + <h2>GraphQL Model Parameters</h2> |
| 66 | + |
| 67 | + <p>In Appwrite's GraphQL API, all internal model parameters are prefixed with <code>_</code> instead of <code>$</code> because <code>$</code> is reserved by GraphQL.</p> |
| 68 | + |
| 69 | + <p>For example, <code>$collectionId</code> in the REST API would be referenced as <code>_collectionId</code> in the GraphQL API.</p> |
| 70 | + |
| 71 | +</div> |
| 72 | + |
| 73 | + |
64 | 74 | <h3><a href="/docs/graphql#get-requests" id="get-requests">GET Requests</a></h3> |
65 | 75 |
|
66 | 76 | <p>You can execute a GraphQL query via a GET request, passing a <code>query</code> and optionally <code>operationName</code> and <code>variables</code> as query parameters.</p> |
|
105 | 115 | <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL"> |
106 | 116 | <pre class="line-numbers"><code class="prism language-graphql" data-prism>query GetAccount { |
107 | 117 | accountGet { |
| 118 | + _id |
108 | 119 | email |
109 | 120 | } |
110 | 121 | }</code></pre></div> |
|
214 | 225 | <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL"> |
215 | 226 | <pre class="line-numbers"><code class="prism language-graphql" data-prism>query GetAccount { |
216 | 227 | accountGet { |
| 228 | + _id |
217 | 229 | email |
218 | 230 | } |
219 | 231 | }</code></pre></div> |
|
224 | 236 | <pre class="line-numbers"><code class="prism language-json" data-prism>{ |
225 | 237 | "data": { |
226 | 238 | "accountGet": { |
| 239 | + "_id": "...", |
227 | 240 | "email": "..." |
228 | 241 | } |
229 | 242 | } |
|
238 | 251 | <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL"> |
239 | 252 | <pre class="line-numbers"><code class="prism language-graphql" data-prism>query GetAccountAndLocale { |
240 | 253 | accountGet { |
| 254 | + _id |
241 | 255 | email |
242 | 256 | } |
243 | 257 | localeGet { |
|
251 | 265 | <pre class="line-numbers"><code class="prism language-json" data-prism>{ |
252 | 266 | "data": { |
253 | 267 | "accountGet": { |
| 268 | + "_id": "...", |
254 | 269 | "email": "..." |
255 | 270 | }, |
256 | 271 | "localeGet": { |
|
296 | 311 |
|
297 | 312 | <p>This allows you to execute complex actions in a single network request.</p> |
298 | 313 |
|
299 | | -<!--<h3><a href="/docs/graphql#databases-integration" id="query-batching">Databases Integration</a></h3>--> |
300 | | -<!----> |
301 | | -<!--<p>The Appwrite GraphQL API integrates directly into your project's database's collections, providing a more convenient way to manipulate your collections.</p>--> |
302 | | -<!----> |
303 | | -<!--<p>For example, given a project with a collection with ID <b>movies</b>, with attributes <b>name</b> and <b>length</b>, of types <b>string</b> and <b>integer</b> respectively; the following queries could be executed:</p>--> |
304 | | -<!----> |
305 | | -<!--<ul class="phases clear" data-ui-phases>--> |
306 | | -<!-- <li>--> |
307 | | -<!-- <h3>Create</h3>--> |
308 | | -<!-- <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">--> |
309 | | -<!-- <pre class="line-numbers"><code class="prism language-graphql" data-prism>mutation CreateMovie($name: String!, $length: Int!) {--> |
310 | | -<!-- moviesCreate(name: $name, length: $length) {--> |
311 | | -<!-- _id--> |
312 | | -<!-- name--> |
313 | | -<!-- length--> |
314 | | -<!-- }--> |
315 | | -<!--}</code></pre>--> |
316 | | -<!-- </div>--> |
317 | | -<!-- </li>--> |
318 | | -<!-- <li>--> |
319 | | -<!-- <h3>List</h3>--> |
320 | | -<!-- <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">--> |
321 | | -<!-- <pre class="line-numbers"><code class="prism language-graphql" data-prism>query ListMovies($limit: Int, $offset: Int, cursor: String, cursorDirection: String, orderAttributes: [String!], orderTypes: [String!]) {--> |
322 | | -<!-- moviesList(limit: $limit, offset: $offset, cursor: $cursor, cursorDirection: $cursorDirection, orderAttributes: $orderAttributes, orderTypes: $orderType) {--> |
323 | | -<!-- _id--> |
324 | | -<!-- name--> |
325 | | -<!-- length--> |
326 | | -<!-- }--> |
327 | | -<!--}</code></pre>--> |
328 | | -<!-- </div>--> |
329 | | -<!-- </li>--> |
330 | | -<!-- <li>--> |
331 | | -<!-- <h3>Get</h3>--> |
332 | | -<!-- <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">--> |
333 | | -<!-- <pre class="line-numbers"><code class="prism language-graphql" data-prism>query GetMovie($id: String!) {--> |
334 | | -<!-- moviesGet(id: $id) {--> |
335 | | -<!-- _id--> |
336 | | -<!-- name--> |
337 | | -<!-- length--> |
338 | | -<!-- }--> |
339 | | -<!--}</code></pre>--> |
340 | | -<!-- </div>--> |
341 | | -<!-- </li>--> |
342 | | -<!-- <li>--> |
343 | | -<!-- <h3>Update</h3>--> |
344 | | -<!-- <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">--> |
345 | | -<!-- <pre class="line-numbers"><code class="prism language-graphql" data-prism>mutation UpdateMovie {--> |
346 | | -<!-- moviesUpdate(name: $name, length: $length) {--> |
347 | | -<!-- _id--> |
348 | | -<!-- name--> |
349 | | -<!-- length--> |
350 | | -<!-- }--> |
351 | | -<!--}</code></pre>--> |
352 | | -<!-- </div>--> |
353 | | -<!-- </li>--> |
354 | | -<!-- <li>--> |
355 | | -<!-- <h3>Delete</h3>--> |
356 | | -<!-- <div class="ide margin-bottom" data-lang="graphql" data-lang-label="GraphQL">--> |
357 | | -<!-- <pre class="line-numbers"><code class="prism language-graphql" data-prism>mutation DeleteMovie($id: String!) {--> |
358 | | -<!-- moviesDelete(id: $id)--> |
359 | | -<!--}</code></pre>--> |
360 | | -<!-- </div>--> |
361 | | -<!-- </li>--> |
362 | | -<!--</ul>--> |
363 | | - |
364 | 314 | <h3><a href="/docs/graphql#sdk-usage" id="sdk-usage">SDK Usage</a></h3> |
365 | 315 |
|
366 | 316 | <p>Appwrite SDKs also support GraphQL in addition to the REST services.</p> |
|
0 commit comments