Upload binary image to Ghost AdminAPI fails

Describe the problem/error/question

I want to upload a binary image to the Ghost Admin API described here (with a curl example):
Ghost Admin API Documentation but that fails.

Data is actually there:

The image is valid too:

What is the error message (if any)?

Actually I get this error:

ERROR: Your request is invalid or could not be processed by the service
415 - “{"errors":[{"message":"Please select a valid image.","context":null,"type":"UnsupportedMediaTypeError","details":null,"property":null,"help":null,"code":null,"id":"382764a0-827e-11ee-892a-db6acb4b0f68","ghostErrorCode":null}]}” - {“errors”:[{“message”:“Please select a valid image.”,“context”:null,“type”:“UnsupportedMediaTypeError”,“details”:null,“property”:null,“help”:null,“code”:null,“id”:“382764a0-827e-11ee-892a-db6acb4b0f68”,“ghostErrorCode”:null}]}

Please share your workflow

How do I fix this? IMHO this should work, as Ghost expects a Blob or File:

Uploading an Image
To upload an image, send a multipart formdata request by providing the 'Content-Type': 'multipart/form-data;' header, along with the following fields encoded as FormData:
file: Blob or File The image data that you want to upload.

Information on your n8n setup

  • n8n version: Version 1.15.2
  • Database (default: SQLite): MySQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main): not changed
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Unraid

A friend of me also tried that and failed. Is this a problem of ghost or n8n?

I discovered that I need to invoke my generating request with filename.extension at the end in the address. It seems there need to be a filename at least to get that working with ghost. Now it works perfectly. Nothing which is a problem at ghost side.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.