我正在尝试访问或创建 Shopify 店面访问令牌。为此,我遵循 Shopify 文档[LINK]并遵循了文档中定义的流程,但我收到了错误响应。
{
"errors": "App must have a channel record to create a storefront access token."
}
Run Code Online (Sandbox Code Playgroud)
在认证的时候,我也定义了未经认证的范围。(unauthenticated_read_content、unauthenticated_write_customers、unauthenticated_write_checkouts、unauthenticated_read_product_listings)但仍然收到此错误。
索取资料:
var request = require("request");
var options = { method: 'POST',
url: 'https://teststore-myteststore.myshopify.com/admin/storefront_access_tokens.json',
headers:
{ 'Postman-Token': 'cc407456-0d7c-42e5-8517-405c3ec6acaf',
'Content-Type': 'application/json',
'X-Shopify-Access-Token': '5c00cd60a76e6dce56e6112dfagfhxvlp' },
body: { storefront_access_token: { title: 'Test2' } },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
Run Code Online (Sandbox Code Playgroud) 我正在使用shopify-buy SDK尝试从我的Shopify商店中获取文章,只需使用前端的JavaScript,按照"扩展SDK"的说明进行操作:https://shopify.github.io/js-buy -sdk/#extended-the-sdk.
使用下面的代码,我能够检索我的文章和我需要的一些字段.
// Build a custom query using the unoptimized version of the SDK
const articlesQuery = client.graphQLClient.query((root) => {
root.addConnection('articles', {args: {first: 10}}, (article) => {
article.add('title')
article.add('handle')
article.add('url')
article.add('contentHtml')
})
})
// Call the send method with the custom query
client.graphQLClient.send(articlesQuery).then(({model, data}) => {
console.log('articles data')
console.log(data)
})
Run Code Online (Sandbox Code Playgroud)
但是,我真的需要为每篇文章提取特色图像,不幸的是,当我article.add('image')在articlesQuery中添加该行时,生成的文章数据日志null.我尝试构建自定义productsQuery,这有一个类似的问题 - 我可以检索一些产品字段,但是当我尝试添加该行时product.add('images'),我只是null从店面API返回.
有没有人有建立自定义/扩展查询和成功检索图像的经验?