From eac76775b811604df1612480afaae8b9586b8b33 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Wed, 2 Nov 2022 22:52:19 +0000 Subject: [PATCH 01/58] Add auth examples to REST page --- app/views/docs/rest.phtml | 81 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 6 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index d2a838d89..22f21163e 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -1,12 +1,81 @@

Appwrite supports multiple protocols for accessing the server, including REST, GraphQL, and Realtime.

-

The REST API allows you to manipulate your Appwrite server through many endpoints, each representing a specific method of modification to a specific resource type.

+

The REST API allows you to access your Appwrite server through HTTP requests, without the need for an SDK. Each endpoint in the API represents a specific operation on a specific resource.

-

Requests and responses through the REST API follow a rigid structure - that is, they always expect the same structure for requests to a specific endpoint, and responses from that endpoint will also always have the same structure.

+

Headers

+

Appwrite's REST APIs expect certain headers to be attached to each request

-

The specific structures used for Appwrite resources and their related endpoints can be found in the References section for each service.

+ + + + + + + + + + + + + + + + + + + + + +
HeaderDescription
X-Appwrite-Project: [PROJECT-ID]Required, provides the ID of your Appwrite Project to the REST API.
Content-type: application/jsonRequired, declares content type of the HTTP request.
X-Appwrite-key: [API-KEY]Optional, used for authentication in server integrations. Do not use API keys in client applications.
-

Authentication

-

The REST API authenticates using Appwrite accounts and sessions. Both accounts and sessions can be created with REST using the POST /v1/account, /v1/account/sessions/email, /v1/account/sessions/anonymous, or /v1/account/sessions/phone endpoints.

+

Getting Started With REST

+

You can use Appwrite's REST API for both client and server applications.

-

More information and examples of authenticating users can be found in the dedicated authentication guide.

+

Authentication

+

You can create account sessions with POST requests to the Account API. Sessions are persisted using cookies like any other REST API. You can learn more about session persistence in the Authentication Guide.

+

The example below shows creating an account session with the Create Account Session with Email endpoint.

+ + +

Server Authentication

+

Server integrations use API keys to authenticate and are typically used for backend appications.

+

You don't need to create an account session before making requests to Server APIs. Simply pass an API key in the X-Appwrite-key: [API-KEY] header with the appropriate scopes.

From 5562751c83320a52a3f94805262b9827fe9ca59c Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 8 Nov 2022 03:43:15 +0000 Subject: [PATCH 02/58] Add multipart file handling --- app/views/docs/rest.phtml | 83 ++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 14 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 22f21163e..847c75f47 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -28,22 +28,10 @@ -

Getting Started With REST

-

You can use Appwrite's REST API for both client and server applications.

- -

Authentication

+

Client Authentication

You can create account sessions with POST requests to the Account API. Sessions are persisted using cookies like any other REST API. You can learn more about session persistence in the Authentication Guide.

The example below shows creating an account session with the Create Account Session with Email endpoint.

-

Server Authentication

+

Server Authentication

Server integrations use API keys to authenticate and are typically used for backend appications.

You don't need to create an account session before making requests to Server APIs. Simply pass an API key in the X-Appwrite-key: [API-KEY] header with the appropriate scopes.

+ +

File Handling

+

Appwrite implements resumable, chunked uploads for files larger than 5MB. Chunked uploads send files in chunks of 5MB to reduce memory footprint and increase resilience when handling large files. Appwrite SDKs will automatically handle chunked uploads but it is possible to implement this with the REST API directly.

+ +

Upload endpoints in Appwrite such as Create File and Create Deployment are different from other endpoints. These endpoints take multipart form data instead of JSON data. To implement chunked uploads, you will need to implement the following headers

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
HeaderDescription
X-Appwrite-Project: [PROJECT-ID]Required, provides the ID of your Appwrite Project to the REST API.
Content-type: multipart/form-data; boundary=[Generated Form Boundry]'Required, declares content type of the HTTP request and provides a boundry which is used to parse the form data.
x-appwrite-id: [FILE-ID]Required, declares which file this chunk belongs to.
X-Appwrite-key: [API-KEY]Optional, used for authentication in server integrations. Do not use API keys in client applications.
+ +

While cURL and fetch are great tools to explore other REST endpoints, it's impractical to use for chunked file uploads because you need to split files into chunks.

+ + +curl 'https://[HOSTNAME_OR_IP]/v1//storage/buckets/default/files' \ + -H 'Content-Type: multipart/form-data; boundary=------WebKitFormBoundarye0m6iNBQNHlzTpVM' \ + -H 'X-Appwrite-Project: Transcriptions' \ + -H 'content-range: bytes 10485760-12582912/12582912' \ + -H 'x-appwrite-id: 6369b0bc1dcf4ff59051' \ + --data-raw $'------WebKitFormBoundarye0m6iNBQNHlzTpVM + Content-Disposition: form-data; name="fileId" + + unique() + ------WebKitFormBoundarye0m6iNBQNHlzTpVM + Content-Disposition: form-data; name="file"; filename="file.txt" + Content-Type: application/octet-stream + + [Chunked Data] + ------WebKitFormBoundarye0m6iNBQNHlzTpVM + Content-Disposition: form-data; name="permissions" + + [Permissions] + ------WebKitFormBoundarye0m6iNBQNHlzTpVM-- + ' \ + --compressed \ + --insecure From f37c5494812f74bc0b668ef6811b437338575e5f Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 8 Nov 2022 21:40:55 +0000 Subject: [PATCH 03/58] add formdata format --- app/views/docs/rest.phtml | 54 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 847c75f47..c55ebaf60 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -109,10 +109,59 @@ Invoke-WebRequest -UseBasicParsing -Uri "https://[HOSTNAME_OR_IP]/v1/account/ses + + + + + + + + + + + + + + + + + + + + + +
Key:ValueDescription
fileId:[FILE-ID]Required, contains the file ID of the new file. Use "unique()" as the file ID when uploading the first chunk to obtain a generated UUID. Be sure to use the ID returned from the first request in all following requests.
file:[CHUNK-DATA]; filename=[FILE-NAME]Required, contains file chunk data.
permissions:[PERMISSION ARRAY]Required, declares which file this chunk belongs to.
+

While cURL and fetch are great tools to explore other REST endpoints, it's impractical to use for chunked file uploads because you need to split files into chunks.

+

The multipart form data posted to file upload endpoints has the following format:

+ + + +POST /v1//storage/buckets/default/files HTTP/1.1 +Host: [HOSTNAME_OR_IP] +Content-Type: multipart/form-data; boundary=---WD9146A +X-Appwrite-Project: Transcriptions +content-range: bytes 10485760-12582912/12582912 +x-appwrite-id: 6369b0bc1dcf4ff59051 + +------WebKitFormBoundarye0m6iNBQNHlzTpVM +Content-Disposition: form-data; name="fileId" + +unique() +------WebKitFormBoundarye0m6iNBQNHlzTpVM +Content-Disposition: form-data; name="file"; filename="file.txt" +Content-Type: application/octet-stream + +[Chunked Data] +------WebKitFormBoundarye0m6iNBQNHlzTpVM +Content-Disposition: form-data; name="permissions" + +["read(\"user:627a958ded6424a98a9f\")"] +------WebKitFormBoundarye0m6iNBQNHlzTpVM-- + -curl 'https://[HOSTNAME_OR_IP]/v1//storage/buckets/default/files' \ + From 8d08e4107cc24688260cf82c7455dea3e3195be2 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Wed, 9 Nov 2022 21:58:51 +0000 Subject: [PATCH 04/58] Add REST API example using fetch --- app/views/docs/rest.phtml | 120 +++++++++++++++++++++++++------------- 1 file changed, 79 insertions(+), 41 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index c55ebaf60..a4ef6fbda 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -3,7 +3,7 @@

The REST API allows you to access your Appwrite server through HTTP requests, without the need for an SDK. Each endpoint in the API represents a specific operation on a specific resource.

Headers

-

Appwrite's REST APIs expect certain headers to be attached to each request

+

Appwrite's REST APIs expect certain headers to be attached to each request:

@@ -80,7 +80,7 @@ Invoke-WebRequest -UseBasicParsing -Uri "https://[HOSTNAME_OR_IP]/v1/account/ses

File Handling

Appwrite implements resumable, chunked uploads for files larger than 5MB. Chunked uploads send files in chunks of 5MB to reduce memory footprint and increase resilience when handling large files. Appwrite SDKs will automatically handle chunked uploads but it is possible to implement this with the REST API directly.

-

Upload endpoints in Appwrite such as Create File and Create Deployment are different from other endpoints. These endpoints take multipart form data instead of JSON data. To implement chunked uploads, you will need to implement the following headers

+

Upload endpoints in Appwrite such as Create File and Create Deployment are different from other endpoints. These endpoints take multipart form data instead of JSON data. To implement chunked uploads, you will need to implement the following headers:

@@ -92,15 +92,19 @@ Invoke-WebRequest -UseBasicParsing -Uri "https://[HOSTNAME_OR_IP]/v1/account/ses - + + + + + - - + + - + @@ -109,24 +113,34 @@ Invoke-WebRequest -UseBasicParsing -Uri "https://[HOSTNAME_OR_IP]/v1/account/ses
X-Appwrite-Project: [PROJECT-ID]Required, provides the ID of your Appwrite Project to the REST API.Required, contains the ID of your Appwrite Project to the REST API.
Content-type: multipart/form-data; boundary=[FORM-BOUNDRY]Required, contains the content type of the HTTP request and provides a boundry which is used to parse the form data.
Content-type: multipart/form-data; boundary=[Generated Form Boundry]'Required, declares content type of the HTTP request and provides a boundry which is used to parse the form data.content-range: bytes [BYTE-RANGE]Required, contains information about which bytes are being transmitted in the format [FIRST-BYTE]-[LAST-BYTE]/[TOTAL-BYTES].
x-appwrite-id: [FILE-ID]Required, declares which file this chunk belongs to.Required, contains which file this chunk belongs to.
X-Appwrite-key: [API-KEY]
+

The multipart form data is structured as follows:

+ - + + + - + + + - + + + - + + + @@ -136,12 +150,11 @@ Invoke-WebRequest -UseBasicParsing -Uri "https://[HOSTNAME_OR_IP]/v1/account/ses

The multipart form data posted to file upload endpoints has the following format:

- - -POST /v1//storage/buckets/default/files HTTP/1.1 +
+
POST /v1//storage/buckets/default/files HTTP/1.1
 Host: [HOSTNAME_OR_IP]
 Content-Type: multipart/form-data; boundary=---WD9146A
