dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
857 stars 467 forks source link

Allow to pass a json as a string for cube js query #30148

Open jdotcms opened 2 weeks ago

jdotcms commented 2 weeks ago

Parent Issue

No response

User Story

As a developer, I wan to be able to pass a string as a query for doing cube js queries. Currently, there is a bean in the middle but it is not jackson friendlys, so I need to pass the cube js query straight to the client

Acceptance Criteria

We can send a cube js query using the endpoint

Proposed Objective

Core Features

Proposed Priority

Priority 3 - Average

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

jdotcms commented 1 week ago

In order to test it you can run a curl such as

curl --location 'http://localhost:8080/api/v1/analytics/content/_query/cube' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--header 'Cookie: JSESSIONID=3BF8D482C623963FF6418FFE90684DEC' \
--data '{
  "order": {
    "request.createdAt": "asc"
  },
  "dimensions": [
    "request.requestId"
  ],
  "measures": [
    "request.count"
  ],
  "timeDimensions": [
    {
      "dimension": "request.createdAt",
      "granularity": "day"
    }
  ]
}'

As you can see the body is the actual cube js raw query The results are the same of the just "_query"

jcastro-dotcms commented 1 week ago

INTERNAL QA: PASSED

I created a Postman request with the information provided by @jdotcms , and the REST Endpoint is returning the expected data.

josemejias11 commented 1 week ago

Approved: Tested on trunk_a12617a, Docker, macOS 14.5, FF v126.0.1 Screenshot 2024-10-04 at 1 11 48 PM