Help building an API query for product clicks and views

I’m investigating how to track properly when a product is viewed and/or clicked (in a list page) on an ecommerce website.
I’ve setup product views/clicks event as follows:

  • Event Category: Page Interaction
  • Event Action: Product_View or Product_Click
  • Event Name: <Product_ID>
  • Event Value (number): <Product_Position>

Tracking seems to work as expected, however I’m struggling to create the API query that would return the following table:

Date URL EventName Number of Events Product_Click Number of Events Product_View Event_Value (position)
15/01/2023 /page1/ ID123 23 44 1
15/01/2023 /page1/ ID1555 2 56 3

Can someone help me?

thanks!!!