• Resolved cassievaneck

    (@cassievaneck)


    I am trying to add images using the Woo Commerce API, but I am getting an error.

    {

        “code”: “woocommerce_product_image_upload_error”,

        “message”: “Invalid image: Sorry, you are not allowed to upload this file type.”,

        “data”: {

            “status”: 400

        }

    }

    We are storing images in a database in our application (byte[]/varbinary), and the url we are passing to the API is a .net7 minimal API endpoint. The get method is returning the image, and mime type

    return Results.File(image.Image,image.ContentType);

    The content type is image/png (Also tried a jpg)
    What am I missing? The image can be viewed on a browser.

    • This topic was modified 3 years, 1 month ago by Yui.
    • This topic was modified 3 years, 1 month ago by cassievaneck.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cassievaneck

    (@cassievaneck)

    I managed to figure this out, we were not adding the file name to the url that we passed to the API – as it was not needed in our API endpoint. Adding an image name to the endpoint resolved the error.

    Hi @cassievaneck

    Awesome, glad to know you were able to sort it out. I am going to mark this ticket as resolved, if you have any new questions, please create a new ticket.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Woo Commerce API’ is closed to new replies.