如何从shoppify获取报告

2024-10-02 18:22:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用Python从Shopify(Analytics->reports)获取报告,如下所示:

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)

不管我得到什么

^{pr2}$

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

为什么?如果我进入“分析->报告”部分,我可以看到多个报告。在


Tags: importgetresponse报告passrequestshostnameanalytics
1条回答
网友
1楼 · 发布于 2024-10-02 18:22:09

如果您阅读了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.

第一段说明了如何在基于shoppify管理的shoppifyql中创建报表。这个API提供了创建和更新报表等资源。在

第二段指出,创建报表的唯一应用程序可以通过API访问它们。此外,从shoppify管理创建的任何报告也不能通过API访问。在

因此,对于getallreports调用的这个空响应,只是告诉您没有通过API创建任何报表。一旦你这样做,你就会看到结果。在

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

相关问题 更多 >