【发布时间】:2022-12-23 10:58:26
【问题描述】:
我正在尝试在我的 shopify 应用程序上对产品进行分页。我遵循了本教程:https://shopify.dev/api/usage/pagination-rest#make-a-paginated-request-and-iterate-through-the-pages。问题是当我请求 Shopify API 时,我没有在响应标头中获得链接。
这是我的代码:
let url = `https://${req.user.shop}/admin/api/2022-04/products.json?limit=${limit}`;
let options = {
method: 'GET',
mode: 'no-cors',
uri: url,
json: true,
headers: {
'X-Shopify-Access-Token': req.accessToken,
'content-type': 'application/json',
}
};
request(options)
.then(function (parsedBody){
console.log(res._headers);
console.log(parsedBody.products);
res.status(200).json(parsedBody.products);
}).catch(function (err) {
console.log(err);
res.json(err);
})
谢谢你的时间!
【问题讨论】:
标签: node.js pagination shopify-app shopify-api shopify-api-node