Precache Image Requests (BETA)
Image assets can be precached in anticipation of an upcoming request. Both the origin and processed image will be cached.
Caveats
- CDN cache will not be affected due to the many locations of edge nodes.
- Imagizer's cache is short-lived, and cached assets will not be available for long.
- Pre-caching is an async process which may take several minutes to complete.
Rate Limiting
Precaching is limited to 1000 items per request and 120 requests per minute.
Authorization
You must first request an authorization token from https://cloud.imagizer.com/tokens. Using the Authorization header append the token to each API request.
http
Authorization: Bearer {auth_token}Usage
Precache a list of URL paths for the given source.
Pass an array of image paths to the files property.
http
POST https://cloud.imagizer.com/api/v1/sources/{SOURCE_NAME_OR_ID}/cache HTTP/1.1
Authorization: Bearer {AUTH_TOKEN}
Accept: application/json
Content-Type: application/json
{"files":["/images/myimage1.jpg?width=200","/images/myimage2.jpg?width=200","/images/myimage3.jpg?width=200"]}Example
bash
curl \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {AUTH_TOKEN}" \
-d '{"files":["/images/myimage1.jpg?width=200","/images/myimage2.jpg?width=200","/images/myimage3.jpg?width=200"]}' \
https://cloud.imagizer.com/api/v1/sources/{SOURCE_NAME_OR_ID}/cache