From 3e5f018b5838f150ea40c652b5dc8f17cc3c1ed4 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 22 May 2025 16:25:30 +0200 Subject: [PATCH] feat(product_analytics): table of cards testing and improvements --- frontend/chart-request.http | 151 ------------------------------------ 1 file changed, 151 deletions(-) delete mode 100644 frontend/chart-request.http diff --git a/frontend/chart-request.http b/frontend/chart-request.http deleted file mode 100644 index 45d80a0a2..000000000 --- a/frontend/chart-request.http +++ /dev/null @@ -1,151 +0,0 @@ -### Login Request -POST https://foss.openreplay.com/api/login -Content-Type: application/json - -{ - "email": "shekar@openreplay.com", - "password": "Asayer#123" -} - -> {% -// Extract token from response -let json = response.body; - -// Check if response.body is a string that needs parsing -if (typeof json === "string") { - try { - json = JSON.parse(json); - } catch (e) { - return "Error parsing response: " + e.message; - } -} - -// Extract JWT token -const token = json.jwt; - -if (token) { - // Try different ways to set the token based on client type - if (typeof client !== "undefined" && client.global) { - client.global.set("API_TOKEN", token); - } else if (typeof pm !== "undefined" && pm.environment) { - pm.environment.set("API_TOKEN", token); - } else if (typeof process !== "undefined") { - process.env.API_TOKEN = token; - } else { - // Last resort - try to access global variables directly - API_TOKEN = token; // Set as global variable - } - - return "JWT token saved as API_TOKEN: " + token.substring(0, 10) + "..."; -} else { - return "No JWT token found in response"; -} -%} - -### Using the token in subsequent requests -GET https://foss.openreplay.com/api/account -Authorization: Bearer {{API_TOKEN}} - -### Chart Request - TIMESERIES (lineChart) -POST http://localhost:8080/v1/analytics/5/cards/try -Content-Type: application/json -Authorization: Bearer {{API_TOKEN}} - -{ - "startTimestamp": 1737216192000, - "endTimestamp": 1739894592000, - "density": 6, - "metricId": 1040, - "metricOf": "userCount", - "metricType": "timeseries", - "viewType": "lineChart", - "name": "CH - Users Trend", - "series": [ - { - "seriesId": 621, - "name": "Series First", - "index": 1, - "filter": { - "filters": [ - { - "type": "userCountry", - "isEvent": false, - "value": [ - "UN" - ], - "operator": "is", - "filters": [] - } - ], - "eventsOrder": "then" - } - }, - { - "seriesId": 621, - "name": "Series Second", - "index": 1, - "filter": { - "filters": [ - { - "type": "userCountry", - "isEvent": false, - "value": [ - "FR" - ], - "operator": "is", - "filters": [] - } - ], - "eventsOrder": "then" - } - } - ], - "page": 1, - "limit": 20, - "compareTo": [ - "PREV_7_DAYS" - ], - "config": { - "col": 2, - "row": 2, - "position": 0 - } -} - -### Chart Request - TABLE -POST http://localhost:8080/v1/analytics/65/cards/try -Content-Type: application/json -Authorization: Bearer {{API_TOKEN}} - -{ - "startTimestamp": 1737216192000, - "endTimestamp": 1744635600000, - "density": 6, - "metricId": 1040, - "metricOf": "referrer", - "metricType": "table", - "metricFormat": "sessionCount", - "viewType": "table", - "name": "CH - Users Trend", - "series": [ - { - "seriesId": 621, - "name": "Series First", - "index": 1, - "filter": { - "filters": [], - "eventsOrder": "then" - } - } - ], - "page": 1, - "limit": 20, - "compareTo": [ - "PREV_7_DAYS" - ], - "config": { - "col": 2, - "row": 2, - "position": 0 - } -}