2012-09-28 20 views
1

有沒有人通過api添加產品時有鏈接或所有可能變量的示例。或者,也許最好說接受的鍵=值對。當通過api添加產品時,所有可能的變量是什麼? api僅顯示示例

docs api有這個和那個弱示例,但沒有顯示所有接受的參數的權威數組。

http://api.shopify.com/product.html#create

這裏就是我排序從API的例子和反覆試驗拼湊起來。

$array = array(
     'id' => $item->store_id, 
     'title' => $this->sanitize($item->name), 
     'body_html' => $this->sanitize($item->romance_copy), 
     'vendor' => $item->brand, 
     'product_type' => $item->ware_desc, // may not be correct 
     'tags' => $item->keyword, 
     'images' => array(), 
     'metafields' => array(), 
     // http://wiki.shopify.com/Variant#variant.id 
     'variants' => array(// Single variant is required for each product. 
      array( 
       'id' => $item->store_id, 
       'option1' => 'First', 
       'price' => $item->price_msrp, 
       // 'compare_at_price' => '', 
       // 'available' => '', 
       'inventory_quantity' => $item->inventory_quantity, 
       // 'weight' => '', 
       'sku' => $item->direct_sku, 
       // 'requires_shipping' => '', 
       // 'taxable' => '', 
       ), 
      ) 
     ); 

回答

1

人們似乎對他們的wiki更多的信息:

http://wiki.shopify.com/Product_%28API%29
http://wiki.shopify.com/Product
http://wiki.shopify.com/Product_Variant_(API)

編輯:
基於David's answer,你應該能夠發佈的所有產品將所有內容包含在一個JSON對象中,從而實現一個請求中的細節

+0

感謝您的鏈接!談論我部分尋找的內容之一是http://wiki.shopify.com/Product_%28API%29#Product_properties – vc27

+0

感謝您的鏈接!談論我正在尋找的部分內容之一是: http://wiki.shopify.com/Product_%28API%29#Product_properties 我認爲我仍然在尋找的最大的領域之一是「Modify_a_product」的默認屬性。 http://wiki.shopify.com/Product_%28API%29#Modify_a_product 我試圖避免的一件事是對一個產品進行4次更新調用。正如我現在看到的,更糟糕​​的情況下,我會更新:產品,產品變體,產品圖像,產品Metafields。似乎有點多。 – vc27

1

查看產品文檔頁面上GET調用的響應(例如this one)。除idcreated_atupdated_at以外,返回的所有內容都可以編輯。

+0

謝謝!這就是我最終爲「創造」產品所做的工作,並且運作良好。目前我正在更新產品時可能會遇到什麼問題。看起來更新不能以相同的方式執行,我一直在更新3或4部分中的單個產品。產品,變體,圖像和metafields。那是對的嗎? – vc27

相關問題