2012-06-06 111 views
1

我正在创建一个私人应用程序,用于从WordPress调用Shopify API。当我打电话创建新的Shopify产品时,API会创建产品,但会返回404 Not Found错误。我相信我的代码是正确的,因为它成功地在运行apache和PHP 5.2.x的Windows XP盒子上的本地主机上创建产品和相应的成功响应。当我从运行的开发服务器(我假设Linux,apache和PHP 5.3.x)运行它时遇到了问题。什么会导致Shopify API创建产品,但返回404?我将在下面列出呼叫和回复的日志。这篇文章确实成功创建了一个产品,但是由于它返回了一个错误,我无法检索新创建的产品ID。shopify api创建产品退货404

谢谢你,史蒂夫

2012-06-05 @ 17时47分36秒:请求发送到 的https:// XXX:[email protected]/admin/products.json 参数:Array ( [方法] => POST [超时] => 5 [重定向] => 5 [httpversion] => 1.0 [用户代理] =>的WordPress/3.3.2; HTTP:/ /xxx.colab.coop [blocking] => 1 [headers] => Array ( )

[cookies] => Array 
    (
    ) 

[body] => Array 
    (
     [product] => Array 
      (
       [title] => Bracelet 7 
       [body_html] => Bracelet 7 descr 
       [vendor] => xxx 
       [product_type] => bracelet 
       [published] => 1 
       [images] => Array 
        (
         [src] => http://xxx.colab.coop/xxx/stb-1.png 
        ) 

       [variants] => Array 
        (
         [option1] => small 
         [price] => 123 
         [inventory_management] => shopify 
         [sku] => 234 
         [grams] => 226.79618519019 
         [inventory_quantity] => 123 
        ) 

      ) 

    ) 

[compress] => 
[decompress] => 1 
[sslverify] => 1 
[stream] => 
[filename] => 


2012-06-05 @ 17时47分37秒:从 HTTPS接收到的响应:// XXX:[email protected]/admin/products上传.json 交通:WP_HTTP_curl 响应:阵列 ( [标题] =>数组 ( [服务器] => nginx的 [日期] =>星期二,2012年6月5日17时47分37秒GMT [内容类型] => text/html; charset = utf-8 [连接] =>关闭 [vary] => Accept-Encoding [status] => 404 Not Found [cache-control] => no-cache [x-request-id] = > 62c48e7991c1f29cf5917727b160cee9 [X-UA-兼容] => IE =边沿,铬= 1 [X-运行时] => 0.025681 )

[body] => <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http 

://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> 
    <title>404 - Not Found</title> 

    <link href="https://cdn.shopify.com/s/assets/dialog-ef6bd71e99b2c7a469ce6385ab855360.css" media="screen" rel="stylesheet" type="text/css" /> 

</head> 

<body class="netural-dialog"> 

    <div id="container"> 
    <div id="dialog"> 
     <h1>Not Found</h1> 

     <p class="c">The page you were looking for does not exist...</p> 



    </div> <!-- dialog --> 
    </div> <!-- container --> 


    <div id="footer"> 
    <p><a href="http://www.shopify.com">Ecommerce Software by Shopify</a></p> 
    </div> 


</body> 
</html> 

[response] => Array 
    (
     [code] => 404 
     [message] => Not Found 
    ) 

[cookies] => Array 
    (
    ) 

[filename] => 

更新与更多的日志。这创造Shopify产品93781002.

*** REQUEST *** 
2012-06-08 @ 00:14:20: request sent to 
https://xxx:[email protected]/admin/products.json 
Parameters: Array 
(
    [method] => POST 
    [timeout] => 5 
    [redirection] => 5 
    [httpversion] => 1.0 
    [user-agent] => WordPress/3.3.2; http://xxx.colab.coop 
    [blocking] => 1 
    [headers] => Array 
     (
      [Content-Type] => application/json; charset=UTF-8 
     ) 

    [cookies] => Array 
     (
     ) 

    [body] => {"product":{"title":"Bracelet 2","body_html":"Bracelet 2 description","vendor":"Steve","product_type":"bracelet","published":true,"images":{"src":"http:\/\/lr.colab.coop\/wordpress\/wp-content\/themes\/lr\/images\/stb-1.png"},"variants":{"option1":"default","price":"123","inventory_management":"shopify","sku":"555","grams":453.59237038038,"inventory_quantity":"22"},"metafields":{"key":"wp_post_id","value":174,"value_type":"string","namespace":"inventory"}}} 
    [compress] => 
    [decompress] => 1 
    [sslverify] => 
    [stream] => 
    [filename] => 
) 

