From af909849f7bca281ad68dace43e1d1b1705b4846 Mon Sep 17 00:00:00 2001 From: "Drechsler, Meik" Date: Thu, 23 Jul 2026 12:03:54 +0200 Subject: [PATCH] Chain v2 overview relation Postman test --- ...4IT-F4SD-M42WebApi.postman_collection.json | 53 ++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/docs/postman/C4IT-F4SD-M42WebApi.postman_collection.json b/docs/postman/C4IT-F4SD-M42WebApi.postman_collection.json index 93dac19..6fa4268 100644 --- a/docs/postman/C4IT-F4SD-M42WebApi.postman_collection.json +++ b/docs/postman/C4IT-F4SD-M42WebApi.postman_collection.json @@ -1063,6 +1063,37 @@ }, { "name": "get filtered ticket overview counts", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "const overviewCountsJson = pm.response.json();", + "const overviewCounts = overviewCountsJson.counts || overviewCountsJson.Counts || {};", + "const overviewPreferredKeys = (pm.collectionVariables.get(\"overviewKeys\") || \"\")", + " .split(\",\")", + " .map(key => key.trim())", + " .filter(Boolean);", + "const overviewRelationKey = overviewPreferredKeys.find(key => Number(overviewCounts[key] || 0) > 0)", + " || Object.keys(overviewCounts).find(key => Number(overviewCounts[key] || 0) > 0)", + " || \"\";", + "const overviewRelationCount = overviewRelationKey ? Number(overviewCounts[overviewRelationKey] || 0) : 0;", + "", + "if (overviewRelationKey && overviewRelationCount > 0) {", + " pm.collectionVariables.set(\"overviewKey\", overviewRelationKey);", + " pm.collectionVariables.set(\"overviewRelationExpectedCount\", String(overviewRelationCount));", + "}", + "", + "pm.test(\"Captured a populated overview key for the relation request\", function () {", + " pm.expect(overviewCounts).to.be.an(\"object\");", + " pm.expect(overviewRelationKey).to.be.a(\"string\").and.not.empty;", + " pm.expect(overviewRelationCount).to.be.above(0);", + "});" + ] + } + } + ], "request": { "method": "POST", "header": [ @@ -1071,7 +1102,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"UserId\": \"{{userId}}\",\r\n \"Scope\": \"{{scope}}\",\r\n \"Keys\": {{overviewKeysJson}},\r\n \"Filters\": { \"Filters\": [] }\r\n}" + "raw": "{\r\n \"Sid\": \"{{sid}}\",\r\n \"Scope\": \"{{scope}}\",\r\n \"Keys\": {{overviewKeysJson}},\r\n \"Filters\": { \"Filters\": [] }\r\n}" }, "url": { "raw": "{{baseUrl}}/api/c4itf4sdwebapi/v2/getTicketOverviewCounts", @@ -1082,6 +1113,24 @@ }, { "name": "get filtered ticket overview relations", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "const overviewRelations = pm.response.text() ? pm.response.json() : [];", + "const expectedOverviewRelationCount = Number(pm.collectionVariables.get(\"overviewRelationExpectedCount\") || 0);", + "", + "pm.test(\"Overview relations match the captured populated count\", function () {", + " pm.expect(Array.isArray(overviewRelations)).to.equal(true);", + " pm.expect(expectedOverviewRelationCount).to.be.above(0);", + " pm.expect(overviewRelations.length).to.equal(expectedOverviewRelationCount);", + "});" + ] + } + } + ], "request": { "method": "POST", "header": [ @@ -1090,7 +1139,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"UserId\": \"{{userId}}\",\r\n \"Scope\": \"{{scope}}\",\r\n \"Key\": \"{{overviewKey}}\",\r\n \"Count\": {{overviewRelationExpectedCount}},\r\n \"Filters\": { \"Filters\": [] }\r\n}" + "raw": "{\r\n \"Sid\": \"{{sid}}\",\r\n \"Scope\": \"{{scope}}\",\r\n \"Key\": \"{{overviewKey}}\",\r\n \"Count\": {{overviewRelationExpectedCount}},\r\n \"Filters\": { \"Filters\": [] }\r\n}" }, "url": { "raw": "{{baseUrl}}/api/c4itf4sdwebapi/v2/getTicketOverviewRelations",