0

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

该插件似乎可以工作,并且逻辑相当简单。我已经使用“创建一个新的 Fulfillment ”对其进行了测试,但是在使用“ Modify an existing Fulfillment ”API 调用时我收到一条错误消息。

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

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

$fulfillment_put转换为有效负载的位置

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

以下是 PUT 命令的详细转储。如上所示,我对路径使用了以下格式。我确实用 hidden 或 alt 替换了一些变量,仅供参考。

/admin/orders/#{order_id}/fulfillments/#{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

PS 我想指出我使用了以下 API 文档 http://docs.shopify.com/api/fulfillment#create

它建议我使用 PUT /admin/orders/#{id}/fulfillments/#{id}.json

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

4

1 回答 1

0

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

于 2013-09-08T04:30:48.183 回答