Problems with Adding Images to Product Variant

New Member
1 0 0

I am having a problem adding images to product variant.

1. I create a new Product.
2. I read the response
3. I then attempt to update the variant.image_id
4. I get a 406 error

I create a new Product by posting the next JSON block below to "https://wiperpacks.myshopify.com/admin/products.json";

{  
   "product":{  
      "title":"1997 Acura CL Wiper Blade  (Goodyear Wiper Blades - Premium)",
      "body_html":"<div><ul><li>Wiper Pack Includes:<ul></ul></li><li>Includes custom printed static cling reminder sticker for the inside of your windshield to check/replace wipers at a specified date, just like the oil change store stickers.  Sticker has web browser url or QR code to lead back to this exact product.</li><li>Made in the USA</li><li>SilentArmor Technology for durability and quiet wiping action</li><li>Wiping element features unique, round-hinge profile allowing wiper to make contact at 45 degree angle for highest proformance</li><li>Stainless steel flexors provides long lasting durability with no rusting</li><li>Natural rubber compound for performance and durability</li><li>Heavy duty, riveted steel frame with double coated paint for superior rust resistance</li></ul>",
      "vendor":"Goodyear Wiper Blades",
      "product_type":"Wiper Blades",
      "handle":"1997 Acura CL Wiper Blade  (Goodyear Wiper Blades - Premium)",
      "tags":"Acura,CL,Make_Acura,Brand & Line_Goodyear - Premium,1997,97",
      "variants":[  
         {  
            "sku":"728ACCL97D24P20-BVY",
            "price":"17.45",
            "option1":"Driver/Passenger",
            "taxable":true,
            "requires_shipping":true,
            "barcode":"728ACCL97D24P20-BVY",
            "inventory_quantity":99999,
            "weight":1.2000000476837158,
            "weight_unit":"lb"
         },
         {  
            "sku":"728ACCL97D24-BVY",
            "price":"10.78",
            "option1":"Driver",
            "taxable":true,
            "requires_shipping":true,
            "barcode":"728ACCL97D24-BVY",
            "inventory_quantity":99999,
            "weight":0.60000002384185791,
            "weight_unit":"lb"
         },
         {  
            "sku":"728ACCL97P20-BVY",
            "price":"10.78",
            "option1":"Passenger",
            "taxable":true,
            "requires_shipping":true,
            "barcode":"728ACCL97P20-BVY",
            "inventory_quantity":99999,
            "weight":0.60000002384185791,
            "weight_unit":"lb"
         }
      ],
      "images":[  
         {  
            "src":"http://s3-us-west-2.amazonaws.com/tjbproducts/wipers/728/shopify/main/728ACCL97D24P20.jpg";
         },
         {  
            "src":"http://s3-us-west-2.amazonaws.com/tjbproducts/wipers/728/shopify/main/728ACCL97D24P20.jpg";
         },
         {  
            "src":"http://s3-us-west-2.amazonaws.com/tjbproducts/wipers/728/shopify/main/728ACCL97D24.jpg";
         },
         {  
            "src":"http://s3-us-west-2.amazonaws.com/tjbproducts/wipers/728/shopify/main/728ACCL97P20.jpg";
         }
      ],
      "metafields":[  
         {  
            "namespace":"seo",
            "key":"description",
            "value":"Goodyear Wiper Blades for 1997 Acura CL .  Add pack to cart and checkout in under one minute or use our subscribe and save packs.",
            "value_type":"string"
         }
      ]
   }
}

I get this as a response:

