{ "info": { "_postman_id": "c5b1d1f1-20d5-426f-9e79-ee2edc7c35b5", "name": "SIGN DE V1 - disable all TSS of a (managed-)organization.postman_collection", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "21132140" }, "item": [ { "name": "Authentication - set variables in Pre-request Script Copy", "event": [ { "listen": "test", "script": { "exec": [ "var data = JSON.parse(responseBody);", "pm.environment.set(\"tokenDisableTss\", data.access_token);", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "// Please add here the correct data", "// As a reminder, this Postman collection is intended for disabling all TSSs of an individual (managed-)organization. Running once will disable a maximum of 100 TSSs. If you have more than 100 TSSs you can run the collection many times.", "var apiKey = \"yourApiKey\"", "var apiSecret = \"yourApiSecret\"", "", "", "// This code set the variables in the environement for you", "pm.environment.set(\"api_key\", apiKey);", "pm.environment.set(\"api_secret\", apiSecret);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n\t\"api_key\": \"{{api_key}}\",\n\t\"api_secret\": \"{{api_secret}}\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://kassensichv.io/api/v1/auth", "protocol": "https", "host": [ "kassensichv", "io" ], "path": [ "api", "v1", "auth" ] }, "description": "Authentication" }, "response": [] }, { "name": "List of TSS of state Initialized and Uninitialized", "event": [ { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "exec": [ "var {data} = JSON.parse(responseBody);\r", "\r", "const tssList = data.map(tssId => tssId._id)\r", "\r", "pm.environment.set(\"arrayTssToDisable\", tssList);\r", "\r", "// don't run the next request (i.e: PUT \"Disable all initialized TSS\") if no tss in state Initialized.\r", "if (tssList.length == 0) {\r", " console.log(\"no TSS to DISABLE, STOP here\")\r", " postman.setNextRequest(null);\r", "}\r", "\r", "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});\r", "" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{tokenDisableTss}}", "type": "string" } ] }, "method": "GET", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "https://kassensichv.io/api/v1/tss?states=INITIALIZED&states=UNINITIALIZED&order_by=time_creation&order=asc", "protocol": "https", "host": [ "kassensichv", "io" ], "path": [ "api", "v1", "tss" ], "query": [ { "key": "states", "value": "INITIALIZED" }, { "key": "states", "value": "UNINITIALIZED" }, { "key": "order_by", "value": "time_creation" }, { "key": "order", "value": "asc" } ] } }, "response": [] }, { "name": "Disable all initialized TSS", "event": [ { "listen": "prerequest", "script": { "exec": [ "let arrayTssToDisable = pm.environment.get(\"arrayTssToDisable\");", "let currentTssId = arrayTssToDisable.shift()", "", "", "pm.environment.set('currentTssId', currentTssId);", "pm.environment.set('arrayTssToDisable', arrayTssToDisable);", "", "", "if (arrayTssToDisable.length > 0){", " postman.setNextRequest(\"Disable all initialized TSS\");", " ", "} ", "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "exec": [ "var data = JSON.parse(responseBody);", "", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{tokenDisableTss}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n\t\"state\": \"DISABLED\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://kassensichv.io/api/v1/tss/{{currentTssId}}", "protocol": "https", "host": [ "kassensichv", "io" ], "path": [ "api", "v1", "tss", "{{currentTssId}}" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] }