Shopify API,无法创建订单 [英] Shopify API, unable to create order
本文介绍了Shopify API,无法创建订单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的测试商店中创建了私人应用程序,并尝试按照此处的说明通过 Shopify API 创建简单的订单:
I created private application on my test shop and I am trying to create simple order via the Shopify API following the instructions found here:
http://docs.shopify.com/api/order#create
我正在使用最后一个示例,并在请求正文中将 POST 请求发送到 admin/orders.json:
I am using the last example, and sending POST request to admin/orders.json with this in the body of the request:
{
"order": {
"line_items": [
{
"quantity": 1,
"variant_id": 500775053
}
]
}
}
500775053 是一个有效变体 ID.
500775053 is a valid variant id.
我得到的回应是:
{
"errors": {
"line_items": [
"must have at least one line item"
]
}
}
我不明白我做错了什么?是否有一些特殊的参数我应该传递请求?一些特殊的标题?
I don't understand what am I doing wrong? Is there some special parameter that I should pass along the request? Some special header?
感谢您的帮助!
推荐答案
尝试添加这些自定义标题:
Try adding these custom headers:
Content-Type: application/json
Accept: application/json
这篇关于Shopify API,无法创建订单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文