没有不值得去解决的问题,也没有不值得去学习的技术!

Request Shopify in Altair GraphQL ClientS Store GraphQL API

重载文档响应成功

1. Reference:https://www.shuijingwanwq.com/2022/03/15/6129/. In the Shopify’s GraphQL Admin API, there are some APIs for online stores that don’t exist.

2. The online store in the background of Shopify, request the URL:https://xxx.myshopify.com/admin/online-store/admin/api/unversioned/graphql?operation=ThemeIndexSecondaryData. Request method: POST . Response topic list. as shown in Figure 1

Shopify 后台的在线商店,请求网址: https://xxx.myshopify.com/admin/online-store/admin/api/unversioned/graphql?operation=ThemeIndexSecondaryData 。请求方法: POST 。响应主题列表。
Figure 1

3. At the URL:https://shopify.dev/apiNo online store related GraphQL API was found. as shown in Figure 2

在网址:https://shopify.dev/api 中未找到在线商店相关的 GraphQL API。
Figure 2

4. In /admin/api/2022-01/graphql.json Search in the document: TheMeIndexSecondaryData, not found (Note: This is just an alias of the query, it should be searched based on the request parameter in the load). as shown in Figure 3

在 /admin/api/2022-01/graphql.json 的文档中搜索:ThemeIndexSecondaryData,未找到。
Figure 3

5. In Altair GraphQL Client, set the request URL:https://xxx.myshopify.com/admin/online-store/admin/api/unversioned/graphql?operation=ThemeIndexSecondaryData

6. In the online store of Shopify in the background, copy the value of query in the request load, right-click – copy the value. Then copy the value of the variables in the request load. as shown in Figure 4

Shopify 后台的在线商店,复制请求载荷中 query 的值,右键 - 复制值。然后再复制 请求载荷中 variables 的值。
Figure 4

7. Paste them into the query and variables of the Altair GraphQL Client respectively. as shown in Figure 5

分别粘贴至 Altair GraphQL Client 的查询与变量中
Figure 5

8. Set the headers, content-type: application/json, authorization:bearer xxxx, and the value of xxxx is copied from the authorization in the request header. as shown in Figure 6

设置 Headers,Content-Type:application/json,Authorization:Bearer xxxx,xxxx 的值复制自请求标头中的 authorization。
Figure 6

9. Response to unauthorized, carefully compare the differences in the request header, and find that there are more cookies in the Altair GraphQL client, and decide to remove them. as shown in Figure 7

响应 Unauthorized,仔细对比请求头中的差异,发现 Altair GraphQL Client 中多出 cookie,决定去除掉。
Figure 7

10. Test the call in Postman, still responding to unauthorized. as shown in Figure 8

在 Postman 中试验调用,仍然响应 Unauthorized
8

11. The analysis found that because the value of authorization is generated first by request. Copy headers, x-csrf-token: oo73nzxt-gnexb7lpmaznm70wjwb9fkrlmvu. as shown in Figure 9

分析发现由于 authorization 的值,是先请求生成的。复制 Headers,x-csrf-token: oO73nzXt-GNexB7LPmAZnm70wjWB9fKRLMvU
Figure 9

12. Decide to request the URL in the Altair GraphQL Client:https://fuyan666.myshopify.com/admin/internal/web/graphql/core?operation=GenerateSessionToken&type=mutation. Request method: POST . Setting the headers, x-csrf-token: oo73nzxt-gnexb7lpmaznm70wjwb9fkrlmvu. Otherwise respond to CSRF. As shown in Figure 10

决定在 Altair GraphQL Client 中 请求网址: https://fuyan666.myshopify.com/admin/internal/web/graphql/core?operation=GenerateSessionToken&type=mutation 。请求方法: POST 。设置 Headers,x-csrf-token: oO73nzXt-GNexB7LPmAZnm70wjWB9fKRLMvU。否则响应 CSRF
Figure 10

13. Copy the session of the response and paste it to the request URL:https://xxx.myshopify.com/admin/online-store/admin/api/unversioned/graphql?operation=ThemeIndexSecondaryDatathe authorization of the headers. The request response was successful. as shown in Figure 11

复制响应的 session ,粘贴至 请求网址:https://xxx.myshopify.com/admin/online-store/admin/api/unversioned/graphql?operation=ThemeIndexSecondaryData 的 Headers 的 Authorization 中。请求响应成功
Figure 11

14. The overloaded document response is successful. as shown in Figure 12

重载文档响应成功
Figure 12

需要长期技术维护或远程问题排查?

我是拥有 15+ 年经验的 PHP / Go 后端工程师,长期关注已有系统维护、Bug 修复、性能优化、服务器排查、WordPress 网站维护和小功能迭代。

如果你的项目遇到以下情况,可以先从一次小问题排查开始合作:

  • ✅ PHP / Laravel / Yii2 老项目无人维护
  • ✅ Go / Gin 后端接口需要排查或优化
  • ✅ WordPress 网站访问慢、报错或插件冲突
  • ✅ Nginx / MySQL / Redis / Linux 服务器异常
  • ✅ CDN / Cloudflare / DNS / HTTPS 配置问题
  • ✅ 需要长期远程技术支持或兼职维护

更多介绍请查看:关于我 & 合作

微信:13980074657
邮箱:shuijingwanwq@gmail.com
Telegram:@shuijingwan
GitHub:https://github.com/shuijingwan

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理