-X-Appwrite-Project: Transcriptions
+X-Appwrite-Project: demo-project
 content-range: bytes 10485760-12582912/12582912
 x-appwrite-id: 6369b0bc1dcf4ff59051
 
@@ -153,34 +166,59 @@ unique()
 Content-Disposition: form-data; name="file"; filename="file.txt"
 Content-Type: application/octet-stream
 
-[Chunked Data]
+[CHUNKED-DATA]
 ------WebKitFormBoundarye0m6iNBQNHlzTpVM
 Content-Disposition: form-data; name="permissions"
 
 ["read(\"user:627a958ded6424a98a9f\")"]
-------WebKitFormBoundarye0m6iNBQNHlzTpVM--
-
-
-
+------WebKitFormBoundarye0m6iNBQNHlzTpVM--
+
+ +

+ +
+
// 5MB Chunks.
+const CHUNK_SIZE = 1024 * 1024 * 5;
+
+// Form Data for the first chunk.
+var form1 = new FormData();
+form1.append('fileId', "unique()");
+form1.append('filename', 'exampleFile.txt');
+form1.append('file', dataChunks[0], { filename:  'exampleFile.txt'});
+
+// Upload the first chunk.
+const request1 = await fetch("http://[HOSTNAME_OR_IP]/v1/storage/buckets/default/files", {
+  "headers": {
+    "content-range": "bytes 0-5242879/6000000",
+    "content-type": `multipart/form-data; boundary=${form1.getBoundary()}`,
+    "x-appwrite-project": "demo-project",
+    "X-Appwrite-key":APPWRITE_KEY,
+  },
+  "body": form1,
+  "method": "POST"
+});
+
+// Save the generated file ID returned by Appwrite.
+const response1 = await request1.json();
+const generatedFileId = response1['$id'];
+
+// Form Data for the second chunk.
+var form2 = new FormData();
+form2.append('fileId', generatedFileId);
+form2.append('filename', 'exampleFile.txt');
+form2.append('file', dataChunks[1], { filename:  'exampleFile.txt'});
+
+// Upload the second chunk
+const request2 = await fetch("http://[HOSTNAME_OR_IP]/v1/storage/buckets/default/files", {
+  "headers": {
+    "content-range": "bytes 5242890-6000000/6000000",
+    "content-type": `multipart/form-data; boundary=${form2.getBoundary()}`,
+    "x-appwrite-project": "demo-project",
+    "x-appwrite-id": generatedFileId, // File ID from the first chunk.
+    "X-Appwrite-key":APPWRITE_KEY,
+  },
+  "body": form2,
+  "method": "POST"
+});
+
+const response2 = await request2.json();
\ No newline at end of file From 7c753f8ee149411bec456696cbb73ce1685be70d Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 10 Nov 2022 21:26:49 +0000 Subject: [PATCH 05/58] Let's just use raw HTTP requests as examples --- app/views/docs/rest.phtml | 112 +++++++------------------------------- 1 file changed, 20 insertions(+), 92 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index a4ef6fbda..d2a7b0676 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -31,52 +31,29 @@

Client Authentication

You can create account sessions with POST requests to the Account API. Sessions are persisted using cookies like any other REST API. You can learn more about session persistence in the Authentication Guide.

The example below shows creating an account session with the Create Account Session with Email endpoint.

-
    -
  • -

    Fetch

    -
    -
    fetch("https://[HOSTNAME_OR_IP]/v1/account/sessions/email", {
    -  "headers": {
    -    "content-type": "application/json",
    -    "x-appwrite-project": "6318f4f66a3bb5b4d525"
    -  },
    -  "body": "{\"email\":\"vincent123456@appwrite.io\",\"password\":\"vincent123456\"}",
    -  "method": "POST",
    -});
    -
    -
  • -
  • -

    cURL

    -
    -
    curl 'https://[HOSTNAME_OR_IP]/v1/account/sessions/email' \
    -  -H 'content-type: application/json' \
    -  -H 'x-appwrite-project: 6062f9c2c09ce' \
    -  -d '{"email":"","password":""}'
    -
    -
  • -
  • -

    PowerShell

    -
    -
    $session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
    -Invoke-WebRequest -UseBasicParsing -Uri "https://[HOSTNAME_OR_IP]/v1/account/sessions/email" `
    --Method "POST" `
    --WebSession $session `
    --Headers @{
    -  "method"="POST"
    -  "path"="/v1/account/sessions/email"
    -  "scheme"="https"
    -  "x-appwrite-project"="6062f9c2c09ce"
    -} `
    --ContentType "application/json" `
    --Body "{`"email`":`"vincent123456@appwrite.io`",`"password`":`"vincent123456`"}"
    -
    -
  • -
+
+
POST /v1/account/sessions/email  HTTP/1.1
+Host: [HOSTNAME_OR_IP]
+Content-Type: application/json
+X-Appwrite-Project: 5df5acd0d48c2
+X-Appwrite-Response-Format: 1.0.0
+
+{"email":"example@email.com","password":"password"}
+

Server Authentication

Server integrations use API keys to authenticate and are typically used for backend appications.

You don't need to create an account session before making requests to Server APIs. Simply pass an API key in the X-Appwrite-key: [API-KEY] header with the appropriate scopes.

+
+
GET /databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1
+Host: [HOSTNAME_OR_IP]
+Content-Type: application/json
+X-Appwrite-Project: [PROJECT_ID]
+X-Appwrite-key: [API_KEY]
+X-Appwrite-Response-Format: 1.0.0
+
+

File Handling

Appwrite implements resumable, chunked uploads for files larger than 5MB. Chunked uploads send files in chunks of 5MB to reduce memory footprint and increase resilience when handling large files. Appwrite SDKs will automatically handle chunked uploads but it is possible to implement this with the REST API directly.

@@ -151,7 +128,7 @@ Invoke-WebRequest -UseBasicParsing -Uri "https://[HOSTNAME_OR_IP]/v1/account/ses

The multipart form data posted to file upload endpoints has the following format:

-
POST /v1//storage/buckets/default/files HTTP/1.1
+    
POST /v1/storage/buckets/default/files HTTP/1.1
 Host: [HOSTNAME_OR_IP]
 Content-Type: multipart/form-data; boundary=---WD9146A
 X-Appwrite-Project: demo-project
@@ -172,53 +149,4 @@ Content-Disposition: form-data; name="permissions"
 
 ["read(\"user:627a958ded6424a98a9f\")"]
 ------WebKitFormBoundarye0m6iNBQNHlzTpVM--
-
- -

- -
-
// 5MB Chunks.
-const CHUNK_SIZE = 1024 * 1024 * 5;
-
-// Form Data for the first chunk.
-var form1 = new FormData();
-form1.append('fileId', "unique()");
-form1.append('filename', 'exampleFile.txt');
-form1.append('file', dataChunks[0], { filename:  'exampleFile.txt'});
-
-// Upload the first chunk.
-const request1 = await fetch("http://[HOSTNAME_OR_IP]/v1/storage/buckets/default/files", {
-  "headers": {
-    "content-range": "bytes 0-5242879/6000000",
-    "content-type": `multipart/form-data; boundary=${form1.getBoundary()}`,
-    "x-appwrite-project": "demo-project",
-    "X-Appwrite-key":APPWRITE_KEY,
-  },
-  "body": form1,
-  "method": "POST"
-});
-
-// Save the generated file ID returned by Appwrite.
-const response1 = await request1.json();
-const generatedFileId = response1['$id'];
-
-// Form Data for the second chunk.
-var form2 = new FormData();
-form2.append('fileId', generatedFileId);
-form2.append('filename', 'exampleFile.txt');
-form2.append('file', dataChunks[1], { filename:  'exampleFile.txt'});
-
-// Upload the second chunk
-const request2 = await fetch("http://[HOSTNAME_OR_IP]/v1/storage/buckets/default/files", {
-  "headers": {
-    "content-range": "bytes 5242890-6000000/6000000",
-    "content-type": `multipart/form-data; boundary=${form2.getBoundary()}`,
-    "x-appwrite-project": "demo-project",
-    "x-appwrite-id": generatedFileId, // File ID from the first chunk.
-    "X-Appwrite-key":APPWRITE_KEY,
-  },
-  "body": form2,
-  "method": "POST"
-});
-
-const response2 = await request2.json();
\ No newline at end of file + \ No newline at end of file From 574adb8f74c0498126c316ba514941cb0ddd9562 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 11 Nov 2022 01:00:39 +0000 Subject: [PATCH 06/58] permission magic strings --- app/views/docs/rest.phtml | 41 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index d2a7b0676..3d20bfb64 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -149,4 +149,43 @@ Content-Disposition: form-data; name="permissions" ["read(\"user:627a958ded6424a98a9f\")"] ------WebKitFormBoundarye0m6iNBQNHlzTpVM-- - \ No newline at end of file + + +

Permissions

+ +

Appwrite SDKs have helpers to generate permission strings, but when using Appwrite without SDKs, you'd need to create the strings yourself.

+ +
Key:ValueKeyValueFile Name Description
fileId:[FILE-ID]fileId[FILE-ID] Required, contains the file ID of the new file. Use "unique()" as the file ID when uploading the first chunk to obtain a generated UUID. Be sure to use the ID returned from the first request in all following requests.
file:[CHUNK-DATA]; filename=[FILE-NAME]file[CHUNK-DATA][FILE-NAME] Required, contains file chunk data.
permissions:[PERMISSION ARRAY]permissions[PERMISSION ARRAY] Required, declares which file this chunk belongs to.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SDKPermission String
Role.any()"any"
Role.guests()"user:[ID]"
Role.users([STATUS])"users/[STATUS]"
Role.user([USER_ID], [STATUS])"user:[USER_ID]/[STATUS]"
Role.team([TEAM_ID])"team:[TEAM_ID]"
Role.team([TEAM_ID], [ROLE])"team:[TEAM_ID]/[ROLE]"
From 341d8d4a16e5670c02348f028a808a9b76568ce5 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 11 Nov 2022 18:41:39 +0000 Subject: [PATCH 07/58] Added more magic strings --- app/views/docs/rest.phtml | 110 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 3d20bfb64..992e5289c 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -155,6 +155,8 @@ Content-Disposition: form-data; name="permissions"

Appwrite SDKs have helpers to generate permission strings, but when using Appwrite without SDKs, you'd need to create the strings yourself.

+

Permission Types

