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
IMAGES: support for customid in direct upload v2 (cloudflare#6817)
* IMAGES: support for customid in direct upload v2 + undoc direct up v1
* Apply suggestions from code review
* Apply suggestions from code review
* Apply suggestions from code review
Co-authored-by: marciocloudflare <[email protected]>
Copy file name to clipboardExpand all lines: content/images/cloudflare-images/upload-images/custom-id.md
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -56,3 +56,7 @@ Refer to [Make your first API request](/images/cloudflare-images/api-request/) t
56
56
## Custom IDs in delivery URLs
57
57
58
58
When [serving images](/images/cloudflare-images/serve-images), you can include non URL-encoded Custom IDs directly in the image URLs. However, any `%` characters present in Custom IDs must be encoded to `%25` in the image delivery URLs.
59
+
60
+
## Custom IDs and private images
61
+
62
+
Images with a [custom ID](/images/cloudflare-images/upload-images/custom-id/) cannot be made private using [signed URL tokens](/images/cloudflare-images/serve-images/serve-private-images-using-signed-url-tokens/).
Copy file name to clipboardExpand all lines: content/images/cloudflare-images/upload-images/direct-creator-upload.md
+17-11Lines changed: 17 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,9 @@ weight: 2
6
6
7
7
# Direct Creator Upload
8
8
9
-
The Direct Creator Upload feature in Cloudflare Images lets your users upload pictures with a one-time upload URL. By using Direct Creator Upload, you can accept uploads without exposing [your API key or token](/images/cloudflare-images/api-request/) to the client. It also eliminates the need for an intermediary storage bucket and the storage/egress costs associated with it.
9
+
The Direct Creator Upload feature in Cloudflare Images lets your users upload images with a one-time upload URL. By using Direct Creator Upload, you can accept uploads without exposing [your API key or token](/images/cloudflare-images/api-request/) to the client. It also eliminates the need for an intermediary storage bucket and the storage/egress costs associated with it.
10
10
11
-
To request a one-time upload URL, call the [`direct_upload` endpoint](https://developers.cloudflare.com/api/operations/cloudflare-images-create-authenticated-direct-upload-url) in your back-end (or Worker script):
11
+
To request a one-time upload URL, call the [`v2/direct_upload` endpoint](https://developers.cloudflare.com/api/operations/cloudflare-images-create-authenticated-direct-upload-url-v-2) in your back-end (or Worker script):
12
12
13
13
```bash
14
14
curl --request POST \
@@ -24,7 +24,7 @@ You will receive a response similar to this:
@@ -35,13 +35,7 @@ You will receive a response similar to this:
35
35
36
36
In the example above, `id` is a future image identifier that will be uploaded by a creator.
37
37
38
-
{{<Asidetype="note"header="Note">}}
39
-
40
-
Previously, in version 1 of the `direct_upload` endpoint, the ID was an identifier of a request, not an image. Therefore, there was no way to know if an image had been really uploaded.
41
-
42
-
{{</Aside>}}
43
-
44
-
With version 2 of `direct_upload`, a new draft image record is created when you invoke this endpoint. It will not appear on a [list of images](https://developers.cloudflare.com/api/operations/cloudflare-images-list-images), but it is possible to fetch an image record with the provided ID to check its current status. In the example below, `<IMAGE_ID>` is the `id` received from the response when requesting a one-time upload URL with the `direct_upload` endpoint.
38
+
A new draft image record is created when you invoke this endpoint. It will not appear on a [list of images](https://developers.cloudflare.com/api/operations/cloudflare-images-list-images/), but it is possible to fetch an image record with the provided ID to check its current status. In the example below, `<IMAGE_ID>` is the `id` received from the response when requesting a one-time upload URL with the `direct_upload` endpoint.
@@ -99,4 +93,16 @@ To override this option, add the following argument to the cURL command:
99
93
--data '{"expiry":"2021-09-14T16:00:00Z"}'
100
94
```
101
95
102
-
The expiry value must be a minimum of two minutes and maximum of six hours in the future.
96
+
The expiry value must be a minimum of two minutes and maximum of six hours in the future.
97
+
98
+
## Direct Creator Upload with Custom ID
99
+
100
+
You can specify a [custom ID](/images/cloudflare-images/upload-images/custom-id/) when first requesting a one-time upload URL, instead of using the automatically generated ID for your image.
101
+
102
+
To do so, pass a form field of name `id` with the corresponding custom ID value to the cURL command:
103
+
104
+
```bash
105
+
--form 'id=this/is/my-customid'
106
+
```
107
+
108
+
Note that images with a [custom ID](/images/cloudflare-images/upload-images/custom-id/) cannot be made private with the [signed URL tokens](/images/cloudflare-images/serve-images/serve-private-images-using-signed-url-tokens/) feature (`--requireSignedURLs=true`).
0 commit comments