CartVisualCreate account

Why does a Pixelcut product-image request return a URL instead of image bytes?

Check the endpoint’s supported response formats and the request’s Accept header. Pixelcut describes JSON responses containing a `result_url` and direct binary responses on endpoints that offer them. The request Content-Type describes how you send the input. A multipart upload can still produce JSON.

Published · By CartVisual editorial team

Pick the result format independently of the upload format

For a folder of packshots, suppose your service uploads one original image and saves the resulting cutout in the approved asset collection. The request can send the original as a multipart file while asking for a JSON response. Read the result_url, retrieve the image as a separate operation, and store the verified file with the SKU and input revision. This keeps a retry to retrieve a result separate from the generation request.

On an endpoint that supports a direct image response, a one-step worker can request the advertised image media type. After a successful response, check its Content-Type and decode the bytes before assigning a filename. This catches a JSON response saved as shoe.png or an error page recorded as a valid result.

What you see What to inspect
JSON appears after you uploaded a file Check Accept and the endpoint’s supported outputs. The input was multipart regardless of the output type.
An image decoder rejects the response Check the status and actual Content-Type. If the body is JSON, handle the result URL or error as JSON.
The URL was captured but storage is empty Check the separate download operation before submitting another generation.

In a trial run, approve one image through upload, API response and final storage. Compare file type and dimensions with the delivery specification after the stored file is read back. Repeat for both formats only when the endpoint supports both.

Source

Related decisions

Browse ecommerce creative workflows