gpt4 book ai didi

javascript - 无法从我的应用程序中获取 shopify 中的折扣详细信息

转载 作者:行者123 更新时间:2023-11-29 21:08:35 25 4
gpt4 key购买 nike

我正在使用节点平台编写一个 shopify 应用程序,我试图使用 npm 模块“shopify-node-api”从我的应用程序获取 shopify 中的折扣信息,它显示“404- Not Found”错误,但是,我我能够通过此方法获取产品和 custom_collections。

var Shopify = require('shopify-node-api'); 
var config = {};
config.shop = myshop.myshopify.com;
config.shopify_api_key = XXXX;
config.shopify_shared_secret = XXXX;
config.access_token = XXXX;
sails.log.verbose('Shopify config object: ', config);
var shopify = new Shopify(config);
shopify.get('/admin/discounts.json', function(err, data)
if (err) {
sails.log.error("Error in getDiscount ", err);
} else {
sails.log.verbose(" shopify.getDiscount data ", data);
}

我还可以使用 URL https://myshop.myshopify.com/admin/discounts.json 获取折扣详情,输出为

{
discounts: [
{
id: 4128341132,
code: "GET4PRODUCT",
value: "10.00",
ends_at: null,
starts_at: "2017-03-09T00:00:00-08:00",
status: "enabled",
minimum_order_amount: "0.00",
usage_limit: null,
applies_to_id: 9720854796,
applies_once: true,
applies_once_per_customer: true,
discount_type: "fixed_amount",
applies_to_resource: "product",
times_used: 0,
applies_to: {
id: 9720854796,
title: "xxxxxxxxxxxxxx",
body_html: "<meta content="text/html; charset=utf-8" http-equiv="content-type">
<ul class="a-vertical a-spacing-none">
<li><span class="a-list-item">Outer Material: EVA Sheet</span></li>
<li><span class="a-list-item">Sole Material: Anti Slip EVA Sole</span></li>
</ul>",
vendor: "myshop",
product_type: "",
created_at: "2017-02-18T05:24:52-08:00",
handle: "adreno-mens-blue-slippers",
updated_at: "2017-02-18T05:28:20-08:00",
published_at: "2017-02-18T05:23:00-08:00",
template_suffix: null,
published_scope: "global",
tags: ""
}
}
]
}

但是我无法使用我的应用程序获得折扣对象。我是否需要提供任何其他凭据或是否有任何其他方法可以从我的应用程序中获取折扣对象。

请帮助我从应用程序中获取折扣 json。

最佳答案

HymnZ 是正确的,折扣端点只能通过 API 访问 Plus 商店帐户。

如果您不是 Plus 订阅者,则可以使用经过管理员身份验证的 session 访问浏览器中的折扣端点,但不使用 API 凭据。

关于javascript - 无法从我的应用程序中获取 shopify 中的折扣详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42760042/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com