Error :- "...../image.jpg" is not a valid image file type

Solved
kumar10
Tourist
11 0 1

I am trying to create new image for my product using 'Shopify rest Admin API' 

method :-  POST

API End point : -  ' /admin/api/2020-07/products/{My_product_id}/images.json'

Payload :- 

{

"image": {
      }
}
 
Response : - 
Status:  422 Unprocessable Entity
{
     "errors": {
     "image": [
            "/5f218572b0242e75f1a8c521/US-Ku-1000/11224.jpg is not a valid image file type."
       ]
   }
}

 

0 Likes
Jason
Shopify Expert
10035 119 1871

It's not an image. If you look at the content type for that file it's an application/octet-stream. Try adjusting the content type for that file in your bucket and try again.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
kumar10
Tourist
11 0 1

Hi @Jason

I convert the image into base64 but, still getting error. 

payload:-   
{
"image" :{
 "attachment":data : image/jpeg;base64,/9j/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFP/AABEIBTMH0AMBIgACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5..........Continues like this",
 "filename":"myFile.jpeg"
}
}
 
 
Response : - 
Status:  422 Unprocessable Entity

{

     "errors": {
          "image": [
                    "The uploaded image is corrupt and cannot be processed. Please try a different image."
           ]
      }
}

 

0 Likes

Try with another image you are sure it is fine.

https://apps.shopify.com/picamaze
Animated watermarks for product images and ads
0 Likes
Jason
Shopify Expert
10035 119 1871

This is an accepted solution.

You're getting a different error now so it's a different problem.

Why are you adding this into the attachment data? 

 

 

data : image/jpeg;base64

 

 

Did you pull that format from the docs or simply copy and paste the contents from a conversion tool?

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au