+ @@ -163,6 +165,39 @@ Content-Disposition: form-data; name="permissions" + + + + + + + + + + + + + + + + + + + + + +
Permission.read() "read(\"[PERMISSION_ROLE]\")"
Permission.create()"create(\"[PERMISSION_ROLE]\")"
Permission.update()"update(\"[PERMISSION_ROLE]\")"
Permission.delete()"delete(\"[PERMISSION_ROLE]\")"
Permission.write()"write(\"[PERMISSION_ROLE]\")"
+ +

Permission Roles

+ + + + + + + + + @@ -189,3 +224,78 @@ Content-Disposition: form-data; name="permissions"
SDKRole String
Role.any() "any"
+ + + +

Unique ID

+Appwrite's SDKs have a helper ID.unqiue() to generate unique IDs. When using Appwrite without an SDK, pass the string "unique()" into the ID parameter. + +

Query Methods

+Appwrite's SDKs provides a Query class to generate query strings. When using Appwrite without an SDK, you can template your own strings with the format below. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Query MethodQuery String
equal"equal(\"attribute\", [\"value1\", ...])"
notEqual"notEqual(\"attribute\", [\"value1\", ...])"
lessThan"lessThan(\"attribute\", [\"value1\", ...])"
lessThanEqual"lessThanEqual(\"attribute\", [\"value1\", ...])"
greaterThan"greaterThan(\"attribute\", [\"value1\", ...])"
greaterThanEqual"greaterThanEqual(\"attribute\", [\"value1\", ...])"
search"search(\"attribute\", [\"value1\", ...])"
orderDesc"orderDesc(\"attribute\")"
orderAsc"orderAsc(\"attribute\")"
cursorAfter"cursorAfter(\"documentId\")"
cursorBefore"cursorBefore(\"documentId\")"
limit"limit(0)"
offset"offset(0)"
+ +

Full REST API docs

From bf0341703b08bf9fc982e7975b0969ab885a1d14 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 11 Nov 2022 20:11:50 +0000 Subject: [PATCH 08/58] Added Open API specs --- app/views/docs/rest.phtml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 992e5289c..4b93b56dd 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -298,4 +298,9 @@ Appwrite's SDKs provides a Query class to generate query strings. W -

Full REST API docs

+

OpenAPI and Swagger Specs

+Appwrite provides full REST API specs in the OpenAPI 3 and Swagger format every release. These can be accessed through Appwrites GitHub repository and rendered using a variety of parsers and tools. + + From 6219a22477b9e4db9a7fe86e66690b5784fef5bd Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 11 Nov 2022 20:30:09 +0000 Subject: [PATCH 09/58] check formatting --- app/views/docs/rest.phtml | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 4b93b56dd..27a3599aa 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -8,7 +8,7 @@ - + @@ -62,7 +62,7 @@ X-Appwrite-Response-Format: 1.0.0
HeaderHeader Description
- + @@ -95,27 +95,27 @@ X-Appwrite-Response-Format: 1.0.0
HeaderHeader Description
- - - - + + + + - + - + - + - + @@ -160,7 +160,7 @@ Content-Disposition: form-data; name="permissions"
KeyValueFile NameDescriptionKeyValueFile NameDescription
fileIdfileId [FILE-ID] Required, contains the file ID of the new file. Use "unique()" as the file ID when uploading the first chunk to obtain a generated UUID. Be sure to use the ID returned from the first request in all following requests.Required, contains the file ID of the new file. Use "unique()" for a UUID
filefile [CHUNK-DATA] [FILE-NAME] Required, contains file chunk data.
permissionspermissions [PERMISSION ARRAY] Required, declares which file this chunk belongs to.
- + @@ -193,7 +193,7 @@ Content-Disposition: form-data; name="permissions"
SDKSDK Permission String
- + @@ -230,15 +230,18 @@ Content-Disposition: form-data; name="permissions"

Unique ID

+

Appwrite's SDKs have a helper ID.unqiue() to generate unique IDs. When using Appwrite without an SDK, pass the string "unique()" into the ID parameter. +

Query Methods

+

Appwrite's SDKs provides a Query class to generate query strings. When using Appwrite without an SDK, you can template your own strings with the format below. - +

SDKSDK Role String
- + @@ -299,8 +302,9 @@ Appwrite's SDKs provides a Query class to generate query strings. W
Query MethodQuery Method Query String

OpenAPI and Swagger Specs

+

Appwrite provides full REST API specs in the OpenAPI 3 and Swagger format every release. These can be accessed through Appwrites GitHub repository and rendered using a variety of parsers and tools. - +

From 878fd46889fdc1d52499bd232afe754353c76a05 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 11 Nov 2022 20:46:34 +0000 Subject: [PATCH 10/58] Cleaned up empty cells for review --- app/views/docs/rest.phtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 27a3599aa..d9bf2abf3 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -105,8 +105,8 @@ X-Appwrite-Response-Format: 1.0.0
fileId [FILE-ID] - - Required, contains the file ID of the new file. Use "unique()" for a UUID + n/a + Required, contains the file ID of the new file. Use "unique()" for a UUID. file @@ -117,7 +117,7 @@ X-Appwrite-Response-Format: 1.0.0
permissions [PERMISSION ARRAY] - + n/a Required, declares which file this chunk belongs to. From 62dd93da67c8807a1f9a8389a90d674df6fc722e Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 11 Nov 2022 20:49:17 +0000 Subject: [PATCH 11/58] Fix HTTP formatting --- app/views/docs/rest.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index d9bf2abf3..5c2debfad 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -46,7 +46,7 @@ X-Appwrite-Response-Format: 1.0.0

You don't need to create an account session before making requests to Server APIs. Simply pass an API key in the X-Appwrite-key: [API-KEY] header with the appropriate scopes.

-
GET /databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1
+    
GET /v1/databases/{databaseId}/collections/{collectionId}/documents  HTTP/1.1
 Host: [HOSTNAME_OR_IP]
 Content-Type: application/json
 X-Appwrite-Project: [PROJECT_ID]
@@ -128,7 +128,7 @@ X-Appwrite-Response-Format: 1.0.0

The multipart form data posted to file upload endpoints has the following format:

-
POST /v1/storage/buckets/default/files HTTP/1.1
+    
POST /v1/storage/buckets/default/files  HTTP/1.1
 Host: [HOSTNAME_OR_IP]
 Content-Type: multipart/form-data; boundary=---WD9146A
 X-Appwrite-Project: demo-project

From 94b006fb1cacc24cef177c80ddf5b89f1e6e0dc8 Mon Sep 17 00:00:00 2001
From: "Vincent (Wen Yu) Ge" 
Date: Tue, 15 Nov 2022 15:52:56 -0500
Subject: [PATCH 12/58] Update app/views/docs/rest.phtml

Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com>
---
 app/views/docs/rest.phtml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml
index 5c2debfad..f1319dce4 100644
--- a/app/views/docs/rest.phtml
+++ b/app/views/docs/rest.phtml
@@ -30,7 +30,7 @@
 
 

Client Authentication

You can create account sessions with POST requests to the Account API. Sessions are persisted using cookies like any other REST API. You can learn more about session persistence in the Authentication Guide.

-

The example below shows creating an account session with the Create Account Session with Email endpoint.

+

The example below shows creating an account session with the Create Account Session with Email endpoint.

POST /v1/account/sessions/email  HTTP/1.1
 Host: [HOSTNAME_OR_IP]

From d839c5acbcf6fa1f43bae58fad1feed1d8a8185b Mon Sep 17 00:00:00 2001
From: "Vincent (Wen Yu) Ge" 
Date: Tue, 15 Nov 2022 15:54:57 -0500
Subject: [PATCH 13/58] Update app/views/docs/rest.phtml

Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com>
---
 app/views/docs/rest.phtml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml
index f1319dce4..e74e7741d 100644
--- a/app/views/docs/rest.phtml
+++ b/app/views/docs/rest.phtml
@@ -145,9 +145,9 @@ Content-Type: application/octet-stream
 
 [CHUNKED-DATA]
 ------WebKitFormBoundarye0m6iNBQNHlzTpVM
-Content-Disposition: form-data; name="permissions"
+Content-Disposition: form-data; name="permissions[]"
 
-["read(\"user:627a958ded6424a98a9f\")"]
+read("user:627a958ded6424a98a9f")
 ------WebKitFormBoundarye0m6iNBQNHlzTpVM--
From a77bccf330b3bc1ac73f2b7190f22d5a3ea2b1cb Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 15 Nov 2022 15:56:20 -0500 Subject: [PATCH 14/58] Update app/views/docs/rest.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index e74e7741d..1379238a9 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -204,7 +204,7 @@ read("user:627a958ded6424a98a9f") Role.guests() - "user:[ID]" + "guests" Role.users([STATUS]) From 356d1d29c141494d254c61cbb25de140144f8587 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 15 Nov 2022 15:56:29 -0500 Subject: [PATCH 15/58] Update app/views/docs/rest.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 1379238a9..8f2b8c44b 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -166,7 +166,7 @@ read("user:627a958ded6424a98a9f") - Permission.read() + Permission.read() "read(\"[PERMISSION_ROLE]\")" From 56623487bbafc9dea80aa6ed1119d7067925ed83 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 15 Nov 2022 21:58:49 +0000 Subject: [PATCH 16/58] Fix permission field description --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 8f2b8c44b..ed8dc40e4 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -118,7 +118,7 @@ X-Appwrite-Response-Format: 1.0.0
permissions [PERMISSION ARRAY] n/a - Required, declares which file this chunk belongs to. + Required, contains an array of permission strings about who can access the new file. From b87b47ac13f75be5377c120c049fb054399e46f0 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Fri, 18 Nov 2022 23:10:47 +0000 Subject: [PATCH 17/58] Adds missing headers and query information --- app/views/docs/rest.phtml | 43 +++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index ed8dc40e4..f7e6f71bf 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -25,9 +25,23 @@ X-Appwrite-key: [API-KEY] Optional, used for authentication in server integrations. Do not use API keys in client applications. + + X-Appwrite-Response-Format: [VERSION-NUMBER] + Optional, used for backwards compatibility. The response will be formatted to be compatible the provided version number. + + + X-Fallback-Cookies: [FALLBACK-COOKIES] + Optional, used in scenarios where browsers do not allow third-party cookies. Often used for Custom Domains. + +

Using Appwrite Without Headers

+

Some use cases do not allow the use of custom headers, such as when embedding images from Appwrite in HTML. In these cases, you can provide the Appwrite project ID using the query parameter project.

+
+
+
+

Client Authentication

You can create account sessions with POST requests to the Account API. Sessions are persisted using cookies like any other REST API. You can learn more about session persistence in the Authentication Guide.