--------------------------------- 
*** RESPONSE ********** 
2012-06-08 @ 00:14:21: response received from 
https://xxx:[email protected]/admin/products.json 
Transport: WP_HTTP_curl 
Response: Array 
(
    [headers] => Array 
     (
      [server] => nginx 
      [date] => Fri, 08 Jun 2012 00:14:21 GMT 
      [content-type] => text/html; charset=utf-8 
      [connection] => close 
      [vary] => Accept-Encoding 
      [status] => 404 Not Found 
      [cache-control] => no-cache 
      [x-request-id] => ec0ff57554c9deea607c407e00c6c223 
      [x-ua-compatible] => IE=Edge,chrome=1 
      [x-runtime] => 0.012695 
     ) 

    [body] => <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> 
    <title>404 - Not Found</title> 

    <link href="https://cdn.shopify.com/s/assets/dialog-ef6bd71e99b2c7a469ce6385ab855360.css" media="screen" rel="stylesheet" type="text/css" /> 

</head> 

<body class="netural-dialog"> 

    <div id="container"> 
    <div id="dialog"> 
     <h1>Not Found</h1> 

     <p class="c">The page you were looking for does not exist...</p> 



    </div> <!-- dialog --> 
    </div> <!-- container --> 


    <div id="footer"> 
    <p><a href="http://www.shopify.com">Ecommerce Software by Shopify</a></p> 
    </div> 


</body> 
</html> 

    [response] => Array 
     (
      [code] => 404 
      [message] => Not Found 
     ) 

    [cookies] => Array 
     (
     ) 

    [filename] => 
) 

--------------------------------- 

对不起这里倾倒了这么多的内容,但这里是6月13日的第一次调用成功创建了Shopify产品“办公室戒指1”,但返回错误消息的新记录。然后,我手动将Shopify ID添加到本地产品中,然后成功添加了一个变体“medium”,但也返回了错误消息。这些来自网络服务器nix服务器。然后,我在Windows笔记本电脑上运行了本地Web服务器的相同请求。这些请求还成功创建了产品“Home Ring 1”,但返回了适当的成功消息。

*** REQUEST *** 
2012-06-13 @ 12:18:38: request sent to 
https://removed_aac8:[email protected]/admin/products.json 
Parameters: Array 
(
    [method] => POST 
    [timeout] => 5 
    [redirection] => 5 
    [httpversion] => 1.0 
    [user-agent] => WordPress/3.3.2; http://removed.colab.coop 
    [blocking] => 1 
    [headers] => Array 
     (
      [Content-Type] => application/json; charset=UTF-8 
     ) 

    [cookies] => Array 
     (
     ) 

    [body] => {"product":{"title":"Office Ring 1","body_html":"Office Ring 1 description","vendor":"Steve","product_type":"ring","published":true,"variants":{"option1":"small","price":"123","inventory_management":"shopify","sku":"1234","grams":226.79618519019,"inventory_quantity":"10"},"images":{"position":1,"src":"http:\/\/lr.colab.coop\/wordpress\/wp-content\/themes\/lr\/images\/stb-1.png"}}} 
    [compress] => 
    [decompress] => 1 
    [sslverify] => 
    [stream] => 
    [filename] => 
) 

