Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

Hammad Khalid commented on Create product with variants fails 400 - bad request

$
0
0

Hi Shane,

The issue was actually with the JSON. You closed off the "product" object too soon.

"product":{
   ...   "vendor":"Matrox",   "published":true   },                         <===== Problem    "options":[]     ...

This ends up closing off the "product" object. So you end up separating product object, from the options and variants. The JSON should have been:

"product":{"vendor":"Matrox","published":true,                 "options":[]
   ...
}  

Overall, the following JSON is what you need: 

{"product":{"body_html":"Reinforcing its position as a multi-monitor trailblazer, Matrox Graphics Inc. has once again developed the most flexible and highly advanced solution in the industry. Introducing the new Matrox G200 Multi-Monitor Series; the first graphics card ever to support up to four DVI digital flat panel displays on a single 8&quot; PCI board.<br /><br />With continuing demand for digital flat panels in the financial workplace, the Matrox G200 MMS is the ultimate in flexible solutions. The Matrox G200 MMS also supports the new digital video interface (DVI) created by the Digital Display Working Group (DDWG) designed to ease the adoption of digital flat panels. Other configurations include composite video capture ability and onboard TV tuner, making the Matrox G200 MMS the complete solution for business needs.<br /><br />Based on the award-winning MGA-G200 graphics chip, the Matrox G200 Multi-Monitor Series provides superior 2D/3D graphics acceleration to meet the demanding needs of business applications such as real-time stock quotes (Versus), live video feeds (Reuters &amp; Bloombergs), multiple windows applications, word processing, spreadsheets and CAD.","created_at":"2014-04-28T11:19:43","published_at":"2014-04-28T11:19:43","product_type":"Graphics Cards","title":"Matrox G200 MMS","vendor":"Matrox","published":true,"options":[
    {"name":"Model"
    },
    {"name":"Memory"
    }
    ],"variants":[
      {"option1":"Value","option2":"4mb","compare_at_price":null,"position":1,"inventory_management":"shopify","inventory_policy":"deny","price":"299.99","fulfillment_service":"manual","requires_shipping":true,"taxable":false,"inventory_quantity":0,"created_at":"2014-04-28T11:19:43","grams":23.00,"sku":"MG200MMSValue4mb","barcode":"MG200MMSValue4mb"
      },
      {"option1":"Value","option2":"8mb","compare_at_price":null,"position":2,"inventory_management":"shopify","inventory_policy":"deny","price":"349.99","fulfillment_service":"manual","requires_shipping":true,"taxable":false,"inventory_quantity":0,"created_at":"2014-04-28T11:19:43","grams":23.00,"sku":"MG200MMSValue8mb","barcode":"MG200MMSValue8mb"
      },
      {"option1":"Value","option2":"16mb","compare_at_price":null,"position":3,"inventory_management":"shopify","inventory_policy":"deny","price":"369.99","fulfillment_service":"manual","requires_shipping":true,"taxable":false,"inventory_quantity":0,"created_at":"2014-04-28T11:19:43","grams":23.00,"sku":"MG200MMSValue16mb","barcode":"MG200MMSValue16mb"
      },
      {"option1":"Premium","option2":"4mb","compare_at_price":null,"position":4,"inventory_management":"shopify","inventory_policy":"deny","price":"399.99","fulfillment_service":"manual","requires_shipping":true,"taxable":false,"inventory_quantity":0,"created_at":"2014-04-28T11:19:43","grams":23.00,"sku":"MG200MMSPremium4mb","barcode":"MG200MMSPremium4mb"
      },
      {"option1":"Premium","option2":"8mb","compare_at_price":null,"position":5,"inventory_management":"shopify","inventory_policy":"deny","price":"449.99","fulfillment_service":"manual","requires_shipping":true,"taxable":false,"inventory_quantity":0,"created_at":"2014-04-28T11:19:43","grams":23.00,"sku":"MG200MMSPremium8mb","barcode":"MG200MMSPremium8mb"
      },
      {"option1":"Premium","option2":"16mb","compare_at_price":null,"position":6,"inventory_management":"shopify","inventory_policy":"deny","price":"469.99","fulfillment_service":"manual","requires_shipping":true,"taxable":false,"inventory_quantity":0,"created_at":"2014-04-28T11:19:43","grams":23.00,"sku":"MG200MMSPremium16mb","barcode":"MG200MMSPremium16mb"
      }
    ]
  }
}

 


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>