以下是我传递给Shopify的内容:
curl -v -i -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Shopify-Access-Token: 1fadecf1b0eee641ce0248e3b5f053XX" -X POST "https://[key]:[pass]@[store].myshopify.com/admin/orders/361911625/fulfillments.json" -d '{"fulfillment":{"tracking_numbers":["1Z89E5W203624344XX"],"line_items":[{"id":640901329}],"notify_customer":"true"}}'
回复是:
HTTP/1.1 404 Not Found Server: nginx Date: Fri, 12 Dec 2014 15:59:22 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: close Vary: Accept-Encoding Vary: Accept-Encoding Status: 404 Not Found X-XSS-Protection: 1; mode=block; report=/xss-report/ec54beef-a112-4fb7-a19a-b76a6960616a?source%5Baction%5D=create&source%5Bcontroller%5D=admin%2Ffulfillments&source%5Bsection%5D=admin X-Content-Type-Options: nosniff X-UA-Compatible: chrome=1 X-ShopId: 4XXX5XX X-ShardId: 2 X-Shopify-Shop-Api-Call-Limit: 1/40 HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/40 X-Stats-UserId: 0 X-Stats-ApiClientId: 513097 X-Stats-ApiPermissionId: 9286803 X-Request-Id: ec54beef-a112-4fb7-a19a-b76a696061XX
{"errors":"Not Found"}
我在PHP工作,尝试使用基于PHP的curl函数,curl_init,setopt,curl_exec ...但是得到了相同的结果,所以尝试切换到命令行。在网上搜索时,我尝试了所有可以找到的“修复”,但似乎没有一个是我的原因。
答案 0 :(得分:0)
这对我有用:
curl -v -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST "https://KEY:PASSWORD@YOURSHOP.myshopify.com/admin/orders/381824040/fulfillments.json" -d '{"fulfillment":{"notify_customer":true,"tracking_numbers":["ce09af9e9cc42f4b6306d7de4b6ad655"],"line_items":[{"id":682326640}]}}'
如果您仍然遇到问题,请仔细检查订单ID和订单项ID。
请注意,对于私有应用,您不需要X-Shopify-Access-Token
,true
上的notify_customer
值不应该引用。{1}}。希望这有帮助!
答案 1 :(得分:0)
就我而言,问题是我将line_items
id
与variant
id
混为一谈。
我理解当/admin/orders/381824040/fulfillments.json
line_items
/admin/orders/381824040/fulfillments.json
出现404错误时
然后在line_items
没有Enum Days { get; }
的情况下取得了成功。