--------------------------------- 
*** RESPONSE ********** 
2012-06-13 @ 12:18:40: response received from 
https://removed_aac8:[email protected]/admin/products.json 
Transport: WP_HTTP_curl 
Response: Array 
(
    [headers] => Array 
     (
      [server] => nginx 
      [date] => Wed, 13 Jun 2012 12:18:40 GMT 
      [content-type] => text/html; charset=utf-8 
      [connection] => close 
      [vary] => Accept-Encoding 
      [status] => 404 Not Found 
      [cache-control] => no-cache 
      [x-request-id] => f5ef52645dc28af4993c1378440ad19a 
      [x-ua-compatible] => IE=Edge,chrome=1 
      [x-runtime] => 0.019331 
     ) 

    [body] => <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> 
    <title>404 - Not Found</title> 

    <link href="https://cdn.shopify.com/s/assets/dialog-ef6bd71e99b2c7a469ce6385ab855360.css?351e96af6f2f2a94c178c053ba0d35a46ec146b4" media="screen" rel="stylesheet" type="text/css" /> 

</head> 

<body class="netural-dialog"> 

    <div id="container"> 
    <div id="dialog"> 
     <h1>Not Found</h1> 

     <p class="c">The page you were looking for does not exist...</p> 



    </div> <!-- dialog --> 
    </div> <!-- container --> 


    <div id="footer"> 
    <p><a href="http://www.shopify.com">Ecommerce Software by Shopify</a></p> 
    </div> 


</body> 
</html> 

    [response] => Array 
     (
      [code] => 404 
      [message] => Not Found 
     ) 

    [cookies] => Array 
     (
     ) 

    [filename] => 
) 

--------------------------------- 
*** REQUEST *** 
2012-06-13 @ 12:22:26: request sent to 
https://removed_aac8:[email protected]/admin/products/94072324/variants.json 
Parameters: Array 
(
    [method] => POST 
    [timeout] => 5 
    [redirection] => 5 
    [httpversion] => 1.0 
    [user-agent] => WordPress/3.3.2; http://removed.colab.coop 
    [blocking] => 1 
    [headers] => Array 
     (
      [Content-Type] => application/json; charset=UTF-8 
     ) 

    [cookies] => Array 
     (
     ) 

    [body] => {"variant":{"option1":"medium","price":"123","inventory_management":"shopify","sku":"1235","grams":226.79618519019,"inventory_quantity":"11"}} 
    [compress] => 
    [decompress] => 1 
    [sslverify] => 
    [stream] => 
    [filename] => 
) 

