REST API - Reports Payload?

Solved
Moneypointz
New Member
2 0 0

Hi,

I am new into Shopify API and am confused by the resulting payload from the REST API. 

I am able to connect and create a report using:

POST /admin/api/2020-10/reports.json

However, when I retrieve the report using:  

GET /admin/api/2020-10/reports/517154478.json   

 The payload doesn't actually contain any of the results of the actual report. The payload is only the report 

HTTP/1.1 200 OK
{
  "report": {
    "id": 517154478,
    "name": "Changed Report Name",
    "shopify_ql": "SHOW total_sales BY order_id FROM sales SINCE -12m UNTIL today ORDER BY total_sales",
    "updated_at": "2020-11-04T19:36:55-05:00",
    "category": "custom_app_reports"
  }
}

 

How the heck do I actually query the results of that report? E.g. How do I return the total sales in the payload?

 

0 Likes
Greg_Kujawa
Shopify Partner
925 79 201

This is an accepted solution.

This API endpoint is just for managing reports. As for actually running them (presumably using the Shopify QL), you would need to use the Embedded App SDK. Explained here --> https://shopify.dev/docs/admin-api/rest/reference/analytics/shopify-ql

0 Likes
Moneypointz
New Member
2 0 0

Thanks for the quick feedback.
Looks like I need the Analytics API and not the Admin API.

0 Likes