我目前在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命令的详细转储。如上所示,我对路径使用了以下格式。我确实用隐藏或全部替换了一些变量,仅供参考。
/admin/订单/# {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
注:我想指出的是,我使用了以下API文档http://docs.shopify.com/api/fulfillment创建
它建议我使用把/admin/订单/# {id}/实现/# {id} . json
然而,#{id}在那里被引用了两次,这表明我应该在一行中使用两次订单id,但是文档清楚地显示了/admin/orders/450789469/fulfillments/255858046.json的示例我希望更清楚地了解#{id}实际代表什么以及如何使用它们。
我想你只是在/admin/orders/#{ID}/fulfillment/#{ID}.json中使用了错误的ID。你说的第一个是对的,它是订单ID,但第二个是履行ID。在创建履行响应中返回了履行ID。