--------------------------------- 
*** RESPONSE ********** 
2012-06-13 @ 12:22:27: response received from 
https://removed_aac8:[email protected]/admin/products/94072324/variants.json 
Transport: WP_HTTP_curl 
Response: Array 
(
    [headers] => Array 
     (
      [server] => nginx 
      [date] => Wed, 13 Jun 2012 12:22:27 GMT 
      [content-type] => text/html; charset=utf-8 
      [connection] => close 
      [vary] => Accept-Encoding 
      [status] => 200 OK 
      [etag] => "450e16059f610a357485485b091697f7" 
      [cache-control] => max-age=0, private, must-revalidate 
      [x-request-id] => 2ebbec10eefda01f51e06d9d5ed4004f 
      [x-ua-compatible] => IE=Edge,chrome=1 
      [set-cookie] => _secure_session_id=8efbf69a284bbc7f3652ac6f34e9a2ba; path=/; secure; HttpOnly 
      [x-runtime] => 0.025468 
      [p3p] => CP="NOI DSP COR NID ADMa OPTa OUR NOR" 
     ) 

    [body] => <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
    <script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script> 
    <title>Shopify &raquo; Please Log In</title> 
    <link href="https://cdn.shopify.com/s/assets/dialog-ef6bd71e99b2c7a469ce6385ab855360.css?351e96af6f2f2a94c178c053ba0d35a46ec146b4" media="screen" rel="stylesheet" type="text/css" /> 
    <!--[if IE 6]> 
    <link href="https://cdn.shopify.com/s/assets/ie-e556ea04e7e58d6a732ca8d5254a1edc.css?351e96af6f2f2a94c178c053ba0d35a46ec146b4" media="screen" rel="stylesheet" type="text/css" /> 
    <![endif]--> 
    <script src="https://cdn.shopify.com/s/assets/admin/auth-0b1f81e1e47d1c2021fc18fe8772a287.js?351e96af6f2f2a94c178c053ba0d35a46ec146b4" type="text/javascript"></script> 
    <script type="text/javascript" language="javascript"> 
    window.onload = function() { 
    if ($('login-input')) { 
     if ($('login-input').value == '') { 
     Field.activate('login-input'); 
     } 
     else { 
     Field.activate('password'); 
     } 
    } 
    } 
    </script> 

     <script type="text/javascript"> 

     var _gaq = _gaq || []; 
     _gaq.push(['_setAccount', 'UA-82702-18' ]); 
     _gaq.push(['_setDomainName', '.myshopify.com']); 
     _gaq.push(['_setAllowHash', false]); 
     _gaq.push(['_setCustomVar', 
      1,     
      'CustomerType',  
      'prospect', 
      2 
     ]); 
     _gaq.push(['_trackPageview']); 

     (function() { 
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
     })(); 

     </script> 

</head> 
<body> 
    <div id="container"> 
    <div id="dialog"> 
     <div id="system_error" class="status system-error"><p>Login or password was invalid.</p></div> 

<div class="ssb c"> 
    <img alt="Shopify-logo-new" src="https://cdn.shopify.com/s/images/admin/shopify-logo-new.jpg?351e96af6f2f2a94c178c053ba0d35a46ec146b4" /> 
</div> 

<form accept-charset="UTF-8" action="/admin/auth/login" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="RSdZQn6QN2MfWeyb6JwkbYKlxi4wxdvLxKEAEuChE/8=" /></div> 
<div id="sign-in-form" class="lform"> 
    <noscript><p>Please note that in order to use the Shopify administration interface you need to <a href="/documents/javascript.html">enable javascript</a>.</p></noscript> 

    <input type="hidden" name="redirect" value="" id="redirect" /> 

    <div id="login" > 
    <div class="ppb clearfix"> 
     <label id="email_address" for="login-input">Email Address</label> 
     <input type="email" name="login" size="30" id="login-input" class="email" value="" class="error" tabindex=1 /> 
    </div> 
    <div class="ppb clearfix"> 
     <label id="password_label" for="password">Password</label> 
     <input type="password" name="password" size="16" id="password" class="error" tabindex=2 /> 
     <div id="forgot-password"> 
     <a href="/admin/auth/recover">Forgot your password?</a> 
     </div> 
    </div> 
    <div class="ppb c"> 
     <input name="remember" type="checkbox" id="remember_checkbox" value="1" /> 
     <label for="remember_checkbox" class="normal">Remember me on this computer</label> 
    </div> 
    </div> 

    <div id="open-id" style="display:none"> 
    <div class="ppb clearfix"> 
     <label id="open_id" for="openid-input" class="open-id">OpenID</label> 
     <input type="text" name="openid_url" value="" class="url" id="openid-input" class="error" /> 
    </div> 
    </div> 

    <div class="actions"> 
    <input class="btn" name="commit" tabindex="3" type="submit" value="Sign In" /> 
    </div> 

</div> 

</form> 


<script type="text/javascript" charset="utf-8"> 
    document.observe("dom:loaded", function() { 


    $$('input').each(function(e) { 
     e.autocapitalize = false; 
    }); 

    }); 
</script> 

    </div> 
    </div> 
    <div id="footer"> 
    <div> 
    <span style='padding-left:10px;'> 
    <img alt="Google_apps-16" src="https://cdn.shopify.com/s/images/admin/icons/google_apps-16.png?351e96af6f2f2a94c178c053ba0d35a46ec146b4" /> 
    <a href="/admin/auth/login?google_apps=1">Login with Google Apps</a> 
    </span> 
</div> 



    </div> 
    <script type="text/javascript">if (!NREUMQ.f) { NREUMQ.f=function() { 
NREUMQ.push(["load",new Date().getTime()]); 
var e=document.createElement("script"); 
e.type="text/javascript";e.async=true;e.src="https://d1ros97qkrwjf5.cloudfront.net/38/eum/rum-staging.js"; 
document.body.appendChild(e); 
if(NREUMQ.a)NREUMQ.a(); 
}; 
NREUMQ.a=window.onload;window.onload=NREUMQ.f; 
}; 
NREUMQ.push(["nrfj","beacon-1.newrelic.com","fa45dcf839",151,"dl8KQUReDl4AEE1TVVhZChpXRBZaSg4NVVhb",0.0,17,new Date().getTime(),"","","","",""])</script> 
</body> 
</html> 

    [response] => Array 
     (
      [code] => 200 
      [message] => OK 
     ) 

    [cookies] => Array 
     (
      [0] => WP_Http_Cookie Object 
       (
        [name] => _secure_session_id 
        [value] => 8efbf69a284bbc7f3652ac6f34e9a2ba 
        [expires] => 
        [path] =>/
        [domain] => 
        [secure] => 
        [httponly] => 
       ) 

     ) 

    [filename] => 
) 

