php - 错误:titled_product_ids:expected Hash to be a Array(Shopify 嵌入式应用程序)
问题描述
我正在通过 cURL 发送以下请求,一切正常,但“entitled_product_id”出现错误。它在邮递员中工作正常,但在 cURL 中却不行。
提前致谢。
cURL 请求代码是
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $access_token_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($pro_ids11));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Shopify-Access-Token: '.$shops_token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
if (curl_error($ch)) {
$error_msg = curl_error($ch);
}
curl_close($ch);
if (isset($error_msg)) {
echo $error_msg;
}
我的 json_encoded 代码是:
{
"price_rule":
{
"title":"sad",
"target_type":"line_item",
"target_selection":"entitled",
"allocation_method":"across",
"value_type":"percentage",
"value":"-3",
"customer_selection":"all",
"prerequisite_quantity_range":{"greater_than_or_equal_to":"2"},
"entitled_product_ids":["2389482225165"],
"starts_at":"2019-02-20T11:37:57.000Z"
}
}
回复:
{
"errors":
{
"entitled_product_ids":"expected Hash to be a Array"
}
}
解决方案
推荐阅读
- python - 想要使用 Selenium 框架抓取包含不同公司的列表
- python - 如何处理来自两个麦克风的数据?
- java - 带有 gzip 的 http4
- php - 如何向oracle数据库发送值?
- c++ - 将字符串中以十六进制存储的负长值转换为 C++ 中的长变量
- java - 高效的并行素数分解
- python - Python .txt 文件迭代和 readlines()
- sas - 如何限制 SAS 中的月数
- json - Python3:paramiko connect中的替代变量
- asp.net-identity - ASP.NET Core Identity 2.0 从 Cookie 域中删除子域