通过Shopify API创建履行

时间:2013-10-07 21:22:57

标签: api curl shopify

我无法通过API创建履行。我目前正在使用curl进行测试,但收到“缺少必需参数”错误。

有人能够发现错误吗?

curl命令:

curl -i -v -H "Accept: application/json" -X POST -d "{'fulfillment': {'tracking_number': null,'line_items': [{'id': 322959149}]}}" https://[apikey]:[password]@[shop-name].myshopify.com/admin/orders/186122043/fulfillments.json

卷曲输出:

* About to connect() to [shop-name].myshopify.com port 443 (#0)
*   Trying 204.93.213.94...
* connected
* Connected to [shop-name].myshopify.com (204.93.213.94) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
*    subject: serialNumber=inVwoUGzj3duFEUBdzDQrbS2kO1qx0Vr; 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: [shop-name].myshopify.com matched
*    issuer: C=US; O=Equifax; OU=Equifax Secure Certificate Authority
*    SSL certificate verify ok.
* Server auth using Basic with user '4a93b24da162b9ce3f6426206b63e692'
> POST /admin/orders/186122043/fulfillments.json HTTP/1.1
> Authorization: Basic NGE5M2IyNGRhMTYyYjljZTNmNjQyNjIwNmI2M2U2OTI6ZDljMWYwMDNlZWZiMDE1MmQ1MzExMGNjMzk1N2MzMDI=
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
> Host: [shop-name].myshopify.com
> Accept: application/json
> Content-Length: 76
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 76 out of 76 bytes
< HTTP/1.1 400 Bad Request
HTTP/1.1 400 Bad Request
< Server: nginx
Server: nginx
< Date: Mon, 07 Oct 2013 21:10:02 GMT
Date: Mon, 07 Oct 2013 21:10:02 GMT
< Content-Type: application/json; charset=utf-8
Content-Type: application/json; charset=utf-8
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Status: 400 Bad Request
Status: 400 Bad Request
< X-ShopId: 2235177
X-ShopId: 2235177
< X-Shopify-Asset-Version: 529b6843243276ab3e385c6b38a3bd7b17b4b92f
X-Shopify-Asset-Version: 529b6843243276ab3e385c6b38a3bd7b17b4b92f
< X-Shopify-Shop-Api-Call-Limit: 2/500
X-Shopify-Shop-Api-Call-Limit: 2/500
< HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 2/500
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 2/500
< X-Frame-Options: DENY
X-Frame-Options: DENY
< X-UA-Compatible: IE=Edge,chrome=1
X-UA-Compatible: IE=Edge,chrome=1
< Set-Cookie: _secure_session_id=989c50f70ca8fd46d381770aa5ad3e72; path=/; secure; HttpOnly
Set-Cookie: _secure_session_id=989c50f70ca8fd46d381770aa5ad3e72; path=/; secure; HttpOnly
< X-Request-Id: 3c394e98aebf3ae3ba4c3f75b8f069be
X-Request-Id: 3c394e98aebf3ae3ba4c3f75b8f069be

<
* Connection #0 to host [shop-name].myshopify.com left intact
{"errors":{"fulfillment":"Required parameter missing"}}
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):

1 个答案:

答案 0 :(得分:2)

你的'应该'

curl -i -v -H“接受:application / json”-X POST -d'{“fulfillment”:{“tracking_number”:null,“line_items”:[{“id”:322959149}]}} 'https://[apikey]:[password]@[shop-name].myshopify.com/admin/orders/186122043/fulfillments.json

以下link可以为您提供帮助。