--------------------------------- 

而且现在的成功主页日志

*** REQUEST *** 
2012-06-13 @ 12:27:40: request sent to 
https://removed_aac8:[email protected]/admin/products.json 
Parameters: Array 
(
    [method] => POST 
    [timeout] => 5 
    [redirection] => 5 
    [httpversion] => 1.0 
    [user-agent] => WordPress/3.3.2; http://localhost/knowledgetown/office/wordpress 
    [blocking] => 1 
    [headers] => Array 
     (
      [Content-Type] => application/json; charset=UTF-8 
     ) 

    [cookies] => Array 
     (
     ) 

    [body] => {"product":{"title":"Home Ring 1","body_html":"Home Ring 1 description","vendor":"Auto Draft","product_type":"ring","published":true,"variants":{"option1":"small","price":"123","inventory_management":"shopify","sku":"1234","grams":226.79618519019,"inventory_quantity":"10"},"images":{"position":1,"src":"http:\/\/lr.colab.coop\/wordpress\/wp-content\/themes\/lr\/images\/stb-1.png"}}} 
    [compress] => 
    [decompress] => 1 
    [sslverify] => 
    [stream] => 
    [filename] => 
) 

--------------------------------- 
*** RESPONSE ********** 
2012-06-13 @ 12:27:41: response received from 
https://removed_aac8:[email protected]/admin/products.json 
Transport: WP_HTTP_curl 
Response: Array 
(
    [headers] => Array 
     (
      [server] => nginx 
      [date] => Wed, 13 Jun 2012 12:27:40 GMT 
      [content-type] => application/json; charset=utf-8 
      [connection] => close 
      [status] => 201 Created 
      [x-shopify-shop-api-call-limit] => 1/500 
      [http_x_shopify_shop_api_call_limit] => 1/500 
      [location] => https://colab-5.myshopify.com/admin/products/94072592 
      [cache-control] => no-cache 
      [x-request-id] => 36b9127191967ed4bf9b2039eb651790 
      [x-ua-compatible] => IE=Edge,chrome=1 
      [set-cookie] => _secure_session_id=15d92980d403a103a3e8da29a33c8e7f; path=/; secure; HttpOnly 
      [x-runtime] => 0.585917 
     ) 

    [body] => {"product":{"body_html":"Home Ring 1 description","created_at":"2012-06-13T08:27:40-04:00","handle":"home-ring-1","id":94072592,"product_type":"ring","published_at":"2012-06-13T08:27:40-04:00","template_suffix":null,"title":"Home Ring 1","updated_at":"2012-06-13T08:27:40-04:00","vendor":"Auto Draft","tags":"","variants":[{"compare_at_price":null,"created_at":"2012-06-13T08:27:40-04:00","fulfillment_service":"manual","grams":226,"id":220076798,"inventory_management":"shopify","inventory_policy":"deny","option1":"small","option2":null,"option3":null,"position":1,"price":"123.00","product_id":94072592,"requires_shipping":true,"sku":"1234","taxable":true,"title":"small","updated_at":"2012-06-13T08:27:40-04:00","inventory_quantity":10}],"images":[{"created_at":"2012-06-13T08:27:40-04:00","id":187968224,"position":1,"product_id":94072592,"updated_at":"2012-06-13T08:27:40-04:00","src":"http://cdn.shopify.com/s/files/1/0157/0142/products/stb-2.png?241"}],"options":[{"name":"Title"}]}} 
    [response] => Array 
     (
      [code] => 201 
      [message] => Created 
     ) 

    [cookies] => Array 
     (
      [0] => WP_Http_Cookie Object 
       (
        [name] => _secure_session_id 
        [value] => 15d92980d403a103a3e8da29a33c8e7f 
        [expires] => 
        [path] =>/
        [domain] => 
        [secure] => 
        [httponly] => 
       ) 

     ) 

    [filename] => 
) 