The example below shows creating an account session with the Create Account Session with Email endpoint.

@@ -238,6 +252,9 @@ Appwrite's SDKs have a helper ID.unqiue() to generate unique IDs. W

Appwrite's SDKs provides a Query class to generate query strings. When using Appwrite without an SDK, you can template your own strings with the format below.

+ +

Query strings are passed to Appwrite using the queries query parameters. You can attack multiple query strings under the queries query parameter.

+ @@ -248,55 +265,55 @@ Appwrite's SDKs provides a Query class to generate query strings. W - + - + - + - + - + - + - + - + - + - + - + - + - +
equal"equal(\"attribute\", [\"value1\", ...])"equal("attribute", ["value1", ...])
notEqual"notEqual(\"attribute\", [\"value1\", ...])"notEqual("attribute", ["value1", ...])
lessThan"lessThan(\"attribute\", [\"value1\", ...])"lessThan("attribute", [value1, ...])
lessThanEqual"lessThanEqual(\"attribute\", [\"value1\", ...])"lessThanEqual("attribute", [value1, ...])
greaterThan"greaterThan(\"attribute\", [\"value1\", ...])"greaterThan("attribute", [value1, ...])
greaterThanEqual"greaterThanEqual(\"attribute\", [\"value1\", ...])"greaterThanEqual("attribute", [value1, ...])
search"search(\"attribute\", [\"value1\", ...])"search("attribute", [value1, ...])
orderDesc"orderDesc(\"attribute\")"orderDesc("attribute")
orderAsc"orderAsc(\"attribute\")"orderAsc("attribute")
cursorAfter"cursorAfter(\"documentId\")"cursorAfter("documentId")
cursorBefore"cursorBefore(\"documentId\")"cursorBefore("documentId")
limit"limit(0)"limit(0)
offset"offset(0)"offset(0)
From 228277e33d7e6d95bb5b822886932793d973cb74 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 21 Nov 2022 16:26:35 +0000 Subject: [PATCH 18/58] Added membership string to REST docs --- app/views/docs/rest.phtml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index f7e6f71bf..613c7966b 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -236,6 +236,10 @@ read("user:627a958ded6424a98a9f") Role.team([TEAM_ID], [ROLE]) "team:[TEAM_ID]/[ROLE]" + + Role.member([MEMBERSHIP_ID]) + "member:[MEMBERSHIP_ID]" + From be72373eb754aef8eca548646079a9961010038f Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 24 Nov 2022 12:50:46 -0500 Subject: [PATCH 19/58] Update app/views/docs/rest.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 613c7966b..285e1fa6b 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -31,7 +31,7 @@ X-Fallback-Cookies: [FALLBACK-COOKIES] - Optional, used in scenarios where browsers do not allow third-party cookies. Often used for Custom Domains. + Optional, used in scenarios where browsers do not allow third-party cookies. Often used when there is no Custom Domain. From 7666746e1eeaa010654da26d50e08c2dba72016e Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 24 Nov 2022 12:51:19 -0500 Subject: [PATCH 20/58] Update app/views/docs/rest.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 285e1fa6b..f36c37b94 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -257,7 +257,7 @@ Appwrite's SDKs have a helper ID.unqiue() to generate unique IDs. W Appwrite's SDKs provides a Query class to generate query strings. When using Appwrite without an SDK, you can template your own strings with the format below.

-

Query strings are passed to Appwrite using the queries query parameters. You can attack multiple query strings under the queries query parameter.

+

Query strings are passed to Appwrite using the queries query parameters. You can attach multiple query strings under the queries query parameter.

From 4f93fea8358495a3d2628c9446ce495d694ce6bd Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 24 Nov 2022 12:52:27 -0500 Subject: [PATCH 21/58] Update app/views/docs/rest.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index f36c37b94..6f9826c7e 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -22,7 +22,7 @@ - + From 6d64a04a1051691cc3923d79b9daf84bc4e64710 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 24 Nov 2022 12:52:31 -0500 Subject: [PATCH 22/58] Update app/views/docs/rest.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 6f9826c7e..65b2f480d 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -64,7 +64,7 @@ X-Appwrite-Response-Format: 1.0.0 Host: [HOSTNAME_OR_IP] Content-Type: application/json X-Appwrite-Project: [PROJECT_ID] -X-Appwrite-key: [API_KEY] +X-Appwrite-Key: [API_KEY] X-Appwrite-Response-Format: 1.0.0 From 675cc36d94fba4c688fb71a6f9619c2bf7347731 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 24 Nov 2022 12:52:37 -0500 Subject: [PATCH 23/58] Update app/views/docs/rest.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 65b2f480d..655bc8a16 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -112,7 +112,7 @@ X-Appwrite-Response-Format: 1.0.0 - + From 1c43c6bd90d19ca7dde420e232979c959edec33b Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 24 Nov 2022 12:52:45 -0500 Subject: [PATCH 24/58] Update app/views/docs/rest.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 655bc8a16..3ac3a7d9c 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -324,7 +324,7 @@ Appwrite's SDKs provides a Query class to generate query strings. W

OpenAPI and Swagger Specs

-Appwrite provides full REST API specs in the OpenAPI 3 and Swagger format every release. These can be accessed through Appwrites GitHub repository and rendered using a variety of parsers and tools. +Appwrite provides full REST API specs in the OpenAPI 3 and Swagger formats every release. These can be accessed through Appwrite's GitHub repository and rendered using a variety of parsers and tools.

  • Find REST API specs for your Appwrite version
  • From 6bb5629cf269e316fe72bdb481fade07284c6e88 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Thu, 24 Nov 2022 20:26:17 +0000 Subject: [PATCH 25/58] Addes best practice note and fixes permission string format --- app/views/docs/rest.phtml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 3ac3a7d9c..b33b6132e 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -181,23 +181,23 @@ read("user:627a958ded6424a98a9f")
- + - + - + - + - +
Required, declares content type of the HTTP request.
X-Appwrite-key: [API-KEY]X-Appwrite-Key: [API-KEY] Optional, used for authentication in server integrations. Do not use API keys in client applications.
Key Value File NameDescriptionDescription
Permission.read()"read(\"[PERMISSION_ROLE]\")"read("[PERMISSION_ROLE]")
Permission.create()"create(\"[PERMISSION_ROLE]\")"create("[PERMISSION_ROLE]")
Permission.update()"update(\"[PERMISSION_ROLE]\")"update("[PERMISSION_ROLE]")
Permission.delete()"delete(\"[PERMISSION_ROLE]\")"delete("[PERMISSION_ROLE]")
Permission.write()"write(\"[PERMISSION_ROLE]\")"write("[PERMISSION_ROLE]")
@@ -269,27 +269,27 @@ Appwrite's SDKs provides a Query class to generate query strings. W equal - equal("attribute", ["value1", ...]) + equal("attribute", [value1, ...]) notEqual - notEqual("attribute", ["value1", ...]) + notEqual("attribute", [value1, ...]) lessThan - lessThan("attribute", [value1, ...]) + lessThan("attribute", [value]) lessThanEqual - lessThanEqual("attribute", [value1, ...]) + lessThanEqual("attribute", [value]) greaterThan - greaterThan("attribute", [value1, ...]) + greaterThan("attribute", [value]) greaterThanEqual - greaterThanEqual("attribute", [value1, ...]) + greaterThanEqual("attribute", [value]) search @@ -322,6 +322,12 @@ Appwrite's SDKs provides a Query class to generate query strings. W +
+

Best Practice

+

When using greater than, greater than and equal to, less than, and less than and equal to, it is not recommended to pass in multiple values. While the API will accept multiple values and return results with or logic, it's best practice to pass in only one value for performance reasons.

+
+ +

OpenAPI and Swagger Specs

Appwrite provides full REST API specs in the OpenAPI 3 and Swagger formats every release. These can be accessed through Appwrite's GitHub repository and rendered using a variety of parsers and tools. From 5016a3f0d08c1240566e0f0be28b903fc953939f Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:52:54 -0500 Subject: [PATCH 26/58] Update app/views/docs/rest.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index b33b6132e..fa5e98615 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -56,7 +56,7 @@ X-Appwrite-Response-Format: 1.0.0

Server Authentication

-

Server integrations use API keys to authenticate and are typically used for backend appications.

+

Server integrations use API keys to authenticate and are typically used for backend applications.

You don't need to create an account session before making requests to Server APIs. Simply pass an API key in the X-Appwrite-key: [API-KEY] header with the appropriate scopes.

