标签: shopify-javascript-buy-sdk

如何访问或创建 Shopify Storefront 令牌 [403 Forbidden]?

我正在尝试访问或创建 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 shopify-javascript-buy-sdk

5
推荐指数
0
解决办法
865
查看次数

使用Shopify JavaScript Buy SDK自定义查询检索包含其图像的文章对象

我正在使用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返回.

有没有人有建立自定义/扩展查询和成功检索图像的经验?

javascript shopify shopify-javascript-buy-sdk

5
推荐指数
1
解决办法
123
查看次数

如何使用API​​获取shopify店面导航菜单?

如果有人可以帮助我如何使用 REST 和 Graphql API 检索导航菜单。

如果没有可用的 API,那么如何编写自定义导航 API?

我们需要通过API获取以下数据。看截图

shopify shopify-javascript-buy-sdk

1
推荐指数
1
解决办法
3707
查看次数