无法从我的应用程序中获取 shopify 中的折扣详细信息
Unable to get discount details in shopify from my application
我正在使用节点平台编写一个 shopify 应用程序,我正在尝试使用 npm 模块从我的应用程序中获取 shopify 中的折扣信息 "shopify-node-api",它显示“404- 未找到”错误,但是,我我可以通过这种方法获得产品和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 订阅者,您可以使用经过管理员身份验证的会话访问浏览器中的折扣端点,但不使用 API 凭据。
我正在使用节点平台编写一个 shopify 应用程序,我正在尝试使用 npm 模块从我的应用程序中获取 shopify 中的折扣信息 "shopify-node-api",它显示“404- 未找到”错误,但是,我我可以通过这种方法获得产品和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 订阅者,您可以使用经过管理员身份验证的会话访问浏览器中的折扣端点,但不使用 API 凭据。