You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/api.md
+29-5Lines changed: 29 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,15 @@
4
4
5
5
Return the index page.
6
6
7
-
## **GET**`/<name>[.<ext>]` or `/<name>/<filename>[.<ext>]`
7
+
## **GET**`/<name>[.<ext>]` or `/<name>/<filename>`
8
8
9
9
Fetch the paste with name `<name>`. By default, it will return the raw content of the paste.
10
10
11
-
The `Content-Type` header is set to `text/plain;charset=UTF-8`. If `<ext>` is given, the worker will infer mime-type from `<ext>` and change `Content-Type`. If the paste is uploaded with a filename, the worker will infer mime-type from the filename. This method accepts the following query string parameters:
11
+
The `Content-Type` header is set to the mime type inferred from the filename of the paste, or `text/plain;charset=UTF-8` if no filename is present. If `<ext>` is given, the worker will infer mime-type from `<ext>` and change `Content-Type`. If the paste is uploaded with a filename, the worker will infer mime-type from the filename. This method accepts the following query string parameters:
12
12
13
-
The `Content-Disposition` header is set to `inline` by default. But can be overriden by `?a` query string. If the paste is uploaded with filename, or `<filename>` is set in given request URL, `Content-Disposition` is appended with `filename*` indicating the filename (with `<ext>` if it exists).
13
+
The `Content-Disposition` header is set to `inline` by default. But can be overriden by `?a` query string. If the paste is uploaded with filename, or `<filename>` is set in given request URL, `Content-Disposition` is appended with `filename*` indicating the filename. If the paste is encrypted, the filename is appended with `.encrypted` suffix.
14
+
15
+
If the paste is encrypted, an `X-Encryption-Scheme` header will be set to the encryption scheme.
14
16
15
17
-`?a=`: optional. Set `Content-Disposition` to `attachment` if present.
-`sizeBytes`: Integer. The size of the content of the paste in bytes.
97
118
-`filename`: Optional string. The file name of the paste.
98
119
-`location`: String, either "KV" of "R2". Representing whether the paste content is stored in Cloudflare KV storage or R2 object storage.
120
+
-`encryptionScheme`: Optional string. Currently only "AES-GCM" is possible. The encryption scheme used to encrypt the pastused to encrypt the pastused to encrypt the pastused to encrypt the paste.
99
121
100
122
## GET `/a/<name>`
101
123
@@ -167,6 +189,8 @@ Upload your paste. It accept parameters in form-data:
167
189
-`n`: optional. The customized **name** of your paste. If not specified, the worker will generate a random string (4 characters by default) as the name. You need to prefix the name with `~` when fetching the paste of customized name. The name is at least 3 characters long, consisting of alphabet, digits and characters in `+_-[]*$=@,;/`.
168
190
169
191
-`p`: optional. The flag of **private mode**. If specified to any value, the name of the paste is as long as 24 characters. No effect if `n` is used.
192
+
-
193
+
-`encryption-scheme`: optional. The encryption scheme used in the uploaded paste. It will be returned as `X-Encryption-Scheme` header on fetching paste. Note that this is not the encryption scheme that the backend will perform.
170
194
171
195
`POST` method returns a JSON string by default, if no error occurs, for example:
0 commit comments