Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 11th, 2012  |  syntax: None  |  size: 4.33 KB  |  hits: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Unable to create custom collection of products via Shopify API post
  2. $charge = array
  3.     (
  4.         "custom_collection"=>array
  5.         (
  6.             "title"=>"ThisTest",
  7.             "collects"=>array(
  8.                 "product_id"=>96525818,
  9.                 "product_id"=>96393246
  10.             )
  11.         )
  12.     );
  13.     try
  14.     {
  15.         // All requests accept an optional fourth parameter, that is populated with the response headers.
  16.         $my_collect = $shopify('POST', '/admin/custom_collections.json', $charge, $response_headers);
  17.  
  18.         // API call limit helpers
  19.         echo shopify_calls_made($response_headers); // 2
  20.         echo shopify_calls_left($response_headers); // 298
  21.         echo shopify_call_limit($response_headers); // 300
  22.  
  23.     }
  24.     catch (ShopifyApiException $e)
  25.     {            
  26.         echo "doh";
  27.         print_r($e);
  28.     }
  29.  
  30. }
  31.        
  32. ShopifyApiException Object
  33.        
  34. )
  35.  
  36.             )
  37.  
  38.         [response_headers] => Array
  39.             (
  40.                 [http_status_message] => Internal Server Error
  41.                 [http_status_code] => 500
  42.                 [server] => nginx
  43.                 [date] => Mon, 16 Jul 2012 23:23:45 GMT
  44.                 [content-type] => application/json; charset=utf-8
  45.                 [transfer-encoding] => chunked
  46.                 [connection] => keep-alive
  47.                 [status] => 500 Internal Server Error
  48.                 [x-shopify-shop-api-call-limit] => 18/500
  49.                 [http_x_shopify_shop_api_call_limit] => 18/500
  50.                 [cache-control] => no-cache
  51.                 [x-request-id] => f22337df8773ff4fa2f9f384ca21f133
  52.                 [x-ua-compatible] => IE=Edge,chrome=1
  53.                 [set-cookie] => _secure_session_id=50f46da87f21f8a1b458baaf8e97a30a; path=/; secure; HttpOnly
  54.                 [x-runtime] => 0.307888
  55.             )
  56.  
  57.         [response] => Array
  58.             (
  59.                 [errors] => Error
  60.             )
  61.  
  62.     )
  63.  
  64. [message:protected] => Internal Server Error
  65. [string:Exception:private] =>
  66. [code:protected] => 500
  67. [file:protected] => /home/lolsmg/www/shopify_pinterest/shopify.php
  68. [line:protected] => 32
  69. [trace:Exception:private] => Array
  70.     (
  71.         [0] => Array
  72.             (
  73.                 [file] => /home/lolsmg/www/shopify_pinterest/pintrest_ui.php
  74.                 [line] => 65
  75.                 [function] => {closure}
  76.                 [args] => Array
  77.                     (
  78.                         [0] => POST
  79.                         [1] => /admin/custom_collections.json
  80.                         [2] => Array
  81.                             (
  82.                                 [custom_collection] => Array
  83.                                     (
  84.                                         [title] => ToddTest
  85.                                         [collects] => Array
  86.                                             (
  87.                                                 [product_id] => 96393246
  88.                                             )
  89.  
  90.                                     )
  91.  
  92.                             )
  93.  
  94.                         [3] => Array
  95.                             (
  96.                                 [http_status_message] => Internal Server Error
  97.                                 [http_status_code] => 500
  98.                                 [server] => nginx
  99.                                 [date] => Mon, 16 Jul 2012 23:23:45 GMT
  100.                                 [content-type] => application/json; charset=utf-8
  101.                                 [transfer-encoding] => chunked
  102.                                 [connection] => keep-alive
  103.                                 [status] => 500 Internal Server Error
  104.                                 [x-shopify-shop-api-call-limit] => 18/500
  105.                                 [http_x_shopify_shop_api_call_limit] => 18/500
  106.                                 [cache-control] => no-cache
  107.                                 [x-request-id] => f22337df8773ff4fa2f9f384ca21f133
  108.                                 [x-ua-compatible] => IE=Edge,chrome=1
  109.                                 [set-cookie] => _secure_session_id=50f46da87f21f8a1b458baaf8e97a30a; path=/; secure; HttpOnly
  110.                                 [x-runtime] => 0.307888
  111.                             )
  112.  
  113.                     )
  114.  
  115.             )
  116.  
  117.     )
  118.  
  119. [previous:Exception:private] =>
  120.        
  121. {"custom_collection"=>{"title"=>"ToddTest", "collects"=>{"product_id"=>96393246}}}
  122.        
  123. {"custom_collection"=>{"title"=>"ToddTest", "collects"=>[{"product_id"=>96393246}]}}