Markus Michalski FAQ

CDN Product Images: Admin API

Create images with a CDN URL via the Admin API: cdnUrl instead of a file upload for product and taxon images, rules and error responses.

Deutsche Version

Back to overview

CDN Product Images: Admin API

This documentation always describes the latest published version.

Live Demo: Try this and other plugins live — no installation, no risk: demo.markus-michalski.net

Overview

External Admin API clients and automation can create a product or taxon image not only by uploading a file but also by cdnUrl. The image already lives on the CDN and only its URL is stored - exactly like creating it through the Admin form.

Endpoint Purpose
POST /api/v2/admin/products/{code}/images Create a product image
POST /api/v2/admin/taxons/{code}/images Create a taxon image

Both endpoints expect multipart/form-data, so cdnUrl is sent as a form field, not as JSON.

Rules

Example

curl -X POST "https://shop.example.com/api/v2/admin/products/mug-sw/images" \
  -H "Authorization: Bearer <JWT>" \
  -F "type=main" \
  -F "cdnUrl=https://cdn.example.com/original/mug-sw.jpg"

The response has the same image representation as after a regular file upload, with path equal to the submitted URL.

Behaviour

Request Result
file only Regular upload, unchanged
cdnUrl only Image is created with path = cdnUrl
file and cdnUrl HTTP 400
invalid or too long cdnUrl HTTP 400
neither file nor cdnUrl HTTP 400 (as before)
unknown product/taxon HTTP 404 (as before)

Limitations