A question about the report.json interface

zhangqingxiu
New Member
7 0 0

Hello, everyone. I’m connecting to shopify for the first time. I have a problem and I want to consult you:
I always return

The request could not be understood by the server due to malformed syntax

when I call the report creation interface (report.json)

The language I use is C#,
The link for reference is https://shopify.dev/docs/admin-api/rest/reference/analytics/report
The request content is
{
"report": {
"name": "test",
"shopify_ql": "SHOW total_sales BY order_id FROM sales SINCE -1m UNTIL today ORDER BY total_sales"
}
}
May I ask what is wrong? Looking forward to your reply

0 Likes
_JCC_
Shopify Staff
Shopify Staff
142 20 26

Hey @zhangqingxiu ,

I don't see anything wrong with the JSON request payload you provided. Would you be able to provide the x-request-id from the response headers of the failing request.

Regards,

John

John C | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
zhangqingxiu
New Member
7 0 0

Thanks for your reply, this is  x-request-id:202104280823789,Please help me find out the reason,thanks

zhangqingxiu_1-1619569622094.png

zhangqingxiu_2-1619569626999.png

zhangqingxiu_3-1619569745117.png

 

 

0 Likes
_JCC_
Shopify Staff
Shopify Staff
142 20 26

Hey @zhangqingxiu ,

Thanks for providing the screenshots. When creating a report it should be a POST not a GET request. We don't allow GET requests with content in the body of the request and we'll always return a 400. Given the GET request works, if you simply change the request type dropdown to POST (to the left of the api url) when you want to create a new report I believe that should resolve the issue.

Regards,

John

John C | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
zhangqingxiu
New Member
7 0 0

x-request-id:10a06057-8814-4aa5-97b2-4b56b14c8b9d This is x-request-id, can you check the reason for me?I also tried the post method, but it didn’t work,One more question:

I call the report acquisition interface, and there is no data returned. Do I have to call the create report interface first? Is there no default report return?

My purpose is to get the data on this panel

zhangqingxiu_0-1619682590552.png

 

0 Likes
zhangqingxiu
New Member
7 0 0

Can I use my email to communicate with you? Communication through the forum is a bit slow, I am very anxious, this is my email, please contact me if it is convenient, thank you! !
1003420092@qq.com

0 Likes
_JCC_
Shopify Staff
Shopify Staff
142 20 26

Hey @zhangqingxiu ,

Thanks for the request-id. From the logs, I'm seeing the shop in question is on the basic plan. For report creation to work you need to be on the Shopify Advanced Plan or Shopify Plus. This info can be found here. I also wanted to be clear that the reports endpoint doesn't allow you to run reports, only create them.

Regards,

John

John C | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
zhangqingxiu
New Member
7 0 0

Ok, I confirm the store plan. At present, it seems that this interface does not meet my needs. Is there any way to obtain information such as the number of views of the store and the conversion rate of the product through the api?

0 Likes