修改现有的Fulfillment意外返回404页面

时间:2013-03-27 21:12:00

标签: php api shopify fulfillment

我目前在github上使用sandeepshetty的shopify.php插件 https://github.com/sandeepshetty/shopify.php

该插件似乎有效,逻辑非常简单。我已使用“创建新配置”对其进行了测试,但在使用“修改现有配送”API调用时收到错误消息。

我提交以下字符串,收到404错误

$orders = $shopify('PUT', "/admin/orders/160387514/fulfillments/791851111396.json", $fulfillment_put, $response_headers);

$ fulfillment_put 转换为有效负载

{ "fulfillment": { "tracking_number": "987654321", "id": 255858046 } }

以下是PUT命令的详细转储。如上所示,我使用以下格式作为路径。我确实用隐藏或替换了一些变量作为fyi。

/管理/命令/#{ORDER_ID} /应验/#{PRODUCT_ID}上传.json

* About to connect() to alt.myshopify.com port 443 (#0)
*   Trying 204.93.213.40... * connected
* Connected to alt.myshopify.com (204.93.213.40) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: /usr/share/curl/curl-ca-bundle.crt
  CApath: none
* SSL connection using RC4-SHA
* Server certificate:
* subject: /serialNumber=Hidden/C=CA/ST=Ontario/L=Ottawa/O=Jaded Pixel Technologies Inc./CN=*.myshopify.com
* start date: 2010-05-10 22:23:08 GMT
* expire date: 2015-08-12 19:17:14 GMT
* subjectAltName: alt.myshopify.com matched
* issuer: /C=US/O=Equifax/OU=Equifax Secure Certificate Authority
* SSL certificate verify ok.
* Server auth using Basic with user 'hidden for privacy'
> PUT /admin/orders/160387514/fulfillments/791851111396.json HTTP/1.1
Authorization: Basic hidden for privacy=
User-Agent: HAC
Host: alt.myshopify.com
Accept: */*
Content-Type: application/json; charset=utf-8
Content-Length: 62

< HTTP/1.1 404 Not Found
< Server: nginx
< Date: Thu, 21 Mar 2013 21:39:06 GMT
< Content-Type: application/json; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< Status: 404 Not Found
< X-Shopify-Shop-Api-Call-Limit: 2/500
< HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 2/500
< X-Request-Id: 7ec529327cd022e973f22be4a9e86916
< X-UA-Compatible: IE=Edge,chrome=1
< Set-Cookie: _secure_session_id=hidden; path=/; secure; HttpOnly
< X-Runtime: 0.042757
< 
* Connection #0 to host alt.myshopify.com left intact
* Closing connection #0

P.S。 我想请注意,我使用了以下API文档 http://docs.shopify.com/api/fulfillment#create

它表明我使用 PUT / admin / orders /#{id} / fulfillments /#{id} .json

但是,#{id}在那里引用了两次,这表明我应该连续两次使用订单ID,但文档清楚地显示了/admin/orders/450789469/fulfillments/255858046.json的示例 我想更清楚地说明实际的#{id}代表什么以及如何使用它们。

1 个答案:

答案 0 :(得分:0)

我认为你只是在/admin/orders/#{id}/fulfillments/#{id}.json中使用了错误的ID。你对第一个是正确的,它是订单ID,但第二个是履行ID。履行ID已在创建履行回复中返回。