From f6b9799a7bfee80325a9f64d1480a649a66228cb Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:53:44 -0500 Subject: [PATCH 27/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index fa5e98615..adc625543 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -3,7 +3,7 @@

The REST API allows you to access your Appwrite server through HTTP requests, without the need for an SDK. Each endpoint in the API represents a specific operation on a specific resource.

Headers

-

Appwrite's REST APIs expect certain headers to be attached to each request:

+

Appwrite's REST APIs expect certain headers to be included with each request:

From d5d626e9f37d94df705cead3da482c75cdd4a63d Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:54:41 -0500 Subject: [PATCH 28/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index adc625543..b3a6b54a8 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -18,7 +18,7 @@ - + From 01beb6990d4a25f6c461c53a43b3518f2fbe3a4f Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:54:51 -0500 Subject: [PATCH 29/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index b3a6b54a8..07a2ee97d 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -333,5 +333,5 @@ Appwrite's SDKs provides a Query class to generate query strings. W Appwrite provides full REST API specs in the OpenAPI 3 and Swagger formats every release. These can be accessed through Appwrite's GitHub repository and rendered using a variety of parsers and tools.

From 005f27e06217e0c0d935f7a56bee1f815518b8ce Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:54:58 -0500 Subject: [PATCH 30/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 07a2ee97d..0ee998f3f 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -330,7 +330,7 @@ Appwrite's SDKs provides a Query class to generate query strings. W

OpenAPI and Swagger Specs

-Appwrite provides full REST API specs in the OpenAPI 3 and Swagger formats every release. These can be accessed through Appwrite's GitHub repository and rendered using a variety of parsers and tools. +Appwrite provides a full REST API specification in the OpenAPI 3 and Swagger 2 formats every release. These can be accessed through Appwrite's GitHub repository and rendered using a variety of parsers and tools.

  • Find the REST API specification for your Appwrite version
  • From cd3ea22f94ddc867cbdc792a26799a895707b15b Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:55:09 -0500 Subject: [PATCH 31/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 0ee998f3f..d39cc1024 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -324,7 +324,7 @@ Appwrite's SDKs provides a Query class to generate query strings. W

    Best Practice

    -

    When using greater than, greater than and equal to, less than, and less than and equal to, it is not recommended to pass in multiple values. While the API will accept multiple values and return results with or logic, it's best practice to pass in only one value for performance reasons.

    +

    When using greater than, greater than or equal to, less than, or less than or equal to, it is not recommended to pass in multiple values. While the API will accept multiple values and return results with or logic, it's best practice to pass in only one value for performance reasons.

    From d42c4d2447753eb10156ed5e49cf6dc8e73fb0cf Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:55:44 -0500 Subject: [PATCH 32/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index d39cc1024..10d02a5bc 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -257,7 +257,7 @@ Appwrite's SDKs have a helper ID.unqiue() to generate unique IDs. W Appwrite's SDKs provides a Query class to generate query strings. When using Appwrite without an SDK, you can template your own strings with the format below.

    -

    Query strings are passed to Appwrite using the queries query parameters. You can attach multiple query strings under the queries query parameter.

    +

    Query strings are passed to Appwrite using the queries parameter. You can attach multiple query strings by including the array parameter multiple times in the query string: queries[]="..."&queries[]="..."

Required, provides the ID of your Appwrite Project to the REST API.
Content-type: application/jsonContent-Type: application/json Required, declares content type of the HTTP request.
From d641d138b5b1adcb03348e3161e37ec59b551c4e Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:56:04 -0500 Subject: [PATCH 33/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 10d02a5bc..d9cda1753 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -86,7 +86,7 @@ X-Appwrite-Response-Format: 1.0.0 - + From d5a522ed13482b935be68711951cfd93b6fdafc1 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:56:40 -0500 Subject: [PATCH 34/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index d9cda1753..32805cac0 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -90,7 +90,7 @@ X-Appwrite-Response-Format: 1.0.0 - + From 0aa41fa0f540d05206a08ce47e3545dfa7a0b426 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:56:56 -0500 Subject: [PATCH 35/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 32805cac0..d9e7a4b09 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -98,7 +98,7 @@ X-Appwrite-Response-Format: 1.0.0 - + From 4491d0016b3a2db0bda1911c1ef80633ad078417 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:57:14 -0500 Subject: [PATCH 36/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index d9e7a4b09..f6b06d7e9 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -91,7 +91,7 @@ X-Appwrite-Response-Format: 1.0.0 - + From 1583b8e915fe5ec0200675f80842890bd595c580 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:57:39 -0500 Subject: [PATCH 37/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index f6b06d7e9..b561097f0 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -57,7 +57,7 @@ X-Appwrite-Response-Format: 1.0.0

Server Authentication

Server integrations use API keys to authenticate and are typically used for backend applications.

-

You don't need to create an account session before making requests to Server APIs. Simply pass an API key in the X-Appwrite-key: [API-KEY] header with the appropriate scopes.

+

You don't need to create an account session before making requests to Server APIs. Simply pass an API key in the X-Appwrite-Key: [API-KEY] header with the appropriate scopes.

GET /v1/databases/{databaseId}/collections/{collectionId}/documents  HTTP/1.1

From bfe5e45f9901f35f97c039da37d7756efcce2db3 Mon Sep 17 00:00:00 2001
From: "Vincent (Wen Yu) Ge" 
Date: Mon, 19 Dec 2022 14:57:56 -0500
Subject: [PATCH 38/58] Update app/views/docs/rest.phtml

Co-authored-by: Jake Barnby 
---
 app/views/docs/rest.phtml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml
index b561097f0..23a93ba68 100644
--- a/app/views/docs/rest.phtml
+++ b/app/views/docs/rest.phtml
@@ -120,7 +120,7 @@ X-Appwrite-Response-Format: 1.0.0
- + From 0efe4034538a45f74f61f896ae19fbea32710984 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:58:11 -0500 Subject: [PATCH 39/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 23a93ba68..bd3277303 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -144,7 +144,7 @@ X-Appwrite-Response-Format: 1.0.0
POST /v1/storage/buckets/default/files  HTTP/1.1
 Host: [HOSTNAME_OR_IP]
-Content-Type: multipart/form-data; boundary=---WD9146A
+Content-Type: multipart/form-data; boundary=----WebKitFormBoundarye0m6iNBQNHlzTpVM
 X-Appwrite-Project: demo-project
 content-range: bytes 10485760-12582912/12582912
 x-appwrite-id: 6369b0bc1dcf4ff59051

From e8adca2b867a933453b64a4b761c44d67d5d4ab5 Mon Sep 17 00:00:00 2001
From: "Vincent (Wen Yu) Ge" 
Date: Mon, 19 Dec 2022 14:58:28 -0500
Subject: [PATCH 40/58] Update app/views/docs/rest.phtml

Co-authored-by: Jake Barnby 
---
 app/views/docs/rest.phtml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml
index bd3277303..0b301217a 100644
--- a/app/views/docs/rest.phtml
+++ b/app/views/docs/rest.phtml
@@ -94,7 +94,7 @@ X-Appwrite-Response-Format: 1.0.0
- + From 8c2d2274208448a2c9d6fdf79dce83c60474893b Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:58:49 -0500 Subject: [PATCH 41/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 0b301217a..ee49c29d7 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -146,7 +146,7 @@ X-Appwrite-Response-Format: 1.0.0 Host: [HOSTNAME_OR_IP] Content-Type: multipart/form-data; boundary=----WebKitFormBoundarye0m6iNBQNHlzTpVM X-Appwrite-Project: demo-project -content-range: bytes 10485760-12582912/12582912 +Content-Range: bytes 10485760-12582912/12582912 x-appwrite-id: 6369b0bc1dcf4ff59051 ------WebKitFormBoundarye0m6iNBQNHlzTpVM From 220bdb1ca25174a624471906283fef19e66f1fdf Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 14:59:08 -0500 Subject: [PATCH 42/58] Update app/views/docs/rest.phtml Co-authored-by: Jake Barnby --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index ee49c29d7..a76256dff 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -147,7 +147,7 @@ Host: [HOSTNAME_OR_IP] Content-Type: multipart/form-data; boundary=----WebKitFormBoundarye0m6iNBQNHlzTpVM X-Appwrite-Project: demo-project Content-Range: bytes 10485760-12582912/12582912 -x-appwrite-id: 6369b0bc1dcf4ff59051 +X-Appwrite-ID: 6369b0bc1dcf4ff59051 ------WebKitFormBoundarye0m6iNBQNHlzTpVM Content-Disposition: form-data; name="fileId" From cd349da91a92119896e05bbd339f10d984310d05 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 20:35:00 +0000 Subject: [PATCH 43/58] Test required pill, fix formating suggestions --- app/views/docs/rest.phtml | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index a76256dff..8a54649d2 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -39,11 +39,11 @@

Using Appwrite Without Headers

Some use cases do not allow the use of custom headers, such as when embedding images from Appwrite in HTML. In these cases, you can provide the Appwrite project ID using the query parameter project.

-
+
'); ?>

Client Authentication

-

You can create account sessions with POST requests to the Account API. Sessions are persisted using cookies like any other REST API. You can learn more about session persistence in the Authentication Guide.

+

You can create account sessions with POST requests to the Account API. Sessions are persisted using cookies. You can learn more about session persistence in the Authentication Guide.

The example below shows creating an account session with the Create Account Session with Email endpoint.

POST /v1/account/sessions/email  HTTP/1.1
@@ -57,7 +57,7 @@ X-Appwrite-Response-Format: 1.0.0
 
 

Server Authentication

Server integrations use API keys to authenticate and are typically used for backend applications.

-

You don't need to create an account session before making requests to Server APIs. Simply pass an API key in the X-Appwrite-Key: [API-KEY] header with the appropriate scopes.

+

Server APIs are authenticated with API keys instead of account sessions. Simply pass an API key in the X-Appwrite-key: [API-KEY] header with the appropriate scopes.

GET /v1/databases/{databaseId}/collections/{collectionId}/documents  HTTP/1.1
@@ -95,7 +95,7 @@ X-Appwrite-Response-Format: 1.0.0
- + @@ -117,7 +117,7 @@ X-Appwrite-Response-Format: 1.0.0 - + @@ -214,31 +214,39 @@ read("user:627a958ded6424a98a9f") - + - + + + + + - + + + + + - + - + - + - +
Required, contains the ID of your Appwrite Project to the REST API.
Content-type: multipart/form-data; boundary=[FORM-BOUNDRY]Content-Type: multipart/form-data; boundary=[FORM-BOUNDRY] Required, contains the content type of the HTTP request and provides a boundry which is used to parse the form data.
Required, contains the content type of the HTTP request and provides a boundry which is used to parse the form data.
content-range: bytes [BYTE-RANGE]Content-Range: bytes [BYTE-RANGE] Required, contains information about which bytes are being transmitted in the format [FIRST-BYTE]-[LAST-BYTE]/[TOTAL-BYTES].
Required, contains which file this chunk belongs to.
X-Appwrite-key: [API-KEY]X-Appwrite-Key: [API-KEY] Optional, used for authentication in server integrations. Do not use API keys in client applications.
Content-Range: bytes [BYTE-RANGE]Required, contains information about which bytes are being transmitted in the format [FIRST-BYTE]-[LAST-BYTE]/[TOTAL-BYTES].Required, contains information about which bytes are being transmitted in this chunk, with the format [FIRST-BYTE]-[LAST-BYTE]/[TOTAL-BYTES].
x-appwrite-id: [FILE-ID]fileId [FILE-ID] n/aRequired, contains the file ID of the new file. Use "unique()" for a UUID.Required, contains the file ID of the new file. Use "unique()" for a random ID.
fileRequired, contains information about which bytes are being transmitted in this chunk, with the format [FIRST-BYTE]-[LAST-BYTE]/[TOTAL-BYTES].
x-appwrite-id: [FILE-ID]X-Appwrite-ID: [FILE-ID] Required, contains which file this chunk belongs to.
X-Appwrite-ID: [FILE-ID]Required, contains which file this chunk belongs to.Optional, only needed in chunks following the initial. Contains ID of the file this chunk belongs to.
X-Appwrite-Key: [API-KEY]
fileIdrequired fileId [FILE-ID] n/a Required, contains the file ID of the new file. Use "unique()" for a random ID.
Role.any()"any"any
Role.guests()"guests"guests
Role.users()users
Role.users([STATUS])"users/[STATUS]"users/[STATUS]
Role.user([USER_ID])user:[USER_ID]
Role.user([USER_ID], [STATUS])"user:[USER_ID]/[STATUS]"user:[USER_ID]/[STATUS]
Role.team([TEAM_ID])"team:[TEAM_ID]"team:[TEAM_ID]
Role.team([TEAM_ID], [ROLE])"team:[TEAM_ID]/[ROLE]"team:[TEAM_ID]/[ROLE]
Role.member([MEMBERSHIP_ID])"member:[MEMBERSHIP_ID]"member:[MEMBERSHIP_ID]
@@ -269,11 +277,11 @@ Appwrite's SDKs provides a Query class to generate query strings. W equal - equal("attribute", [value1, ...]) + equal("attribute", [value]) notEqual - notEqual("attribute", [value1, ...]) + notEqual("attribute", [value]) lessThan @@ -293,7 +301,7 @@ Appwrite's SDKs provides a Query class to generate query strings. W search - search("attribute", [value1, ...]) + search("attribute", [value1]) orderDesc From 078e02302e611c86e1f1aa265b7bfe14dd83045f Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 21:31:36 +0000 Subject: [PATCH 44/58] add cookie examples --- app/views/docs/rest.phtml | 44 ++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 8a54649d2..1542ba3ad 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -15,23 +15,23 @@ X-Appwrite-Project: [PROJECT-ID] - Required, provides the ID of your Appwrite Project to the REST API. + required Provides the ID of your Appwrite Project to the REST API. Content-Type: application/json - Required, declares content type of the HTTP request. + required Declares content type of the HTTP request. X-Appwrite-Key: [API-KEY] - Optional, used for authentication in server integrations. Do not use API keys in client applications. + optional Used for authentication in server integrations. Do not use API keys in client applications. X-Appwrite-Response-Format: [VERSION-NUMBER] - Optional, used for backwards compatibility. The response will be formatted to be compatible the provided version number. + optional Used for backwards compatibility. The response will be formatted to be compatible the provided version number. X-Fallback-Cookies: [FALLBACK-COOKIES] - Optional, used in scenarios where browsers do not allow third-party cookies. Often used when there is no Custom Domain. + optional Used in scenarios where browsers do not allow third-party cookies. Often used when there is no Custom Domain. @@ -55,6 +55,22 @@ X-Appwrite-Response-Format: 1.0.0 {"email":"example@email.com","password":"password"}
+

The cookies used to persist the session can be found in the response headers.

+
+
set-cookie: a_session_61e71ec784ab035f7259_legacy=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; expires=Tue, 19-Dec-2023 21:26:51 GMT; path=/; domain=.demo.appwrite.io; secure; httponly
+set-cookie: a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; expires=Tue, 19-Dec-2023 21:26:51 GMT; path=/; domain=.demo.appwrite.io; secure; httponly; samesite=None
+
+ +

You will see these cookies included in subsequent requests for authentication.

+
+
 GET /v1/account/ HTTP/1.1
+Host: demo.appwrite.io
+Cookie: a_session_61e71ec784ab035f7259_legacy=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9
+Content-Type: application/json
+X-Appwrite-Project: 5df5acd0d48c2
+X-Appwrite-Response-Format: 1.0.0
+
+

Server Authentication

Server integrations use API keys to authenticate and are typically used for backend applications.

Server APIs are authenticated with API keys instead of account sessions. Simply pass an API key in the X-Appwrite-key: [API-KEY] header with the appropriate scopes.

@@ -83,23 +99,23 @@ X-Appwrite-Response-Format: 1.0.0
X-Appwrite-Project: [PROJECT-ID] - Required, contains the ID of your Appwrite Project to the REST API. + required Contains the ID of your Appwrite Project to the REST API. Content-Type: multipart/form-data; boundary=[FORM-BOUNDRY] - Required, contains the content type of the HTTP request and provides a boundry which is used to parse the form data. + required Contains the content type of the HTTP request and provides a boundry which is used to parse the form data. Content-Range: bytes [BYTE-RANGE] - Required, contains information about which bytes are being transmitted in this chunk, with the format [FIRST-BYTE]-[LAST-BYTE]/[TOTAL-BYTES]. + required Contains information about which bytes are being transmitted in this chunk, with the format [FIRST-BYTE]-[LAST-BYTE]/[TOTAL-BYTES]. X-Appwrite-ID: [FILE-ID] - Optional, only needed in chunks following the initial. Contains ID of the file this chunk belongs to. + optional Only needed in chunks following the initial. Contains ID of the file this chunk belongs to. X-Appwrite-Key: [API-KEY] - Optional, used for authentication in server integrations. Do not use API keys in client applications. + optional Used for authentication in server integrations. Do not use API keys in client applications. @@ -117,22 +133,22 @@ X-Appwrite-Response-Format: 1.0.0
- required fileId + fileId [FILE-ID] n/a - Required, contains the file ID of the new file. Use "unique()" for a random ID. + required Contains the file ID of the new file. Use "unique()" for a random ID. file [CHUNK-DATA] [FILE-NAME] - Required, contains file chunk data. + required Contains file chunk data. permissions [PERMISSION ARRAY] n/a - Required, contains an array of permission strings about who can access the new file. + required Contains an array of permission strings about who can access the new file. From 3d64491e04817e21067d7b98f18de9ba9da3d3cf Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 21:36:41 +0000 Subject: [PATCH 45/58] Removes unnecessary space in session examples --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 1542ba3ad..068656116 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -63,7 +63,7 @@ set-cookie: a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3I

You will see these cookies included in subsequent requests for authentication.

-
 GET /v1/account/ HTTP/1.1
+    
GET /v1/account/ HTTP/1.1
 Host: demo.appwrite.io
 Cookie: a_session_61e71ec784ab035f7259_legacy=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9
 Content-Type: application/json

From f457071cda6177dfb9b28450f8a309a9d7ec0440 Mon Sep 17 00:00:00 2001
From: "Vincent (Wen Yu) Ge" 
Date: Mon, 19 Dec 2022 21:42:33 +0000
Subject: [PATCH 46/58] Check status in own column

---
 app/views/docs/rest.phtml | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml
index 068656116..2d128050b 100644
--- a/app/views/docs/rest.phtml
+++ b/app/views/docs/rest.phtml
@@ -92,30 +92,36 @@ X-Appwrite-Response-Format: 1.0.0
- + + - + + - + + - + + - + + - + +
HeaderHeader Description
X-Appwrite-Project: [PROJECT-ID]required Contains the ID of your Appwrite Project to the REST API.requiredContains the ID of your Appwrite Project to the REST API.
Content-Type: multipart/form-data; boundary=[FORM-BOUNDRY]required Contains the content type of the HTTP request and provides a boundry which is used to parse the form data.requiredContains the content type of the HTTP request and provides a boundry which is used to parse the form data.
Content-Range: bytes [BYTE-RANGE]required Contains information about which bytes are being transmitted in this chunk, with the format [FIRST-BYTE]-[LAST-BYTE]/[TOTAL-BYTES].requiredContains information about which bytes are being transmitted in this chunk, with the format [FIRST-BYTE]-[LAST-BYTE]/[TOTAL-BYTES].
X-Appwrite-ID: [FILE-ID]optional Only needed in chunks following the initial. Contains ID of the file this chunk belongs to.optionalOnly needed in chunks following the initial. Contains ID of the file this chunk belongs to.
X-Appwrite-Key: [API-KEY]optional Used for authentication in server integrations. Do not use API keys in client applications.optionalUsed for authentication in server integrations. Do not use API keys in client applications.
From 10cb24cabf88ca9f097f6f7d97932e2a1fb35a4d Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 21:52:48 +0000 Subject: [PATCH 47/58] updates all requried tags to be pills --- app/views/docs/rest.phtml | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 2d128050b..deec494ab 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -9,29 +9,35 @@ Header + Description X-Appwrite-Project: [PROJECT-ID] - required Provides the ID of your Appwrite Project to the REST API. + required + Provides the ID of your Appwrite Project to the REST API. Content-Type: application/json - required Declares content type of the HTTP request. + required + Declares content type of the HTTP request. X-Appwrite-Key: [API-KEY] - optional Used for authentication in server integrations. Do not use API keys in client applications. + optional + Used for authentication in server integrations. Do not use API keys in client applications. X-Appwrite-Response-Format: [VERSION-NUMBER] - optional Used for backwards compatibility. The response will be formatted to be compatible the provided version number. + optional + Used for backwards compatibility. The response will be formatted to be compatible the provided version number. X-Fallback-Cookies: [FALLBACK-COOKIES] - optional Used in scenarios where browsers do not allow third-party cookies. Often used when there is no Custom Domain. + optional + Used in scenarios where browsers do not allow third-party cookies. Often used when there is no Custom Domain. @@ -93,7 +99,7 @@ X-Appwrite-Response-Format: 1.0.0
Header - + Description @@ -115,8 +121,8 @@ X-Appwrite-Response-Format: 1.0.0 X-Appwrite-ID: [FILE-ID] - optional - Only needed in chunks following the initial. Contains ID of the file this chunk belongs to. + required + Contains ID of the file this chunk belongs to. X-Appwrite-Key: [API-KEY] @@ -132,6 +138,7 @@ X-Appwrite-Response-Format: 1.0.0 Key + Value File Name Description @@ -140,21 +147,24 @@ X-Appwrite-Response-Format: 1.0.0 fileId + optional [FILE-ID] n/a - required Contains the file ID of the new file. Use "unique()" for a random ID. + Contains the file ID of the new file. Only used by file chunks following the first chunk uploaded. file + required [CHUNK-DATA] [FILE-NAME] - required Contains file chunk data. + Contains file chunk data. permissions + required [PERMISSION ARRAY] n/a - required Contains an array of permission strings about who can access the new file. + Contains an array of permission strings about who can access the new file. From 8e81b360d577e9f5cd95454a59bccddbfa957652 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 19 Dec 2022 20:36:25 -0500 Subject: [PATCH 48/58] Update app/views/docs/rest.phtml Co-authored-by: Steven <1477010+stnguyen90@users.noreply.github.com> --- app/views/docs/rest.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index deec494ab..f61b01f65 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -44,8 +44,8 @@

Using Appwrite Without Headers

Some use cases do not allow the use of custom headers, such as when embedding images from Appwrite in HTML. In these cases, you can provide the Appwrite project ID using the query parameter project.

-
-
'); ?>
+
+
'); ?>

Client Authentication

From 6b2f03843f2afcf556cc99e31b6e6b1086f76b8b Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 20 Dec 2022 14:46:14 +0000 Subject: [PATCH 49/58] Tag color change, add link to headers --- app/views/docs/rest.phtml | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index f61b01f65..dad1e1348 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -26,29 +26,29 @@ X-Appwrite-Key: [API-KEY] - optional + optional Used for authentication in server integrations. Do not use API keys in client applications. X-Appwrite-Response-Format: [VERSION-NUMBER] - optional + optional Used for backwards compatibility. The response will be formatted to be compatible the provided version number. X-Fallback-Cookies: [FALLBACK-COOKIES] - optional + optional Used in scenarios where browsers do not allow third-party cookies. Often used when there is no Custom Domain. -

Using Appwrite Without Headers

+

Using Appwrite Without Headers

Some use cases do not allow the use of custom headers, such as when embedding images from Appwrite in HTML. In these cases, you can provide the Appwrite project ID using the query parameter project.

'); ?>
-

Client Authentication

+

Client Authentication

You can create account sessions with POST requests to the Account API. Sessions are persisted using cookies. You can learn more about session persistence in the Authentication Guide.

The example below shows creating an account session with the Create Account Session with Email endpoint.

@@ -77,7 +77,7 @@ X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-Response-Format: 1.0.0
-

Server Authentication

+

Server Authentication

Server integrations use API keys to authenticate and are typically used for backend applications.

Server APIs are authenticated with API keys instead of account sessions. Simply pass an API key in the X-Appwrite-key: [API-KEY] header with the appropriate scopes.

@@ -90,7 +90,7 @@ X-Appwrite-Key: [API_KEY] X-Appwrite-Response-Format: 1.0.0
-

File Handling

+

File Handling

Appwrite implements resumable, chunked uploads for files larger than 5MB. Chunked uploads send files in chunks of 5MB to reduce memory footprint and increase resilience when handling large files. Appwrite SDKs will automatically handle chunked uploads but it is possible to implement this with the REST API directly.

Upload endpoints in Appwrite such as Create File and Create Deployment are different from other endpoints. These endpoints take multipart form data instead of JSON data. To implement chunked uploads, you will need to implement the following headers:

@@ -126,7 +126,7 @@ X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Key: [API-KEY] - optional + optional Used for authentication in server integrations. Do not use API keys in client applications. @@ -147,7 +147,7 @@ X-Appwrite-Response-Format: 1.0.0 fileId - optional + optional [FILE-ID] n/a Contains the file ID of the new file. Only used by file chunks following the first chunk uploaded. @@ -197,7 +197,7 @@ read("user:627a958ded6424a98a9f") ------WebKitFormBoundarye0m6iNBQNHlzTpVM--
-

Permissions

+

Permissions

Appwrite SDKs have helpers to generate permission strings, but when using Appwrite without SDKs, you'd need to create the strings yourself.

@@ -287,12 +287,14 @@ read("user:627a958ded6424a98a9f")
  • Learn more about permissions
  • -

    Unique ID

    +

    Unique ID

    +

    Appwrite's SDKs have a helper ID.unqiue() to generate unique IDs. When using Appwrite without an SDK, pass the string "unique()" into the ID parameter.

    -

    Query Methods

    +

    Query Methods

    +

    Appwrite's SDKs provides a Query class to generate query strings. When using Appwrite without an SDK, you can template your own strings with the format below.

    @@ -368,7 +370,8 @@ Appwrite's SDKs provides a Query class to generate query strings. W -

    OpenAPI and Swagger Specs

    +

    OpenAPI and Swagger Specs

    +

    Appwrite provides a full REST API specification in the OpenAPI 3 and Swagger 2 formats every release. These can be accessed through Appwrite's GitHub repository and rendered using a variety of parsers and tools.

    From aa50c667efb9f4a0dc5dddd140eb9b71e04ce237 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 20 Dec 2022 17:16:09 +0000 Subject: [PATCH 50/58] add JWT to docs --- app/views/docs/rest.phtml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index dad1e1348..d5ddd14d1 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -29,6 +29,11 @@ optional Used for authentication in server integrations. Do not use API keys in client applications. + + X-Appwrite-JWT: [TOKEN] + optional + Used for JWT authentication, tokens can be generated using the Create JWT endpoint. + X-Appwrite-Response-Format: [VERSION-NUMBER] optional @@ -90,6 +95,18 @@ X-Appwrite-Key: [API_KEY] X-Appwrite-Response-Format: 1.0.0 +

    JWT Authentication

    +

    JWT authentication is frequently used by server applications to act on behalf of a user. Users generate tokens using the Create JWT endpoint. When issuing requests authenticated with a JWT, Appwrite will treat the request like it is from the authenticated user.

    + +
    +
    GET /v1/account  HTTP/1.1
    +Host: [HOSTNAME_OR_IP]
    +Content-Type: application/json
    +X-Appwrite-Project: [PROJECT_ID]
    +X-Appwrite-JWT: [TOKEN]
    +X-Appwrite-Response-Format: 1.0.0
    +
    +

    File Handling

    Appwrite implements resumable, chunked uploads for files larger than 5MB. Chunked uploads send files in chunks of 5MB to reduce memory footprint and increase resilience when handling large files. Appwrite SDKs will automatically handle chunked uploads but it is possible to implement this with the REST API directly.

    From bbcfe3bcb207100dcf53b3e28c36fc29ccd14558 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 20 Dec 2022 18:37:49 +0000 Subject: [PATCH 51/58] Fixes accound endpoint --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index d5ddd14d1..6814b7e78 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -74,7 +74,7 @@ set-cookie: a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3I

    You will see these cookies included in subsequent requests for authentication.

    -
    GET /v1/account/ HTTP/1.1
    +    
    GET /v1/account HTTP/1.1
     Host: demo.appwrite.io
     Cookie: a_session_61e71ec784ab035f7259_legacy=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9
     Content-Type: application/json
    
    From ac49a7920bb51f89fe8fcc4e0eb469ba16b0c995 Mon Sep 17 00:00:00 2001
    From: "Vincent (Wen Yu) Ge" 
    Date: Tue, 20 Dec 2022 19:36:19 +0000
    Subject: [PATCH 52/58] Add link for create endpoints
    
    ---
     app/views/docs/rest.phtml | 24 ++++++++++++------------
     1 file changed, 12 insertions(+), 12 deletions(-)
    
    diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml
    index 6814b7e78..613625b6b 100644
    --- a/app/views/docs/rest.phtml
    +++ b/app/views/docs/rest.phtml
    @@ -1,6 +1,6 @@
     

    Appwrite supports multiple protocols for accessing the server, including REST, GraphQL, and Realtime.

    -

    The REST API allows you to access your Appwrite server through HTTP requests, without the need for an SDK. Each endpoint in the API represents a specific operation on a specific resource.

    +

    The REST API allows you to access your Appwrite server through HTTP requests without the needing an SDK. Each endpoint in the API represents a specific operation on a specific resource.

    Headers

    Appwrite's REST APIs expect certain headers to be included with each request:

    @@ -17,38 +17,38 @@ X-Appwrite-Project: [PROJECT-ID] required - Provides the ID of your Appwrite Project to the REST API. + The ID of your Appwrite Project to the REST API. Content-Type: application/json required - Declares content type of the HTTP request. + Content type of the HTTP request. X-Appwrite-Key: [API-KEY] optional - Used for authentication in server integrations. Do not use API keys in client applications. + API key used for server authentication. Do not use API keys in client applications. X-Appwrite-JWT: [TOKEN] optional - Used for JWT authentication, tokens can be generated using the Create JWT endpoint. + Token used for JWT authentication, tokens can be generated using the Create JWT endpoint. X-Appwrite-Response-Format: [VERSION-NUMBER] optional - Used for backwards compatibility. The response will be formatted to be compatible the provided version number. + Version number used for backward compatibility. The response will be formatted to be compatible with the provided version number. X-Fallback-Cookies: [FALLBACK-COOKIES] optional - Used in scenarios where browsers do not allow third-party cookies. Often used when there is no Custom Domain. + Fallback cookies used in scenarios where browsers do not allow third-party cookies. Often used when there is no Custom Domain.

    Using Appwrite Without Headers

    -

    Some use cases do not allow the use of custom headers, such as when embedding images from Appwrite in HTML. In these cases, you can provide the Appwrite project ID using the query parameter project.

    +

    Some use cases do not allow custom headers, such as embedding images from Appwrite in HTML. In these cases, you can provide the Appwrite project ID using the query parameter project.

    '); ?>
    @@ -66,13 +66,13 @@ X-Appwrite-Response-Format: 1.0.0 {"email":"example@email.com","password":"password"}
    -

    The cookies used to persist the session can be found in the response headers.

    +

    You can find the cookies used to persist the new session in the response headers.

    set-cookie: a_session_61e71ec784ab035f7259_legacy=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; expires=Tue, 19-Dec-2023 21:26:51 GMT; path=/; domain=.demo.appwrite.io; secure; httponly
     set-cookie: a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; expires=Tue, 19-Dec-2023 21:26:51 GMT; path=/; domain=.demo.appwrite.io; secure; httponly; samesite=None
    -

    You will see these cookies included in subsequent requests for authentication.

    +

    These cookies are used in subsequent requests to authenticate the user.

    GET /v1/account HTTP/1.1
     Host: demo.appwrite.io
    @@ -108,9 +108,9 @@ X-Appwrite-Response-Format: 1.0.0

    File Handling

    -

    Appwrite implements resumable, chunked uploads for files larger than 5MB. Chunked uploads send files in chunks of 5MB to reduce memory footprint and increase resilience when handling large files. Appwrite SDKs will automatically handle chunked uploads but it is possible to implement this with the REST API directly.

    +

    Appwrite implements resumable, chunked uploads for files larger than 5MB. Chunked uploads send files in chunks of 5MB to reduce memory footprint and increase resilience when handling large files. Appwrite SDKs will automatically handle chunked uploads, but it is possible to implement this with the REST API directly.

    -

    Upload endpoints in Appwrite such as Create File and Create Deployment are different from other endpoints. These endpoints take multipart form data instead of JSON data. To implement chunked uploads, you will need to implement the following headers:

    +

    Upload endpoints in Appwrite, such as Create File and Create Deployment, are different from other endpoints. These endpoints take multipart form data instead of JSON data. To implement chunked uploads, you will need to implement the following headers:

    From adc194d6c4b6e0951ddc39c18e79c0ac6e9f0360 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 20 Dec 2022 19:47:53 +0000 Subject: [PATCH 53/58] Ran through grammarly for double checks --- app/views/docs/rest.phtml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 613625b6b..d4fef64d5 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -110,7 +110,7 @@ X-Appwrite-Response-Format: 1.0.0

    File Handling

    Appwrite implements resumable, chunked uploads for files larger than 5MB. Chunked uploads send files in chunks of 5MB to reduce memory footprint and increase resilience when handling large files. Appwrite SDKs will automatically handle chunked uploads, but it is possible to implement this with the REST API directly.

    -

    Upload endpoints in Appwrite, such as Create File and Create Deployment, are different from other endpoints. These endpoints take multipart form data instead of JSON data. To implement chunked uploads, you will need to implement the following headers:

    +

    Upload endpoints in Appwrite, such as Create File and Create Deployment, are different from other endpoints. These endpoints take multipart form data instead of JSON data. To implement chunked uploads, you will need to implement the following headers:

    @@ -127,9 +127,9 @@ X-Appwrite-Response-Format: 1.0.0 - + - + @@ -188,7 +188,7 @@ X-Appwrite-Response-Format: 1.0.0

    While cURL and fetch are great tools to explore other REST endpoints, it's impractical to use for chunked file uploads because you need to split files into chunks.

    -

    The multipart form data posted to file upload endpoints has the following format:

    +

    The multipart form data posted to file upload endpoints have the following format:

    POST /v1/storage/buckets/default/files  HTTP/1.1
    @@ -313,7 +313,7 @@ Appwrite's SDKs have a helper ID.unqiue() to generate unique IDs. W
     

    Query Methods

    -Appwrite's SDKs provides a Query class to generate query strings. When using Appwrite without an SDK, you can template your own strings with the format below. +Appwrite's SDKs provide a Query class to generate query strings. When using Appwrite without an SDK, you can template your own strings with the format below.

    Query strings are passed to Appwrite using the queries parameter. You can attach multiple query strings by including the array parameter multiple times in the query string: queries[]="..."&queries[]="..."

    From 4a0ba0c5a3018a90c3a2350b15aaa5370ecd16a4 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Tue, 20 Dec 2022 20:05:28 +0000 Subject: [PATCH 54/58] Add space in request formatting to fix highlighting issue --- app/views/docs/rest.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index d4fef64d5..a3c14942c 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -74,7 +74,7 @@ set-cookie: a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3I

    These cookies are used in subsequent requests to authenticate the user.

    -
    GET /v1/account HTTP/1.1
    +    
    GET /v1/account  HTTP/1.1
     Host: demo.appwrite.io
     Cookie: a_session_61e71ec784ab035f7259_legacy=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9
     Content-Type: application/json
    
    From 8f343caeeb06d3e91a9f0db7a3e46aa1781d2b1c Mon Sep 17 00:00:00 2001
    From: Jake Barnby 
    Date: Thu, 22 Dec 2022 14:01:08 +1300
    Subject: [PATCH 55/58] Formatting
    
    ---
     app/views/docs/rest.phtml | 5 ++++-
     1 file changed, 4 insertions(+), 1 deletion(-)
    
    diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml
    index a3c14942c..5df4f8b31 100644
    --- a/app/views/docs/rest.phtml
    +++ b/app/views/docs/rest.phtml
    @@ -63,7 +63,10 @@ Content-Type: application/json
     X-Appwrite-Project: 5df5acd0d48c2
     X-Appwrite-Response-Format: 1.0.0
     
    -{"email":"example@email.com","password":"password"}
    +{ + "email": "example@email.com", + "password": "password" +}

    You can find the cookies used to persist the new session in the response headers.

    From d4b735b58cf1e938bc6c56fbca8f963565e57eaa Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 22 Dec 2022 13:41:43 +1300 Subject: [PATCH 56/58] Remove extra space in request line (cherry picked from commit dd1bb7b2d861d5d96bc292cf3de6b393d5cd5f17) --- app/views/docs/rest.phtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml index 5df4f8b31..59ca9a949 100644 --- a/app/views/docs/rest.phtml +++ b/app/views/docs/rest.phtml @@ -57,7 +57,7 @@

    You can create account sessions with POST requests to the Account API. Sessions are persisted using cookies. You can learn more about session persistence in the Authentication Guide.

    The example below shows creating an account session with the Create Account Session with Email endpoint.

    -
    POST /v1/account/sessions/email  HTTP/1.1
    +    
    POST /v1/account/sessions/email HTTP/1.1
     Host: [HOSTNAME_OR_IP]
     Content-Type: application/json
     X-Appwrite-Project: 5df5acd0d48c2
    @@ -77,7 +77,7 @@ set-cookie: a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3I
     
     

    These cookies are used in subsequent requests to authenticate the user.

    -
    GET /v1/account  HTTP/1.1
    +    
    GET /v1/account HTTP/1.1
     Host: demo.appwrite.io
     Cookie: a_session_61e71ec784ab035f7259_legacy=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9
     Content-Type: application/json
    @@ -90,7 +90,7 @@ X-Appwrite-Response-Format: 1.0.0

    Server APIs are authenticated with API keys instead of account sessions. Simply pass an API key in the X-Appwrite-key: [API-KEY] header with the appropriate scopes.

    -
    GET /v1/databases/{databaseId}/collections/{collectionId}/documents  HTTP/1.1
    +    
    GET /v1/databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1
     Host: [HOSTNAME_OR_IP]
     Content-Type: application/json
     X-Appwrite-Project: [PROJECT_ID]
    @@ -102,7 +102,7 @@ X-Appwrite-Response-Format: 1.0.0

    JWT authentication is frequently used by server applications to act on behalf of a user. Users generate tokens using the Create JWT endpoint. When issuing requests authenticated with a JWT, Appwrite will treat the request like it is from the authenticated user.

    -
    GET /v1/account  HTTP/1.1
    +    
    GET /v1/account HTTP/1.1
     Host: [HOSTNAME_OR_IP]
     Content-Type: application/json
     X-Appwrite-Project: [PROJECT_ID]
    
    From 7f3161d223a446190284c25d21e02ddd90f16960 Mon Sep 17 00:00:00 2001
    From: Jake Barnby 
    Date: Thu, 22 Dec 2022 13:56:45 +1300
    Subject: [PATCH 57/58] Remove extra space in request line
    
    (cherry picked from commit cf4d8ef2b5f584d710cc84fabb5b2b51bcdc3edc)
    ---
     app/views/docs/rest.phtml | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml
    index 59ca9a949..2a0ffb82f 100644
    --- a/app/views/docs/rest.phtml
    +++ b/app/views/docs/rest.phtml
    @@ -194,7 +194,7 @@ X-Appwrite-Response-Format: 1.0.0

    The multipart form data posted to file upload endpoints have the following format:

    -
    POST /v1/storage/buckets/default/files  HTTP/1.1
    +    
    POST /v1/storage/buckets/default/files HTTP/1.1
     Host: [HOSTNAME_OR_IP]
     Content-Type: multipart/form-data; boundary=----WebKitFormBoundarye0m6iNBQNHlzTpVM
     X-Appwrite-Project: demo-project
    
    From 676b5f93c00472061bbc801fc1c5b0a8ccd7b403 Mon Sep 17 00:00:00 2001
    From: Jake Barnby 
    Date: Thu, 22 Dec 2022 14:09:09 +1300
    Subject: [PATCH 58/58] Truncate cookies
    
    (cherry picked from commit 4cb13673ef959715c179490970a47cdee383c4cc)
    ---
     app/views/docs/rest.phtml | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/app/views/docs/rest.phtml b/app/views/docs/rest.phtml
    index 2a0ffb82f..cfdaf1b5b 100644
    --- a/app/views/docs/rest.phtml
    +++ b/app/views/docs/rest.phtml
    @@ -71,15 +71,15 @@ X-Appwrite-Response-Format: 1.0.0
     
     

    You can find the cookies used to persist the new session in the response headers.

    -
    set-cookie: a_session_61e71ec784ab035f7259_legacy=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; expires=Tue, 19-Dec-2023 21:26:51 GMT; path=/; domain=.demo.appwrite.io; secure; httponly
    -set-cookie: a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; expires=Tue, 19-Dec-2023 21:26:51 GMT; path=/; domain=.demo.appwrite.io; secure; httponly; samesite=None
    +
    Set-Cookie: a_session_61e71ec784ab035f7259_legacy=eyJ0...aSJ9; expires=Tue, 19-Dec-2023 21:26:51 GMT; path=/; domain=.demo.appwrite.io; secure; httponly
    +Set-Cookie: a_session_61e71ec784ab035f7259=eyJ0...aSJ9; expires=Tue, 19-Dec-2023 21:26:51 GMT; path=/; domain=.demo.appwrite.io; secure; httponly; samesite=None

    These cookies are used in subsequent requests to authenticate the user.

    GET /v1/account HTTP/1.1
     Host: demo.appwrite.io
    -Cookie: a_session_61e71ec784ab035f7259_legacy=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9; a_session_61e71ec784ab035f7259=eyJpZCI6IjYzYTBkM2E1MWQ3ZGQ0NzQxOGY3Iiwic2VjcmV0IjoiYmZmN2ExZGIwYmQ3MjcyZGI5Yjg3ZmMwOGY3MzQ3MDZhYmJlYTE1ZGIzN2ViOThlZmRkMmE1OWU4NTNkODRmOGViYTAwY2E4ZjcxYzgzZTUyNDU1OTA3NDhlNTRkMDEwOTcxOTcyNTg1NWNmNDFlODg4MDg3NmI4OTk3NDJkZGFiMGQzODM1MDY0NGJlYzJkYWFiZGUyYjYyY2M1NDIwMTNjYzE0MDFhYjhiYjI2ZDdlM2E1MDgxNGVjMTc4ZDhjNTE4N2YzYzYxNWJhNTBiYWI2MjQxYTRiZjFiODA4ZDhjNGUwMTFhN2NlMzJkODRlYTI4MTU2MDVmYzkxZjg0MSJ9
    +Cookie: a_session_61e71ec784ab035f7259_legacy=eyJ0...aSJ9; a_session_61e71ec784ab035f7259=eyJ0...aSJ9
     Content-Type: application/json
     X-Appwrite-Project: 5df5acd0d48c2
     X-Appwrite-Response-Format: 1.0.0
    Contains the ID of your Appwrite Project to the REST API.
    Content-Type: multipart/form-data; boundary=[FORM-BOUNDRY]Content-Type: multipart/form-data; boundary=[FORM-BOUNDARY] requiredContains the content type of the HTTP request and provides a boundry which is used to parse the form data.Contains the content type of the HTTP request and provides a boundary that is used to parse the form data.
    Content-Range: bytes [BYTE-RANGE]