api - 通过 Shopify API 创建履行

标签 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]:[密码]@[商店名称].myshopify.com/admin/orders/186122043/fulfillments.json

curl 输出:

* 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):

最佳答案

你的'应该“

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

正在关注 link应该对你有帮助。

关于api - 通过 Shopify API 创建履行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19235035/

相关文章:

java - 从非域地址发送电子邮件

api - REST API - 在单个请求中批量创建或更新

c# - 网络核心 API : Assigning Array name and showing in Angular

json - Shopify 集成 : trouble on making authenticated requests

shopify - Shopify代码中的百分比计算错误

javascript - 如何跟踪外部 JSON 文件的更改

c++ - 即使使用正确的凭据,通过 cURL 使用 NTLM 进行代理身份验证也会返回 407

javascript - 如何伪造 Google 搜索位置?

c++ - QT 上传(PUT)文件

jquery - 以 div 的百分比设置高度