### 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 } }