diff --git a/docs/postman/C4IT-F4SD-M42WebApi.postman_collection.json b/docs/postman/C4IT-F4SD-M42WebApi.postman_collection.json index 64a6761..4f030cb 100644 --- a/docs/postman/C4IT-F4SD-M42WebApi.postman_collection.json +++ b/docs/postman/C4IT-F4SD-M42WebApi.postman_collection.json @@ -71,10 +71,18 @@ "key": "ticketObjectId", "value": "00000000-0000-0000-0000-000000000000" }, + { + "key": "eoid", + "value": "00000000-0000-0000-0000-000000000000" + }, { "key": "objectType", "value": "SPSActivityTypeIncident" }, + { + "key": "type", + "value": "SPSActivityTypeIncident" + }, { "key": "assetName", "value": "" @@ -310,7 +318,24 @@ " if (!text) return;", " const json = pm.response.json();", " pm.expect(json === null || Array.isArray(json)).to.equal(true);", - "});" + "});", + "", + "const tickets = pm.response.text() ? pm.response.json() : null;", + "if (Array.isArray(tickets) && tickets.length > 0) {", + " const ticket = tickets[0];", + " if (ticket.TicketObjectId) {", + " pm.collectionVariables.set(\"ticketObjectId\", ticket.TicketObjectId);", + " pm.collectionVariables.set(\"eoid\", ticket.TicketObjectId);", + " }", + " if (ticket.ActivityType) {", + " pm.collectionVariables.set(\"objectType\", ticket.ActivityType);", + " pm.collectionVariables.set(\"type\", ticket.ActivityType);", + " }", + " pm.test(\"Captured ticket object id and type\", function () {", + " pm.expect(pm.collectionVariables.get(\"eoid\")).to.match(/^[0-9a-fA-F-]{36}$/);", + " pm.expect(pm.collectionVariables.get(\"type\")).to.be.a(\"string\").and.not.empty;", + " });", + "}" ] } } @@ -365,7 +390,7 @@ } ], "url": { - "raw": "{{baseUrl}}/api/c4itf4sdwebapi/getTicketDetails?objectId={{ticketObjectId}}", + "raw": "{{baseUrl}}/api/c4itf4sdwebapi/getTicketDetails?objectId={{eoid}}", "host": [ "{{baseUrl}}" ], @@ -377,7 +402,7 @@ "query": [ { "key": "objectId", - "value": "{{ticketObjectId}}" + "value": "{{eoid}}" } ] } @@ -394,7 +419,7 @@ } ], "url": { - "raw": "{{baseUrl}}/api/c4itf4sdwebapi/getTicketHistory?objectId={{ticketObjectId}}", + "raw": "{{baseUrl}}/api/c4itf4sdwebapi/getTicketHistory?objectId={{eoid}}", "host": [ "{{baseUrl}}" ], @@ -406,7 +431,7 @@ "query": [ { "key": "objectId", - "value": "{{ticketObjectId}}" + "value": "{{eoid}}" } ] } @@ -456,7 +481,7 @@ } ], "url": { - "raw": "{{baseUrl}}/api/c4itf4sdwebapi/getDirectLinkF4SD?EOID={{ticketObjectId}}&Type={{objectType}}", + "raw": "{{baseUrl}}/api/c4itf4sdwebapi/getDirectLinkF4SD?EOID={{eoid}}&Type={{type}}", "host": [ "{{baseUrl}}" ], @@ -468,11 +493,11 @@ "query": [ { "key": "EOID", - "value": "{{ticketObjectId}}" + "value": "{{eoid}}" }, { "key": "Type", - "value": "{{objectType}}" + "value": "{{type}}" } ] }