--------------------------------- 
*** REQUEST *** 
2012-06-13 @ 12:28:13: request sent to 
https://removed_aac8:[email protected]/admin/products/94072592/variants.json 
Parameters: Array 
(
    [method] => POST 
    [timeout] => 5 
    [redirection] => 5 
    [httpversion] => 1.0 
    [user-agent] => WordPress/3.3.2; http://localhost/knowledgetown/office/wordpress 
    [blocking] => 1 
    [headers] => Array 
     (
      [Content-Type] => application/json; charset=UTF-8 
     ) 

    [cookies] => Array 
     (
     ) 

    [body] => {"variant":{"option1":"medium","price":"123","inventory_management":"shopify","sku":"1235","grams":226.79618519019,"inventory_quantity":"11"}} 
    [compress] => 
    [decompress] => 1 
    [sslverify] => 
    [stream] => 
    [filename] => 
) 

--------------------------------- 
*** RESPONSE ********** 
2012-06-13 @ 12:28:13: response received from 
https://removed_aac8:[email protected]/admin/products/94072592/variants.json 
Transport: WP_HTTP_curl 
Response: Array 
(
    [headers] => Array 
     (
      [server] => nginx 
      [date] => Wed, 13 Jun 2012 12:28:13 GMT 
      [content-type] => application/json; charset=utf-8 
      [connection] => close 
      [status] => 201 Created 
      [x-shopify-shop-api-call-limit] => 4/500 
      [http_x_shopify_shop_api_call_limit] => 4/500 
      [location] => https://colab-5.myshopify.com/admin/products/94072592/variants 
      [cache-control] => no-cache 
      [x-request-id] => fd0cfb4f0279424a850d6bf100533f1d 
      [x-ua-compatible] => IE=Edge,chrome=1 
      [set-cookie] => _secure_session_id=63dd9cc4fcd51eacb0a792ffb148de5e; path=/; secure; HttpOnly 
      [x-runtime] => 0.069807 
     ) 

    [body] => {"variant":{"compare_at_price":null,"created_at":"2012-06-13T08:28:13-04:00","fulfillment_service":"manual","grams":226,"id":220076802,"inventory_management":"shopify","inventory_policy":"deny","option1":"medium","option2":null,"option3":null,"position":2,"price":"123.00","product_id":94072592,"requires_shipping":true,"sku":"1235","taxable":true,"title":"medium","updated_at":"2012-06-13T08:28:13-04:00","inventory_quantity":11}} 
    [response] => Array 
     (
      [code] => 201 
      [message] => Created 
     ) 

    [cookies] => Array 
     (
      [0] => WP_Http_Cookie Object 
       (
        [name] => _secure_session_id 
        [value] => 63dd9cc4fcd51eacb0a792ffb148de5e 
        [expires] => 
        [path] =>/
        [domain] => 
        [secure] => 
        [httponly] => 
       ) 

     ) 

    [filename] => 
) 

--------------------------------- 
+0

如果您将调用的URL放到浏览器中,会发生什么情况?它会返回产品列表还是404? –

回答

2

纪录中的要求说,你分别致电POST "/admin/products/PRODUCT_ID"。检查你的代码,确保它正在做你的想法。请注意,所有API调用都应该有一个类型后缀,因此有效的URL将是/admin/products/PRODUCT_ID.json/admin/products/PRODUCT_ID.xml

+0

它也应该看起来像内容类型头没有被传入。 [headers] => Array([Content-Type] =>“application/json”)也应该包含在内。 – csaunders

+0

浏览器中的网址返回产品列表。我的电话都以.json结尾。我的所有工作。我将Content-Type添加到标题中。我通过使用requestb.in验证了这一点。仍然404.如果我在家用电脑上运行相同的代码(Windows XP,Apache,PHP 5.2.x),请求返回201 Created。如果我在Web服务器服务器上运行代码(我假设运行的是Linux,apache,PHP 5.3.x),那么我将获得404。即使获得404,该产品仍然是在Shopify中创建的。我正在寻找一些与家庭和农场类似的编码或其他标题设置。 – smohlke

+0

您可以尝试添加[Accept] =>“application/json”标头。我不太确定可能导致问题的原因。有时候它只是缺少导致这样的东西的标题。 – csaunders