{  
   "product":{  
      "id":1513151748,
      "title":"1997 Acura CL Wiper Blade  (Goodyear Wiper Blades - Premium)",
      "body_html":"u003cdivu003eu003culu003enu003cliu003eWiper Pack Includes:u003culu003eu003c/ulu003enu003c/liu003enu003cliu003eIncludes custom printed static cling reminder sticker for the inside of your windshield to check/replace wipers at a specified date, just like the oil change store stickers.  Sticker has web browser url or QR code to lead back to this exact product.u003c/liu003enu003cliu003eMade in the USAu003c/liu003enu003cliu003eSilentArmor Technology for durability and quiet wiping actionu003c/liu003enu003cliu003eWiping element features unique, round-hinge profile allowing wiper to make contact at 45 degree angle for highest proformanceu003c/liu003enu003cliu003eStainless steel flexors provides long lasting durability with no rustingu003c/liu003enu003cliu003eNatural rubber compound for performance and durabilityu003c/liu003enu003cliu003eHeavy duty, riveted steel frame with double coated paint for superior rust resistanceu003c/liu003enu003c/ulu003eu003c/divu003e",
      "vendor":"Goodyear Wiper Blades",
      "product_type":"Wiper Blades",
      "created_at":"2015-09-17T23:06:44-04:00",
      "handle":"1997-acura-cl-wiper-blade-goodyear-wiper-blades-premium-33",
      "updated_at":"2015-09-17T23:06:44-04:00",
      "published_at":"2015-09-17T23:06:44-04:00",
      "template_suffix":null,
      "published_scope":"global",
      "tags":"1997, 97, Acura, Brand u0026 Line_Goodyear - Premium, CL, Make_Acura",
      "variants":[  
         {  
            "id":5334293956,
            "product_id":1513151748,
            "title":"Driver/Passenger",
            "price":"17.45",
            "sku":"728ACCL97D24P20-BVY",
            "position":1,
            "grams":544,
            "inventory_policy":"deny",
            "compare_at_price":null,
            "fulfillment_service":"manual",
            "inventory_management":null,
            "option1":"Driver/Passenger",
            "option2":null,
            "option3":null,
            "created_at":"2015-09-17T23:06:44-04:00",
            "updated_at":"2015-09-17T23:06:44-04:00",
            "requires_shipping":true,
            "taxable":true,
            "barcode":"728ACCL97D24P20-BVY",
            "inventory_quantity":99999,
            "old_inventory_quantity":99999,
            "image_id":null,
            "weight":1.2,
            "weight_unit":"lb"
         },
         {  
            "id":5334294084,
            "product_id":1513151748,
            "title":"Driver",
            "price":"10.78",
            "sku":"728ACCL97D24-BVY",
            "position":2,
            "grams":272,
            "inventory_policy":"deny",
            "compare_at_price":null,
            "fulfillment_service":"manual",
            "inventory_management":null,
            "option1":"Driver",
            "option2":null,
            "option3":null,
            "created_at":"2015-09-17T23:06:44-04:00",
            "updated_at":"2015-09-17T23:06:44-04:00",
            "requires_shipping":true,
            "taxable":true,
            "barcode":"728ACCL97D24-BVY",
            "inventory_quantity":99999,
            "old_inventory_quantity":99999,
            "image_id":null,
            "weight":0.6,
            "weight_unit":"lb"
         },
         {  
            "id":5334294212,
            "product_id":1513151748,
            "title":"Passenger",
            "price":"10.78",
            "sku":"728ACCL97P20-BVY",
            "position":3,
            "grams":272,
            "inventory_policy":"deny",
            "compare_at_price":null,
            "fulfillment_service":"manual",
            "inventory_management":null,
            "option1":"Passenger",
            "option2":null,
            "option3":null,
            "created_at":"2015-09-17T23:06:44-04:00",
            "updated_at":"2015-09-17T23:06:44-04:00",
            "requires_shipping":true,
            "taxable":true,
            "barcode":"728ACCL97P20-BVY",
            "inventory_quantity":99999,
            "old_inventory_quantity":99999,
            "image_id":null,
            "weight":0.6,
            "weight_unit":"lb"
         }
      ],
      "options":[  
         {  
            "id":1855615876,
            "product_id":1513151748,
            "name":"Title",
            "position":1,
            "values":[  
               "Driver/Passenger",
               "Driver",
               "Passenger"
            ]
         }
      ],
      "images":[  
         {  
            "id":3780974020,
            "product_id":1513151748,
            "position":1,
            "created_at":"2015-09-17T23:06:44-04:00",
            "updated_at":"2015-09-17T23:06:44-04:00",
            "src":"https://cdn.shopify.com/s/files/1/0987/4058/products/728ACCL97D24P20_f3344269-06ba-497d-bd98-fa53670...;,
            "variant_ids":[  

            ]
         },
         {  
            "id":3780974084,
            "product_id":1513151748,
            "position":2,
            "created_at":"2015-09-17T23:06:44-04:00",
            "updated_at":"2015-09-17T23:06:44-04:00",
            "src":"https://cdn.shopify.com/s/files/1/0987/4058/products/728ACCL97D24P20_5becef37-2580-4b48-a882-2564968...;,
            "variant_ids":[  

            ]
         },
         {  
            "id":3780974148,
            "product_id":1513151748,
            "position":3,
            "created_at":"2015-09-17T23:06:44-04:00",
            "updated_at":"2015-09-17T23:06:44-04:00",
            "src":"https://cdn.shopify.com/s/files/1/0987/4058/products/728ACCL97D24_ea9e6242-0529-409e-af45-2ddbc20d52...;,
            "variant_ids":[  

            ]
         },
         {  
            "id":3780974212,
            "product_id":1513151748,
            "position":4,
            "created_at":"2015-09-17T23:06:44-04:00",
            "updated_at":"2015-09-17T23:06:44-04:00",
            "src":"https://cdn.shopify.com/s/files/1/0987/4058/products/728ACCL97P20_305570ac-746d-41e1-8fa9-0c26cb2ddb...;,
            "variant_ids":[  

            ]
         }
      ],
      "image":{  
         "id":3780974020,
         "product_id":1513151748,
         "position":1,
         "created_at":"2015-09-17T23:06:44-04:00",
         "updated_at":"2015-09-17T23:06:44-04:00",
         "src":"https://cdn.shopify.com/s/files/1/0987/4058/products/728ACCL97D24P20_f3344269-06ba-497d-bd98-fa53670...;,
         "variant_ids":[  

         ]
      }
   }
}

 

I then try to update the variant image and get the 406 error.  The url is for the variant image update is https://wiperpacks.myshopify.com/admin/variants/5334293956.json

The content for this update is below

{  
   "variant":{  
      "id":5334293956,
      "image_id":3780974084
   }
}

I can't figure out what's wrong, there's no rich error info returned.  Any thoughts?

 

 

 

I then attempt associate the correct image with one of the variants.  I get the 406.  

0 Likes
Shopify Staff (Retired)
Shopify Staff (Retired)
142 0 23

Hi Timothy,

This error can sometimes be caused by using the wrong HTTP verb. Are you making a PUT call to update the variant?

0 Likes
New Member
1 0 0

the same problem with me too


@Josh_Brown1 wrote:

Hi Timothy,

This error can sometimes be caused by using the wrong HTTP verb. Are you making a PUT call to update the variant?


 

0 Likes