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 を取得できませんでした。
ありがとう、スティーブ
2012-06-05 @ 17:47:36: リクエストが https://xxx:xxx@colab-5.myshopify.com/admin/products.json に送信されました パラメータ: 配列 ( [メソッド] => POST [タイムアウト] = > 5 [リダイレクト] => 5 [httpversion] => 1.0 [ユーザーエージェント] => WordPress/3.3.2; http://xxx.colab.coop [ブロッキング] => 1 [ヘッダー] => 配列 ( )
[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:xxx@colab-5.myshopify.com/admin/products.json から受信した応答: WP_HTTP_curl 応答: 配列 ( [ヘッダー] => 配列 ( [サーバー] => nginx [日付] => 2012 年 6 月 5 日 17:47:37 GMT [コンテンツ タイプ] => text/html; charset=utf-8 [接続] => 閉じる [変更] => 同意-エンコーディング [ステータス] => 404 見つかりません [キャッシュ制御] => キャッシュなし [x-request-id] => 62c48e7991c1f29cf5917727b160cee9 [x-ua 互換] => IE=Edge、chrome=1 [x-runtime ] => 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:xxx@colab-5.myshopify.com/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:xxx@colab-5.myshopify.com/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 製品「Office Ring 1」が正常に作成されましたが、エラー メッセージが返されました。次に、shopify ID を手動でローカル製品に追加し、バリアント「medium」を正常に追加しましたが、エラー メッセージも返されました。これらは Web ファームの nix サーバーからのものでした。次に、Windows ラップトップのローカル Web サーバーから同じ一連の要求を実行しました。これらの要求は、製品 "Home Ring 1" も正常に作成しましたが、適切な成功メッセージを返しました。
*** REQUEST ***
2012-06-13 @ 12:18:38: request sent to
https://removed_aac8:removed_e2ba@colab-5.myshopify.com/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:removed_e2ba@colab-5.myshopify.com/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:removed_e2ba@colab-5.myshopify.com/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:removed_e2ba@colab-5.myshopify.com/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 » 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="✓" /><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:removed_e2ba@colab-5.myshopify.com/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:removed_e2ba@colab-5.myshopify.com/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:removed_e2ba@colab-5.myshopify.com/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:removed_e2ba@colab-5.myshopify.com/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] =>
)
---------------------------------