hellcow
hellcow
CDCloudflare Developers
Created by hellcow on 11/26/2023 in #general-help
Generating Image Variants - Incorrect Docs?
This doc describes how to do it: https://developers.cloudflare.com/images/cloudflare-images/transform/resize-images/
curl -X POST "https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/images/v1/variants" \
-H "Authorization: Bearer <API_TOKEN>" \
-H "Content-Type: application/json" \
--data '{"id":"<NAME_OF_THE_VARIANT>","options":{"fit":"scale-down","metadata":"none","width":1366,"height":768},"neverRequireSignedURLs":true}
curl -X POST "https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/images/v1/variants" \
-H "Authorization: Bearer <API_TOKEN>" \
-H "Content-Type: application/json" \
--data '{"id":"<NAME_OF_THE_VARIANT>","options":{"fit":"scale-down","metadata":"none","width":1366,"height":768},"neverRequireSignedURLs":true}
However nowhere in that request is there the image ID that the variant is supposed to be based on. The same issue is in https://developers.cloudflare.com/api/operations/cloudflare-images-variants-create-a-variant. There's no image ID passed to the API. Cloudflare would need this to create a variant. How should I send the image ID?
3 replies