{ "info": { "_postman_id": "c7da8d07-9e73-4049-82bd-99fcca399016", "name": "Delivery API CI/CD v1.0", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "Configure collection", "item": [ { "name": "Refresh Token", "event": [ { "listen": "test", "script": { "id": "0f218008-1e8a-472f-bbe2-b44914986a0a", "exec": [ "// this snippet extracts the new access and id tokens", "// and puts them to environment variables", "cp = pm.environment.get(\"cloud_platform\");", "", "var data = JSON.parse(responseBody)", "pm.environment.set(\"access_token\", data.access_token);", "if (cp == \"AWS\") {", " pm.environment.set(\"id_token\", data.id_token);", "}", "// Uncomment if server returns a new refresh_token,", "// otherwise comment out to prevent overwriting it with null", "if (cp == \"Azure\") {", " pm.environment.set(\"refresh_token\", data.refresh_token);", "}" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "3f93889e-ba6f-48de-908a-7b522412172e", "exec": [ "cp = pm.environment.get(\"cloud_platform\");\r", "\r", "if (cp == \"GCP\") {\r", " pm.environment.set(\"Scope\", \"email openid profile\")\r", "}\r", "else {\r", " client_id = pm.environment.get(\"CLIENT_ID\");\r", " pm.environment.set(\"Scope\", client_id + \"/.default openid profile offline_access\")\r", "}\r", "\r", "function setPermission(groupName) {\r", " console.log(groupName);\r", "\r", "};\r", "\r", "pm.globals.set('setPermission', () => {\r", " console.log(groupName);\r", "});\r", "\r", "//refreshTokenAdmin(pm)\r", "\r", "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/x-www-form-urlencoded" }, { "key": "Ocp-Apim-Subscription-Key", "type": "text", "value": "xxxxxxxx", "disabled": true } ], "body": { "mode": "urlencoded", "urlencoded": [ { "key": "grant_type", "value": "refresh_token", "type": "text" }, { "key": "client_id", "value": "{{CLIENT_ID}}", "description": "Supply your client id as an environment variable", "type": "text" }, { "key": "client_secret", "value": "{{CLIENT_SECRET}}", "description": "Supply your client secret as an environment variable", "type": "text" }, { "key": "refresh_token", "value": "{{refresh_token}}", "type": "text" }, { "key": "scope", "value": "{{Scope}}", "type": "text" } ], "options": { "urlencoded": {} } }, "url": { "raw": "{{Token_Fetch_URL}}", "host": [ "{{Token_Fetch_URL}}" ] } }, "response": [] }, { "name": "Admin Refresh Token Copy", "event": [ { "listen": "test", "script": { "id": "a83dfd59-1e44-4778-b91a-1b2be74f4a19", "exec": [ "// this snippet extracts the new access and id tokens", "// and puts them to environment variables", "cp = pm.environment.get(\"cloud_platform\");", "", "var data = JSON.parse(responseBody)", "pm.environment.set(\"ADMIN_ACCESS_TOKEN\", data.access_token);", "if (cp == \"AWS\") {", " pm.environment.set(\"id_token\", data.id_token);", "}", "// Uncomment if server returns a new refresh_token,", "// otherwise comment out to prevent overwriting it with null", "if (cp == \"Azure\") {", " pm.environment.set(\"refresh_token\", data.refresh_token);", "}" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "aae28438-2bea-4755-a6ab-02447a377502", "exec": [ "cp = pm.environment.get(\"cloud_platform\");\r", "\r", "if (cp == \"GCP\") {\r", " pm.environment.set(\"Scope\", \"email openid profile\")\r", " }\r", "else {\r", " client_id = pm.environment.get(\"CLIENT_ID\");\r", " pm.environment.set(\"Scope\", client_id + \"/.default openid profile offline_access\")\r", "}" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/x-www-form-urlencoded" }, { "key": "Ocp-Apim-Subscription-Key", "type": "text", "value": "xxxxxxxx", "disabled": true } ], "body": { "mode": "urlencoded", "urlencoded": [ { "key": "grant_type", "value": "refresh_token", "type": "text" }, { "key": "client_id", "value": "{{ADMIN_CLIENT_ID}}", "description": "Supply your client id as an environment variable", "type": "text" }, { "key": "client_secret", "value": "{{ADMIN_CLIENT_SECRET}}", "description": "Supply your client secret as an environment variable", "type": "text" }, { "key": "refresh_token", "value": "{{ADMIN_REFRESH_TOKEN}}", "type": "text" }, { "key": "scope", "value": "{{Scope}}", "type": "text" } ] }, "url": { "raw": "{{Token_Fetch_URL}}", "host": [ "{{Token_Fetch_URL}}" ] } }, "response": [] } ], "protocolProfileBehavior": {} }, { "name": "Delivery", "item": [ { "name": "C02. Fulltext Search #2 (Wildcard) Copy", "event": [ { "listen": "test", "script": { "id": "d7c82301-c065-4d2a-b03f-699801a7abea", "exec": [ "pm.test(\"Status code is 200\", function () {\r", " pm.response.to.have.status(200);\r", "});\r", "pm.test(\"Status description - OK\", function () {\r", " pm.response.to.have.status(\"OK\");\r", "});\r", "\r", "//get the record count\r", "try {\r", " let resBody = pm.response.json();\r", "\r", " let recordCount = resBody.totalCount;\r", " tests[\"Record count: \" + recordCount] = recordCount >= 1;\r", " }\r", "catch (e) {\r", " console.log(e.message);\r", "}" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [ { "key": "Authorization", "type": "text", "value": "Bearer {{access_token}}" }, { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" }, { "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" } ], "body": { "mode": "raw", "raw": "{\n \"kind\": \"osdu:osdu:welllog-wpc:0.2.0\"\n}\n", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{SEARCH_HOST}}/query", "protocol": "https", "host": [ "{{SEARCH_HOST}}" ], "path": [ "query" ] } }, "response": [] }, { "name": "01 Delivery - Retrieve the file for the well Log wpc record", "event": [ { "listen": "test", "script": { "id": "ae0e03d2-82b5-41e2-9d0f-d96f3144d68d", "exec": [ "// Ensure the API was able to send a successful response", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "", "// Ensure a signed URL is returned for the file in question. ", "pm.test(\"Signed URL returned? :\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.processed).to.be.ok;", " pm.expect(jsonData.unprocessed.length).to.equal(0);", "});", "", "", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "2aae928f-3874-4c83-b71c-bc35babfed1e", "exec": [ "console.log(globalThis.token)" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" }, { "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" }, { "key": "accept", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\r\n\t\"srns\" : [ \"srn:file/las2:7011944882696956554:\" ] \r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{DELIVERY_HOST}}", "protocol": "https", "host": [ "{{DELIVERY_HOST}}" ] }, "description": "Retrieve the latest version of one record based on id (SRN), and only return the columns specified in the attributes section of the request" }, "response": [] }, { "name": "02 Delivery - Retrieve the file for the wellboreMarker wpc record", "event": [ { "listen": "test", "script": { "id": "543293b5-bd29-4bc7-b45d-ba7c1e3b46ec", "exec": [ "// Ensure the API was able to send a successful response", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "", "// Ensure a signed URL is returned for the file in question. ", "pm.test(\"Signed URL returned? :\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.processed).to.be.ok;", " pm.expect(jsonData.unprocessed.length).to.equal(0);", "});", "", "", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" }, { "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" }, { "key": "accept", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\r\n\t\"srns\" : [ \"srn:file/csv:33554447243488057924904:\" ] \r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{DELIVERY_HOST}}", "protocol": "https", "host": [ "{{DELIVERY_HOST}}" ] }, "description": "Retrieve the latest version of one record based on id (SRN), and only return the columns specified in the attributes section of the request" }, "response": [] }, { "name": "03 Delivery - Retrieve the file for the wellboreTrajectory wpc record", "event": [ { "listen": "test", "script": { "id": "94eed070-4080-48f4-90b6-077c9ec45ca6", "exec": [ "// Ensure the API was able to send a successful response", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "", "// Ensure a signed URL is returned for the file in question. ", "pm.test(\"Signed URL returned? :\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.processed).to.be.ok;", " pm.expect(jsonData.unprocessed.length).to.equal(0);", "});", "", "", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" }, { "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" }, { "key": "accept", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\r\n\t\"srns\" : [ \"srn:file/csv:898844761925351613:\" ] \r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{DELIVERY_HOST}}", "protocol": "https", "host": [ "{{DELIVERY_HOST}}" ] }, "description": "Retrieve the latest version of one record based on id (SRN), and only return the columns specified in the attributes section of the request" }, "response": [] }, { "name": "04 Delivery - Retrieve the file for the well Log wpc record without correct permission to access the API", "event": [ { "listen": "test", "script": { "id": "b311ce6e-073b-4d3b-9e85-7593f1d97483", "exec": [ "// Ensure the API was able to send a successful response", "pm.test(\"Status code is 401\", function () {", " pm.response.to.have.status(401);", "});", "", "", "", "", "", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" }, { "key": "data-partition-id", "type": "text", "value": "{{data-partition-id}}" }, { "key": "accept", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\r\n\t\"srns\" : [ \"srn:file/las2:944870757489505930982033:\" ] \r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{DELIVERY_HOST}}", "protocol": "https", "host": [ "{{DELIVERY_HOST}}" ] }, "description": "Retrieve the latest version of one record based on id (SRN), and only return the columns specified in the attributes section of the request" }, "response": [] }, { "name": "05 Delivery - Retrieve the file for the well Log wpc record when user is forbidden to access the data", "event": [ { "listen": "test", "script": { "id": "9135aacd-9594-4c00-85a1-5ae868555903", "exec": [ "// Ensure the API was able to send a successful response", "pm.test(\"Status code is 403\", function () {", " pm.response.to.have.status(403);", "});", "", "", "", "", "", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "98e64b05-9b39-488f-ae1c-ed00d4b98722", "exec": [ "addRole(pm,\"service.delivery.admin\")\r", "//pm.globals.get(\"variable_key\"); " ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" }, { "key": "data-partition-id", "type": "text", "value": "common" }, { "key": "accept", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\r\n\t\"srns\" : [ \"srn:file/las2:944870757489505930982033:\" ] \r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{DELIVERY_HOST}}", "protocol": "https", "host": [ "{{DELIVERY_HOST}}" ] }, "description": "Retrieve the latest version of one record based on id (SRN), and only return the columns specified in the attributes section of the request" }, "response": [] } ], "protocolProfileBehavior": {} } ], "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{access_token}}", "type": "string" } ] }, "event": [ { "listen": "prerequest", "script": { "id": "7cfaa0b1-ef38-4358-aee6-faa98618eeb0", "type": "text/javascript", "exec": [ "globalThis.refreshTokenAdmin = async function (pm) {", " const refreshToken = {", " url: pm.environment.get(\"Token_Fetch_URL\"),", " method: 'POST',", " body: {", " mode: \"urlencoded\",", " urlencoded: [", " {key: \"grant_type\", value: \"refresh_token\", disabled: false},", " {key: \"client_id\", value: pm.environment.get(\"ADMIN_CLIENT_ID\"), disabled: false},", " {key: \"client_secret\", value: pm.environment.get(\"ADMIN_CLIENT_SECRET\"), disabled: false},", " {key: \"refresh_token\", value: pm.environment.get(\"ADMIN_REFRESH_TOKEN\"), disabled: false},", " {key: \"scope\", value: pm.environment.get(\"Scope\"), disabled: false}", " ] ", " }", " }", " responseData = await sendRequest(pm, refreshToken);", " pm.environment.set(\"ADMIN_ACCESS_TOKEN\", responseData.json().access_token)", " console.log(pm.environment.get(\"ADMIN_ACCESS_TOKEN\"))", " globalThis.token = responseData.json().access_token", "}", "", "globalThis.entitlements = pm.environment.get(\"ENTITLEMENTS_HOST\")", "globalThis.testUser = \"community_reader@osdu-gcp.go3-nrg.projects.epam.com\"", "", "globalThis.addRole = function (pm, role) { ", " groupEmail = \"service.delivery.admin@osdu.osdu-gcp.go3-nrg.projects.epam.com\"", " const addRoleRequest = {", " url: \"https://\" + globalThis.entitlements + \"/groups/\"+ groupEmail +\"/members\",", " method: 'POST',", " header: {", " \"Authorization\": \"Bearer \" + pm.environment.get(\"ADMIN_ACCESS_TOKEN\"),", " \"data-partition-id\": \"osdu\"", " },", " body: {", " mode: 'raw',", " raw: JSON.stringify({", " \"email\" : globalThis.testUser,", " \"role\" : \"MEMBER\"", " })", " }", " }", " sendRequest(pm, addRoleRequest);", "}", "", "globalThis.removeRole = function (pm, role) {", " groupEmail = role + \"@gmail.com\"", " const removeRoleRequest = {", " url: \"https://\" + globalThis.entitlements + \"groups/\"+ groupEmail +\"/members/\" + globalThis.testUser,", " method: 'DELETE',", " body: {}", " }", " sendRequest(pm, removeRoleRequest);", "}", "", "function sendRequest(pm, request) {", " responseData = new Promise(function (resolve, reject) {", " setTimeout(", " pm.sendRequest(request, function(err, res) {", " if (err) {", " reject(err)", " } else {", " resolve(res)", " }", " }), 2000)", " } ", " ) ", " responseData", " .then((data) => {", " return data", " })", " .catch((error) => {", " console.error(\"sendRequest error: \", error)", " return", " });", " return responseData", "};", "" ] } }, { "listen": "test", "script": { "id": "f8652920-aec4-44a4-891c-2468c5ecd976", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {} }