gpt4 book ai didi

python - 如何从 shopify 获取报告

转载 作者:行者123 更新时间:2023-12-04 17:34:17 25 4
gpt4 key购买 nike

我正在尝试使用 Python 从 Shopify(分析 -> 报告)获取报告,如下所示:

import requests

APIkey = "myAPYkey"
APIversion = "2019-04"
Pass = "myPass"
hostname = "myHost"

response = requests.get("https://{}:{}
{}/admin/api/{}/reports.json".format(APIkey,Pass,hostname,APIversion))

print(response.text)

不管怎样

{"reports":[]}

另一方面,我不知道在哪里可以找到报告的 ID。

这是为什么呢?如果我进入 Analytics -> Reports 部分,我可以看到多个报告。

最佳答案

如果您在 Report Page in REST API Reference 阅读说明, 它指出

You can use the Report resource to publish reports to the Reports page in the Shopify admin. For example, a shirt fulfillment app could publish a report that compares the sales of shirts by marketing campaign. The reports are based on queries written in ShopifyQL.

Reports are scoped to the app that created them. When an app creates a report, other apps can't view, modify, or delete that report. Also, apps can't access reports that were created from the Shopify admin.

第一段说明了如何在基于 ShopifyQL 的 Shopify 后台中创建报告。此 API 提供创建和更新报告等资源。

第二段指出,创建报告的唯一应用程序可以通过 API 访问它们。此外,从 Shopify 后台创建的任何报告也无法通过 API 访问。

因此,对于您的 get All Reports 调用的这个空响应,只是告诉您您还没有通过 API 创建任何报告。完成后,您将在那里看到结果。

如果您想在 Shopify 后台复制报告,请查看 ShopifyQL然后你可以创建类似的东西,也可以通过 API 访问。除此之外,还没有其他方法可以通过 Rest API 获取 Shopify 报告。

关于python - 如何从 shopify 获取报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57277591/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com