{ "info": { "_postman_id": "16b3208e-e7e6-4c39-82d3-22947673adb0", "name": "Import Tag Property", "description": "All calculated variables needed for this collection are stored as Collection Variables. These variables should not be manually changed since all IDs are set based on the responses from previous requests.", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "17913394" }, "item": [ { "name": "Create Tag Property", "item": [ { "name": "Get Company", "event": [ { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "pm.variables.set(\"companyID\", resp.data[0].id);", "", "pm.test(\"Company ID:\" + resp.data[0].id, function () {", " pm.response.to.have.status(200);", " pm.expect(resp.data[0].id).to.be.not.empty;", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/companies", "host": [ "{{HOST}}" ], "path": [ "companies" ] } }, "response": [] }, { "name": "Create Property", "event": [ { "listen": "test", "script": { "exec": [ "var resp = {};", "try { resp = JSON.parse(responseBody); } catch (e) { }", "var respData = resp.data || {};", "if (pm.response.code === 409) {", " pm.test(\"Property creation failed due to name conflict\", function () {", " pm.expect.fail(\"Property name already exists. Use --debug to append a timestamp or -t to set a unique title.\");", " });", "} else if (!respData.id) {", " pm.test(\"Property creation response contains ID\", function () {", " pm.expect.fail(\"Create Property response did not return an ID.\");", " });", "} else {", " pm.environment.set(\"propID\", respData.id);", " pm.environment.set(\"propFullName\", respData.attributes && respData.attributes.name);", " pm.test(\"Property: \" + respData.attributes.name + \" created with ID: \" + respData.id, function () {", " pm.response.to.have.status(201);", " pm.expect(respData.id).to.be.not.empty;", " });", "}" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "if (!pm.variables.has(\"propName\") || (pm.variables.get(\"propName\") === \"\")){", " pm.environment.set(\"propName\",\"Tag Importer\");", "}", "", "if (!pm.environment.get(\"PROPERTY_UID\")) {", " pm.environment.set(\"PROPERTY_UID\", \"\");", "}" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"{{propName}}{{PROPERTY_UID}}\",\n \"domains\": [\n \"example.com\"\n ],\n \"platform\": \"web\"\n },\n \"type\": \"properties\"\n }\n}" }, "url": { "raw": "{{HOST}}/companies/{{companyID}}/properties", "host": [ "{{HOST}}" ], "path": [ "companies", "{{companyID}}", "properties" ] }, "description": "Property name is based on the local variable **propName**. This is set initially in the **Create Property folder > Pre-request script**.\n\n### Collection Variable Naming:\n\n* `propID` - property ID of the created property" }, "response": [] }, { "name": "Create Host", "event": [ { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "pm.variables.set(\"hostID\", resp.data.id);", "", "pm.test(resp.data.attributes.name + \" ID:\" + resp.data.id, function () {", " pm.response.to.have.status(201);", " pm.expect(resp.data.id).to.be.not.empty;", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"Managed by Adobe\",\n \"type_of\": \"akamai\"\n },\n \"type\": \"hosts\"\n }\n}" }, "url": { "raw": "{{HOST}}/properties/{{propID}}/hosts", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "hosts" ] }, "description": "### Variable saved:\n\n* `hostID` - Host ID of the host created within the property" }, "response": [] }, { "name": "Create Dev Environment", "event": [ { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "pm.test(\"Developer ID:\" + resp.data.id, function () {", " pm.response.to.have.status(201);", " pm.expect(resp.data.id).to.be.not.empty;", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"Development\",\n \"stage\": \"development\"\n },\n \"relationships\": {\n \"host\": {\n \"data\": {\n \"id\": \"{{hostID}}\",\n \"type\": \"hosts\"\n }\n }\n },\n \"type\": \"environments\"\n }\n}" }, "url": { "raw": "{{HOST}}/properties/{{propID}}/environments", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "environments" ] }, "description": "Creates a dev environment based on `hostID`" }, "response": [] }, { "name": "Create Stage Environment", "event": [ { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "pm.test(\"Staging ID:\" + resp.data.id, function () {", " pm.response.to.have.status(201);", " pm.expect(resp.data.id).to.be.not.empty;", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"Staging\",\n \"stage\": \"staging\"\n },\n \"relationships\": {\n \"host\": {\n \"data\": {\n \"id\": \"{{hostID}}\",\n \"type\": \"hosts\"\n }\n }\n },\n \"type\": \"environments\"\n }\n}" }, "url": { "raw": "{{HOST}}/properties/{{propID}}/environments", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "environments" ] }, "description": "Creates a stage environment based on `hostID`" }, "response": [] }, { "name": "Create Prod Environment", "event": [ { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "pm.test(\"Production ID:\" + resp.data.id, function () {", " pm.response.to.have.status(201);", " pm.expect(resp.data.id).to.be.not.empty;", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"Production\",\n \"stage\": \"production\"\n },\n \"relationships\": {\n \"host\": {\n \"data\": {\n \"id\": \"{{hostID}}\",\n \"type\": \"hosts\"\n }\n }\n },\n \"type\": \"environments\"\n }\n}" }, "url": { "raw": "{{HOST}}/properties/{{propID}}/environments", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "environments" ] }, "description": "Creates a prod environment based on `hostID`" }, "response": [] } ], "description": "### Run as a Collection Runner\n\n### Required variable: propName\n\n`propName` can be set multiple ways:\n\n* In the Pre-request Script\n \n\n``` javascript\nvar propName = pm.variables.get(\"propName\", \"\");\nif (propName === \"\"){\n pm.variables.set(\"propName\",\"My Tag Property\");\n}\n\n```\n\n* As a collection, environment, or global variable\n \n\n`propName = My Tag Property`\n\n* In newman as a\n \n\n``` bash\n--env-var \"propName=My Tag Property\"\n\n```", "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "var propName = pm.variables.get(\"propName\", \"\");", "if (propName === \"\"){", " pm.variables.set(\"propName\",\"My Tag Property\");", "}" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] }, { "name": "Add Tag Extensions", "item": [ { "name": "Save Extension Packages", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", "", "var exts = {}", "for(const package of res.data){", " pm.variables.set(\"extPackageID_\"+package.attributes.name, package.id);", " exts[package.attributes.name] = {", " \"description\": package.attributes.description,", " \"display_name\": package.attributes.display_name", " };", "}", "console.log(JSON.stringify(exts, null, 2));", "", "pm.test(\"Extension Package IDs saved.\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/extension_packages?page[size]=999&sort=display_name&filter[platform]=EQ%20web,EQ%20null&max_availability=private", "host": [ "{{HOST}}" ], "path": [ "extension_packages" ], "query": [ { "key": "page[size]", "value": "999" }, { "key": "sort", "value": "display_name" }, { "key": "filter[platform]", "value": "EQ%20web,EQ%20null" }, { "key": "max_availability", "value": "private" } ] }, "description": "### Extension Package IDs to be saved:\n\n* ECID\n* Target v2\n* Analytics\n* ACDL\n* AEP\n* Event Mapping Table\n* Target v1.8\n* Contexthub\n \n\n### Variables saved:\n\n* `extPackageID_< name >`\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Add Extensions", "event": [ { "listen": "test", "script": { "exec": [ "var attr = pm.iterationData.get('attributes');", "if(!attr.delegate_descriptor_id.includes('core')){ // check to see if extension is core", " var resp = JSON.parse(responseBody);", " pm.test(resp.data.attributes.name + \" added with ID: \" + resp.data.id, function () {", " pm.response.to.have.status(201);", " });", "} else { // give a message showing that a 409 conflict is expected for the core extension since it's already added on property creation.", " pm.test(\"Conflict expected for core extension since it's already added at property creation.\", function () {", " pm.response.to.have.status(409);", " });", "}" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "var attr = pm.iterationData.get('attributes');", "", "var name = attr.name;", "console.log(\"Adding \"+name+\" extension.\");", "", "// Check all variables for and settings changes for Extensions", "variablesObj = pm.variables.toObject();", "for (var key in variablesObj){", " if(key.includes(\"SETTINGS_EXT\")){", " if(key.includes(name)){", " newSettings = pm.variables.get(key);", " console.log(\"Updating settings: \" + JSON.stringify(newSettings));", " attr.settings = JSON.stringify(newSettings);", " // console.log(\"UPDATED: \"+ JSON.stringify(attr));", " }", " }", "}", "pm.variables.set(\"datafile-attribute\", JSON.stringify(attr));", "", "//Get the extension package ID for the extension", "var ddi = attr.delegate_descriptor_id.split(':');", "var extPackageName = ddi[0];", "pm.variables.set(\"datafile-name\", pm.variables.get('extPackageID_'+extPackageName));" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"attributes\": {{datafile-attribute}},\n \"relationships\": {\n \"extension_package\": {\n \"data\": {\n \"id\": \"{{datafile-name}}\",\n \"type\": \"extension_packages\"\n }\n }\n },\n \"type\": \"extensions\"\n }\n}" }, "url": { "raw": "{{HOST}}/properties/{{propID}}/extensions", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "extensions" ] }, "description": "Adds the requested extension based on the `extPackageID`" }, "response": [] } ], "description": "### Required variable: propID\n\n`propID` can be set multiple ways:\n\n* In the Pre-request Script\n \n\n``` javascript\nif (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){\n pm.environment.set(\"propID\",\"PR1234567890QWERTYUIOP\");\n}\n\n```\n\n* As a collection, environment, or global variable\n \n\n`propID = PR1234567890QWERTYUIOP`\n\n* In newman as a\n \n\n``` bash\n--env-var \"propID=PR1234567890QWERTYUIOP\"\n\n```\n\n### Run as a Collection Runner with Datafile\n\nThis folder should be run as a collection runner with a datafile. The data file should be an array of extensions exported from another tag property:\n\n``` plaintext\nGET {{HOST}}properties/:propID/extensions\n\n```\n\nExample **extensions-datafile.json:**\n\n``` json\n[\n {\n \"id\": \"EX3c928e2340184002be0bbe0ab917f007\",\n \"type\": \"extensions\",\n \"attributes\": {\n \"created_at\": \"2022-02-03T18:46:09.825Z\",\n \"deleted_at\": null,\n \"dirty\": false,\n \"enabled\": true,\n \"name\": \"adobe-mcid\",\n \"published\": true,\n \"published_at\": null,\n \"revision_number\": 0,\n \"updated_at\": \"2022-02-03T18:46:09.825Z\",\n \"delegate_descriptor_id\": \"adobe-mcid::extensionConfiguration::config\",\n \"display_name\": \"Experience Cloud ID Service\",\n \"review_status\": \"unsubmitted\",\n \"version\": \"5.3.1\",\n \"settings\": \"{\\\"orgId\\\":\\\"test\\\"}\"\n },\n \"relationships\": {\n \"libraries\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX3c928e2340184002be0bbe0ab917f007/libraries\"\n }\n },\n \"revisions\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX3c928e2340184002be0bbe0ab917f007/revisions\"\n }\n },\n \"notes\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX3c928e2340184002be0bbe0ab917f007/notes\"\n }\n },\n \"property\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX3c928e2340184002be0bbe0ab917f007/property\"\n },\n \"data\": {\n \"id\": \"PRe1347b49046a4ebab1bbea6c1dd2460e\",\n \"type\": \"properties\"\n }\n },\n \"origin\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX3c928e2340184002be0bbe0ab917f007/origin\"\n },\n \"data\": {\n \"id\": \"EX3c928e2340184002be0bbe0ab917f007\",\n \"type\": \"extensions\"\n }\n },\n \"updated_with_extension_package\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX3c928e2340184002be0bbe0ab917f007/updated_with_extension_package\"\n },\n \"data\": {\n \"id\": \"EP4413121ff4ce4a49869b12b0ea80c748\",\n \"type\": \"extension_packages\"\n }\n },\n \"extension_package\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX3c928e2340184002be0bbe0ab917f007/extension_package\"\n },\n \"data\": {\n \"id\": \"EP4413121ff4ce4a49869b12b0ea80c748\",\n \"type\": \"extension_packages\"\n }\n }\n },\n \"links\": {\n \"property\": \"https://reactor.adobe.io/properties/PRe1347b49046a4ebab1bbea6c1dd2460e\",\n \"origin\": \"https://reactor.adobe.io/extensions/EX3c928e2340184002be0bbe0ab917f007\",\n \"self\": \"https://reactor.adobe.io/extensions/EX3c928e2340184002be0bbe0ab917f007\",\n \"extension_package\": \"https://reactor.adobe.io/extension_packages/EP4413121ff4ce4a49869b12b0ea80c748\",\n \"latest_extension_package\": \"https://reactor.adobe.io/extension_packages/EP4413121ff4ce4a49869b12b0ea80c748\"\n },\n \"meta\": {\n \"latest_revision_number\": 1\n }\n },\n {\n \"id\": \"EX7c0a138c9e1245e8a2f2e35820a65a48\",\n \"type\": \"extensions\",\n \"attributes\": {\n \"created_at\": \"2022-02-03T18:46:09.782Z\",\n \"deleted_at\": null,\n \"dirty\": false,\n \"enabled\": true,\n \"name\": \"adobe-target-v2\",\n \"published\": true,\n \"published_at\": null,\n \"revision_number\": 0,\n \"updated_at\": \"2022-02-03T18:46:09.782Z\",\n \"delegate_descriptor_id\": \"adobe-target-v2::extensionConfiguration::config\",\n \"display_name\": \"Adobe Target v2\",\n \"review_status\": \"unsubmitted\",\n \"version\": \"0.17.1\",\n \"settings\": \"{\\\"targetSettings\\\":{\\\"enabled\\\":true,\\\"timeout\\\":3000,\\\"version\\\":\\\"2.7.0\\\",\\\"endpoint\\\":\\\"/rest/v1/delivery\\\",\\\"imsOrgId\\\":\\\"test\\\",\\\"clientCode\\\":\\\"adobevlab7us\\\",\\\"secureOnly\\\":false,\\\"serverState\\\":{},\\\"optinEnabled\\\":false,\\\"serverDomain\\\":\\\"adobevlab7us.tt.omtrdc.net\\\",\\\"urlSizeLimit\\\":2048,\\\"viewsEnabled\\\":true,\\\"optoutEnabled\\\":false,\\\"globalMboxName\\\":\\\"target-global-mbox\\\",\\\"bodyHiddenStyle\\\":\\\"body {opacity: 0}\\\",\\\"pageLoadEnabled\\\":true,\\\"analyticsLogging\\\":\\\"server_side\\\",\\\"deviceIdLifetime\\\":63244800000,\\\"bodyHidingEnabled\\\":true,\\\"decisioningMethod\\\":\\\"server-side\\\",\\\"sessionIdLifetime\\\":1860000,\\\"visitorApiTimeout\\\":2000,\\\"authoringScriptUrl\\\":\\\"//cdn.tt.omtrdc.net/cdn/target-vec.js\\\",\\\"overrideMboxEdgeServer\\\":false,\\\"selectorsPollingTimeout\\\":5000,\\\"defaultContentHiddenStyle\\\":\\\"visibility: hidden;\\\",\\\"defaultContentVisibleStyle\\\":\\\"visibility: visible;\\\",\\\"overrideMboxEdgeServerTimeout\\\":1860000,\\\"supplementalDataIdParamTimeout\\\":30}}\"\n },\n \"relationships\": {\n \"libraries\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX7c0a138c9e1245e8a2f2e35820a65a48/libraries\"\n }\n },\n \"revisions\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX7c0a138c9e1245e8a2f2e35820a65a48/revisions\"\n }\n },\n \"notes\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX7c0a138c9e1245e8a2f2e35820a65a48/notes\"\n }\n },\n \"property\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX7c0a138c9e1245e8a2f2e35820a65a48/property\"\n },\n \"data\": {\n \"id\": \"PRe1347b49046a4ebab1bbea6c1dd2460e\",\n \"type\": \"properties\"\n }\n },\n \"origin\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX7c0a138c9e1245e8a2f2e35820a65a48/origin\"\n },\n \"data\": {\n \"id\": \"EX7c0a138c9e1245e8a2f2e35820a65a48\",\n \"type\": \"extensions\"\n }\n },\n \"updated_with_extension_package\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX7c0a138c9e1245e8a2f2e35820a65a48/updated_with_extension_package\"\n },\n \"data\": {\n \"id\": \"EP1b546118eb2742ad8d50d37a8325daca\",\n \"type\": \"extension_packages\"\n }\n },\n \"extension_package\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/extensions/EX7c0a138c9e1245e8a2f2e35820a65a48/extension_package\"\n },\n \"data\": {\n \"id\": \"EP1b546118eb2742ad8d50d37a8325daca\",\n \"type\": \"extension_packages\"\n }\n }\n },\n \"links\": {\n \"property\": \"https://reactor.adobe.io/properties/PRe1347b49046a4ebab1bbea6c1dd2460e\",\n \"origin\": \"https://reactor.adobe.io/extensions/EX7c0a138c9e1245e8a2f2e35820a65a48\",\n \"self\": \"https://reactor.adobe.io/extensions/EX7c0a138c9e1245e8a2f2e35820a65a48\",\n \"extension_package\": \"https://reactor.adobe.io/extension_packages/EP1b546118eb2742ad8d50d37a8325daca\",\n \"latest_extension_package\": \"https://reactor.adobe.io/extension_packages/EP1b546118eb2742ad8d50d37a8325daca\"\n },\n \"meta\": {\n \"latest_revision_number\": 1\n }\n }\n]\n\n```", "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "if (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){", " pm.environment.set(\"propID\",\"not-specified\");", "}" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] }, { "name": "Add Tag Data Elements", "item": [ { "name": "Save Extensions", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", "", "for(const obj of res.data){", " pm.variables.set(\"extID_\"+obj.attributes.name, obj.id);", "}", "", "pm.test(\"Extension IDs saved.\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/properties/{{propID}}/extensions", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "extensions" ] }, "description": "Saves all extension IDs in this tag property.\n\n### Variables saved:\n\n* `extID_< name >`\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Add Data Element", "event": [ { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "var attr = pm.iterationData.get('attributes');", "pm.test(attr.name + \" added.\", function () {", " pm.response.to.have.status(201);", "", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "var attr = pm.iterationData.get('attributes');", "", "var name = attr.name;", "console.log(\"Adding \"+name+\" data element.\");", "", "variablesObj = pm.variables.toObject();", "// Find All variables with SETTINGS_DE and then replace the attribute settings", "for (var key in variablesObj){", " if(key.includes(\"SETTINGS_DE\")){", " if(key.includes(name)){", " newSettings = pm.variables.get(key);", " console.log(\"Updating settings: \" + JSON.stringify(newSettings));", " attr.settings = JSON.stringify(newSettings);", " // console.log(\"UPDATED: \"+ JSON.stringify(attr));", " }", " }", "}", "pm.variables.set(\"datafile-attribute\", JSON.stringify(attr));", "", "//Get the extension ID for the data element", "var ddi = attr.delegate_descriptor_id.split(':');", "var extName = ddi[0];", "pm.variables.set(\"datafile-name\", pm.variables.get('extID_'+extName));", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"attributes\": {{datafile-attribute}},\n \"relationships\": {\n \"extension\": {\n \"data\": {\n \"id\": \"{{datafile-name}}\",\n \"type\": \"extensions\"\n }\n }\n },\n \"type\": \"data_elements\"\n }\n}" }, "url": { "raw": "{{HOST}}/properties/{{propID}}/data_elements", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "data_elements" ] }, "description": "### Collection Variable Naming:\n\n* `dataElementID_< name >` - ID of the data element created\n* `dataElementName_< name >` - Name of the data element\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] } ], "description": "### Required variable: propID\n\n`propID` can be set multiple ways:\n\n* In the Pre-request Script\n \n\n``` javascript\nif (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){\n pm.environment.set(\"propID\",\"PR1234567890QWERTYUIOP\");\n}\n\n```\n\n* As a collection, environment, or global variable\n \n\n`propID = PR1234567890QWERTYUIOP`\n\n* In newman as a\n \n\n``` bash\n--env-var \"propID=PR1234567890QWERTYUIOP\"\n\n```\n\n### Run as a Collection Runner with Datafile\n\nThis folder should be run as a collection runner with a datafile. The data file should be an array of data elements exported from another tag property:\n\n``` plaintext\nGET {{HOST}}properties/:propID/data_elements\n\n```\n\nExample **data-elements-datafile.json:**\n\n``` json\n[\n {\n \"id\": \"DEf66f8deed96a466e927591e13ac960fe\",\n \"type\": \"data_elements\",\n \"attributes\": {\n \"created_at\": \"2022-02-04T19:55:50.984Z\",\n \"deleted_at\": null,\n \"dirty\": false,\n \"enabled\": true,\n \"name\": \"Authentication State\",\n \"published\": true,\n \"published_at\": null,\n \"revision_number\": 0,\n \"updated_at\": \"2022-02-04T21:18:52.718Z\",\n \"clean_text\": false,\n \"default_value\": null,\n \"delegate_descriptor_id\": \"core::dataElements::custom-code\",\n \"force_lower_case\": false,\n \"review_status\": \"unsubmitted\",\n \"storage_duration\": null,\n \"settings\":\"{\\\"source\\\":\\\"if (digitalData \\\\&\\\\& digitalData.user[0].profile[0].attributes.loggedIn)\\\\n return \\\\\\\"logged in\\\\\\\";\\\\nelse\\\\n return \\\\\\\"logged out\\\\\\\";\\\\n\\\"}\"\n },\n \"relationships\": {\n \"libraries\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DEf66f8deed96a466e927591e13ac960fe/libraries\"\n }\n },\n \"revisions\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DEf66f8deed96a466e927591e13ac960fe/revisions\"\n }\n },\n \"notes\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DEf66f8deed96a466e927591e13ac960fe/notes\"\n }\n },\n \"property\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DEf66f8deed96a466e927591e13ac960fe/property\"\n },\n \"data\": {\n \"id\": \"PRe1347b49046a4ebab1bbea6c1dd2460e\",\n \"type\": \"properties\"\n }\n },\n \"origin\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DEf66f8deed96a466e927591e13ac960fe/origin\"\n },\n \"data\": {\n \"id\": \"DEf66f8deed96a466e927591e13ac960fe\",\n \"type\": \"data_elements\"\n }\n },\n \"extension\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DEf66f8deed96a466e927591e13ac960fe/extension\"\n },\n \"data\": {\n \"id\": \"EX03d7f33dead9439db3f073528d164e99\",\n \"type\": \"extensions\"\n }\n },\n \"updated_with_extension_package\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DEf66f8deed96a466e927591e13ac960fe/updated_with_extension_package\"\n },\n \"data\": {\n \"id\": \"EPd22815afd48447aa955be6a3a012e3b5\",\n \"type\": \"extension_packages\"\n }\n },\n \"updated_with_extension\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DEf66f8deed96a466e927591e13ac960fe/updated_with_extension\"\n },\n \"data\": {\n \"id\": \"EXfd58bcffee0646459064cbb7de6b9754\",\n \"type\": \"extensions\"\n }\n }\n },\n \"links\": {\n \"property\": \"https://reactor.adobe.io/properties/PRe1347b49046a4ebab1bbea6c1dd2460e\",\n \"origin\": \"https://reactor.adobe.io/data_elements/DEf66f8deed96a466e927591e13ac960fe\",\n \"self\": \"https://reactor.adobe.io/data_elements/DEf66f8deed96a466e927591e13ac960fe\",\n \"extension\": \"https://reactor.adobe.io/extensions/EX03d7f33dead9439db3f073528d164e99\"\n },\n \"meta\": {\n \"latest_revision_number\": 2\n }\n },\n {\n \"id\": \"DE25f7777ce0564e4cadaed34fe97b0fbc\",\n \"type\": \"data_elements\",\n \"attributes\": {\n \"created_at\": \"2022-02-04T19:17:15.107Z\",\n \"deleted_at\": null,\n \"dirty\": false,\n \"enabled\": true,\n \"name\": \"[Cart/wishlist] Product Id\",\n \"published\": true,\n \"published_at\": null,\n \"revision_number\": 0,\n \"updated_at\": \"2022-02-04T19:45:25.787Z\",\n \"clean_text\": false,\n \"default_value\": null,\n \"delegate_descriptor_id\": \"core::dataElements::custom-code\",\n \"force_lower_case\": false,\n \"review_status\": \"unsubmitted\",\n \"storage_duration\": null,\n \"settings\":\"{\\\"source\\\":\\\"if(event \\\\&\\\\& \\\\n event.message \\\\&\\\\& \\\\n event.message.eventInfo \\\\&\\\\&\\\\n event.message.eventInfo.hasOwnProperty('@id')){\\\\n return event.message.eventInfo['@id'];\\\\n}\\\"}\"\n },\n \"relationships\": {\n \"libraries\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DE25f7777ce0564e4cadaed34fe97b0fbc/libraries\"\n }\n },\n \"revisions\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DE25f7777ce0564e4cadaed34fe97b0fbc/revisions\"\n }\n },\n \"notes\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DE25f7777ce0564e4cadaed34fe97b0fbc/notes\"\n }\n },\n \"property\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DE25f7777ce0564e4cadaed34fe97b0fbc/property\"\n },\n \"data\": {\n \"id\": \"PRe1347b49046a4ebab1bbea6c1dd2460e\",\n \"type\": \"properties\"\n }\n },\n \"origin\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DE25f7777ce0564e4cadaed34fe97b0fbc/origin\"\n },\n \"data\": {\n \"id\": \"DE25f7777ce0564e4cadaed34fe97b0fbc\",\n \"type\": \"data_elements\"\n }\n },\n \"extension\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DE25f7777ce0564e4cadaed34fe97b0fbc/extension\"\n },\n \"data\": {\n \"id\": \"EX03d7f33dead9439db3f073528d164e99\",\n \"type\": \"extensions\"\n }\n },\n \"updated_with_extension_package\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DE25f7777ce0564e4cadaed34fe97b0fbc/updated_with_extension_package\"\n },\n \"data\": {\n \"id\": \"EPd22815afd48447aa955be6a3a012e3b5\",\n \"type\": \"extension_packages\"\n }\n },\n \"updated_with_extension\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/data_elements/DE25f7777ce0564e4cadaed34fe97b0fbc/updated_with_extension\"\n },\n \"data\": {\n \"id\": \"EXfd58bcffee0646459064cbb7de6b9754\",\n \"type\": \"extensions\"\n }\n }\n },\n \"links\": {\n \"property\": \"https://reactor.adobe.io/properties/PRe1347b49046a4ebab1bbea6c1dd2460e\",\n \"origin\": \"https://reactor.adobe.io/data_elements/DE25f7777ce0564e4cadaed34fe97b0fbc\",\n \"self\": \"https://reactor.adobe.io/data_elements/DE25f7777ce0564e4cadaed34fe97b0fbc\",\n \"extension\": \"https://reactor.adobe.io/extensions/EX03d7f33dead9439db3f073528d164e99\"\n },\n \"meta\": {\n \"latest_revision_number\": 3\n }\n }\n]\n\n```", "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "if (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){", " pm.environment.set(\"propID\",\"not-specified\");", "}" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] }, { "name": "Add Tag Rule and CMPs", "item": [ { "name": "Save Extensions", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", "", "for(const obj of res.data){", " pm.variables.set(\"extID_\"+obj.attributes.name, obj.id);", "}", "", "pm.test(\"Extension IDs saved.\", function () {", " pm.response.to.have.status(200);", "});", "", "//Skip \"Add Rule\" if it's not the first iteration", "if(pm.info.iteration != 0){", " postman.setNextRequest(\"Add Rule Component\");", "}" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/properties/{{propID}}/extensions", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "extensions" ] }, "description": "Saves all extension IDs in this tag property.\n\n### Variables saved:\n\n* `extID_< name >`\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Add Rule", "event": [ { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "pm.variables.set(\"currentRule\",resp.data.id);", "", "pm.test(resp.data.attributes.name + \" added with ID: \" + resp.data.id, function () {", " pm.response.to.have.status(201);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"attributes\": {\n \"enabled\": true,\n \"name\": \"{{ruleName}}\"\n },\n \"type\": \"rules\"\n }\n}" }, "url": { "raw": "{{HOST}}/properties/{{propID}}/rules", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "rules" ] }, "description": "Creates a new rule based on the `ruleName.` This is only run once per datafile to ensure all rule components are added to the same rule.\n\n### Variable saved:\n\n* `ruleID_< name >` - ID of the rule created\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Add Rule Component", "event": [ { "listen": "prerequest", "script": { "exec": [ "var attr = pm.iterationData.get('attributes');", "", "var ddi = attr.delegate_descriptor_id.split(':')", "var name = ddi[0];", "", "pm.variables.set(\"datafile-attribute\", JSON.stringify(attr));", "pm.variables.set(\"datafile-name\", pm.variables.get('extID_'+name));", "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "var name = resp.data.attributes.name;", "var currentRule = pm.variables.get(\"currentRule\");", "", "pm.test(name + \" component added to \" + currentRule + \" rule\", function () {", " pm.response.to.have.status(201);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"attributes\": {{datafile-attribute}},\n \"relationships\": {\n \"extension\": {\n \"data\": {\n \"id\": \"{{datafile-name}}\",\n \"type\": \"extensions\"\n }\n },\n \"rules\": {\n \"data\": [\n {\n \"id\": \"{{currentRule}}\",\n \"type\": \"rules\"\n }\n ]\n }\n },\n \"type\": \"rule_components\"\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{HOST}}/properties/{{propID}}/rule_components", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "rule_components" ] }, "description": "Adds the rule component to the specified rule from the `ruleID`." }, "response": [] } ], "description": "### Required variables: propID and ruleName\n\n`propID` and `ruleName` can be set multiple ways:\n\n* In the Pre-request Script\n \n\n``` javascript\nif (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){\n pm.environment.set(\"propID\",\"PR1234567890QWERTYUIOP\");\n}\nif (!pm.variables.has(\"ruleName\") || (pm.variables.get(\"ruleName\") === \"\")){\n pm.environment.set(\"ruleName\",\"My Rule\");\n}\n\n```\n\n* As a collection, environment, or global variable\n \n\n`propID = PR1234567890QWERTYUIOP`\n\n`ruleName = \"My Rule\"`\n\n* In newman as a param:\n \n\n``` bash\n--env-var \"propID=PR1234567890QWERTYUIOP\" --env-var \"ruleName=My Rule\"\n\n```\n\n### Run as a Collection Runner with Datafile\n\nThe **ruleName** indicates the rule that all rule components in the datafile will go under. Once the **ruleName** has been set, this folder should be run as a collection runner with a datafile. The datafile should be an array of rule components exported from another tag property:\n\n``` plaintext\nGET {{HOST}}/rules/:currentRule/rule_components\n\n```\n\nExample **rulecmp-datafile.json:**\n\n``` json\n[\n {\n \"id\": \"RC6046283da8c5477c9dc07f2c326cb52b\",\n \"type\": \"rule_components\",\n \"attributes\": {\n \"created_at\": \"2022-02-04T19:59:58.449Z\",\n \"delegate_descriptor_id\": \"adobe-mcid::actions::set-customer-ids\",\n \"deleted_at\": null,\n \"dirty\": false,\n \"name\": \"Experience Cloud ID Service - Set Customer IDs\",\n \"negate\": false,\n \"order\": 0,\n \"rule_order\": 50.0,\n \"timeout\": 2000,\n \"delay_next\": true,\n \"published\": true,\n \"published_at\": null,\n \"revision_number\": 0,\n \"updated_at\": \"2022-02-04T19:59:58.449Z\",\n \"settings\": \"{\\\"customerIds\\\":[{\\\"value\\\":\\\"%Email (hashed)%\\\",\\\"hashType\\\":\\\"\\\",\\\"authState\\\":1,\\\"integrationCode\\\":\\\"crm_id\\\"}]}\"\n },\n \"relationships\": {\n \"updated_with_extension_package\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC6046283da8c5477c9dc07f2c326cb52b/updated_with_extension_package\"\n },\n \"data\": {\n \"id\": \"EP4413121ff4ce4a49869b12b0ea80c748\",\n \"type\": \"extension_packages\"\n }\n },\n \"updated_with_extension\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC6046283da8c5477c9dc07f2c326cb52b/updated_with_extension\"\n },\n \"data\": {\n \"id\": \"EX58ee603a00bf4d598954b78785544e54\",\n \"type\": \"extensions\"\n }\n },\n \"extension\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC6046283da8c5477c9dc07f2c326cb52b/extension\"\n },\n \"data\": {\n \"id\": \"EX3c928e2340184002be0bbe0ab917f007\",\n \"type\": \"extensions\"\n }\n },\n \"notes\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC6046283da8c5477c9dc07f2c326cb52b/notes\"\n }\n },\n \"origin\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC6046283da8c5477c9dc07f2c326cb52b/origin\"\n },\n \"data\": {\n \"id\": \"RC6046283da8c5477c9dc07f2c326cb52b\",\n \"type\": \"rule_components\"\n }\n },\n \"property\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/properties/PRe1347b49046a4ebab1bbea6c1dd2460e\"\n },\n \"data\": {\n \"id\": \"PRe1347b49046a4ebab1bbea6c1dd2460e\",\n \"type\": \"properties\"\n }\n },\n \"rules\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC6046283da8c5477c9dc07f2c326cb52b/rules\"\n }\n }\n },\n \"links\": {\n \"extension\": \"https://reactor.adobe.io/extensions/EX3c928e2340184002be0bbe0ab917f007\",\n \"origin\": \"https://reactor.adobe.io/rule_components/RC6046283da8c5477c9dc07f2c326cb52b\",\n \"rules\": \"https://reactor.adobe.io/rule_components/RC6046283da8c5477c9dc07f2c326cb52b/rules\",\n \"self\": \"https://reactor.adobe.io/rule_components/RC6046283da8c5477c9dc07f2c326cb52b\"\n },\n \"meta\": {\n \"latest_revision_number\": 2\n }\n },\n {\n \"id\": \"RC80a7546831fc4d7884bdd661f7b78adc\",\n \"type\": \"rule_components\",\n \"attributes\": {\n \"created_at\": \"2022-02-04T19:59:58.437Z\",\n \"delegate_descriptor_id\": \"core::events::library-loaded\",\n \"deleted_at\": null,\n \"dirty\": false,\n \"name\": \"Core - Library Loaded (Page Top)\",\n \"negate\": false,\n \"order\": 0,\n \"rule_order\": 10.0,\n \"timeout\": 2000,\n \"delay_next\": true,\n \"published\": true,\n \"published_at\": null,\n \"revision_number\": 0,\n \"updated_at\": \"2022-02-04T19:59:58.437Z\",\n \"settings\": \"{}\"\n },\n \"relationships\": {\n \"updated_with_extension_package\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC80a7546831fc4d7884bdd661f7b78adc/updated_with_extension_package\"\n },\n \"data\": {\n \"id\": \"EPd22815afd48447aa955be6a3a012e3b5\",\n \"type\": \"extension_packages\"\n }\n },\n \"updated_with_extension\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC80a7546831fc4d7884bdd661f7b78adc/updated_with_extension\"\n },\n \"data\": {\n \"id\": \"EXfd58bcffee0646459064cbb7de6b9754\",\n \"type\": \"extensions\"\n }\n },\n \"extension\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC80a7546831fc4d7884bdd661f7b78adc/extension\"\n },\n \"data\": {\n \"id\": \"EX03d7f33dead9439db3f073528d164e99\",\n \"type\": \"extensions\"\n }\n },\n \"notes\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC80a7546831fc4d7884bdd661f7b78adc/notes\"\n }\n },\n \"origin\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC80a7546831fc4d7884bdd661f7b78adc/origin\"\n },\n \"data\": {\n \"id\": \"RC80a7546831fc4d7884bdd661f7b78adc\",\n \"type\": \"rule_components\"\n }\n },\n \"property\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/properties/PRe1347b49046a4ebab1bbea6c1dd2460e\"\n },\n \"data\": {\n \"id\": \"PRe1347b49046a4ebab1bbea6c1dd2460e\",\n \"type\": \"properties\"\n }\n },\n \"rules\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC80a7546831fc4d7884bdd661f7b78adc/rules\"\n }\n }\n },\n \"links\": {\n \"extension\": \"https://reactor.adobe.io/extensions/EX03d7f33dead9439db3f073528d164e99\",\n \"origin\": \"https://reactor.adobe.io/rule_components/RC80a7546831fc4d7884bdd661f7b78adc\",\n \"rules\": \"https://reactor.adobe.io/rule_components/RC80a7546831fc4d7884bdd661f7b78adc/rules\",\n \"self\": \"https://reactor.adobe.io/rule_components/RC80a7546831fc4d7884bdd661f7b78adc\"\n },\n \"meta\": {\n \"latest_revision_number\": 2\n }\n },\n {\n \"id\": \"RC1b9be42691e6482c86bb8da04e8a8fe6\",\n \"type\": \"rule_components\",\n \"attributes\": {\n \"created_at\": \"2022-02-04T19:59:58.431Z\",\n \"delegate_descriptor_id\": \"core::conditions::value-comparison\",\n \"deleted_at\": null,\n \"dirty\": false,\n \"name\": \"Core - Value Comparison\",\n \"negate\": false,\n \"order\": 0,\n \"rule_order\": 50.0,\n \"timeout\": 2000,\n \"delay_next\": true,\n \"published\": true,\n \"published_at\": null,\n \"revision_number\": 0,\n \"updated_at\": \"2022-02-04T19:59:58.431Z\",\n \"settings\": \"{\\\"comparison\\\":{\\\"operator\\\":\\\"equals\\\"},\\\"leftOperand\\\":\\\"%Authentication State%\\\",\\\"rightOperand\\\":\\\"logged in\\\"}\"\n },\n \"relationships\": {\n \"updated_with_extension_package\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC1b9be42691e6482c86bb8da04e8a8fe6/updated_with_extension_package\"\n },\n \"data\": {\n \"id\": \"EPd22815afd48447aa955be6a3a012e3b5\",\n \"type\": \"extension_packages\"\n }\n },\n \"updated_with_extension\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC1b9be42691e6482c86bb8da04e8a8fe6/updated_with_extension\"\n },\n \"data\": {\n \"id\": \"EXfd58bcffee0646459064cbb7de6b9754\",\n \"type\": \"extensions\"\n }\n },\n \"extension\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC1b9be42691e6482c86bb8da04e8a8fe6/extension\"\n },\n \"data\": {\n \"id\": \"EX03d7f33dead9439db3f073528d164e99\",\n \"type\": \"extensions\"\n }\n },\n \"notes\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC1b9be42691e6482c86bb8da04e8a8fe6/notes\"\n }\n },\n \"origin\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC1b9be42691e6482c86bb8da04e8a8fe6/origin\"\n },\n \"data\": {\n \"id\": \"RC1b9be42691e6482c86bb8da04e8a8fe6\",\n \"type\": \"rule_components\"\n }\n },\n \"property\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/properties/PRe1347b49046a4ebab1bbea6c1dd2460e\"\n },\n \"data\": {\n \"id\": \"PRe1347b49046a4ebab1bbea6c1dd2460e\",\n \"type\": \"properties\"\n }\n },\n \"rules\": {\n \"links\": {\n \"related\": \"https://reactor.adobe.io/rule_components/RC1b9be42691e6482c86bb8da04e8a8fe6/rules\"\n }\n }\n },\n \"links\": {\n \"extension\": \"https://reactor.adobe.io/extensions/EX03d7f33dead9439db3f073528d164e99\",\n \"origin\": \"https://reactor.adobe.io/rule_components/RC1b9be42691e6482c86bb8da04e8a8fe6\",\n \"rules\": \"https://reactor.adobe.io/rule_components/RC1b9be42691e6482c86bb8da04e8a8fe6/rules\",\n \"self\": \"https://reactor.adobe.io/rule_components/RC1b9be42691e6482c86bb8da04e8a8fe6\"\n },\n \"meta\": {\n \"latest_revision_number\": 2\n }\n }\n ]\n\n```", "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "if (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){", " pm.environment.set(\"propID\",\"not-specified\");", "}", "", "if (!pm.variables.has(\"ruleName\") || (pm.variables.get(\"ruleName\") === \"\")){", " var now = new Date(Date.now());", " pm.environment.set(\"ruleName\",\"Rule \" + now.toISOString());", "}" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] }, { "name": "Publish Dev", "item": [ { "name": "Save Extensions", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", "", "for(const obj of res.data){", " pm.variables.set(\"extID_\"+obj.attributes.name, obj.id);", "}", "", "pm.test(\"IDs for \"+res.data.length+\" Extensions saved.\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/properties/{{propID}}/extensions", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "extensions" ] }, "description": "Saves all extension IDs in this tag property.\n\n### Variables saved:\n\n* `extID_< name >`\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Save Data Elements", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", "", "for(const obj of res.data){", " pm.variables.set(\"dataElementID_\"+obj.attributes.name, obj.id);", "}", "", "pm.test(\"IDs for \"+res.data.length+\" Data Elements saved.\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/properties/{{propID}}/data_elements", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "data_elements" ] }, "description": "Saves all data element IDs in this tag property.\n\n### Variables saved:\n\n* `dataElementID_< name >`\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Save Rules", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", "", "for(const obj of res.data){", " pm.variables.set(\"ruleID_\"+obj.attributes.name, obj.id);", "}", "", "pm.test(\"IDs for \"+res.data.length+\" Rules saved.\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/properties/{{propID}}/rules", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "rules" ] }, "description": "Saves all rule IDs in this tag property.\n\n### Variables saved:\n\n* `ruleID_< name >`\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Save Environments", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", "", "for(const obj of res.data){", " pm.environment.set(\"envID_\"+obj.attributes.name, obj.id);", "}", "", "pm.test(\"IDs for \"+res.data.length+\" Environments saved.\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/properties/{{propID}}/environments", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "environments" ] }, "description": "Saves all environment IDs in this tag property.\n\n### Variables saved:\n\n* `envID_< name >`\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Create Library", "event": [ { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "//evKey and evValue are the only values that should be changed in this script. Everything else is boilerplate.", "var evKey = \"libraryID\";", "var evValue = resp.data.id;", "", "pm.environment.set(evKey, evValue);", "", "pm.test(\"Library with ID: \"+evValue+\" has been created\", function () {", " pm.response.to.have.status(201);", " pm.expect(evValue).to.be.not.empty;", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "var data_data_elements = [];", "var data_rules = [];", "var data_extensions = [];", "// varObj = pm.environment.toObject();", "varObj = pm.variables.toObject();", "", "//Find all data elements, rules, and extensions in this property so they can be added to the Library", "for (var key in varObj){", " if(varObj.hasOwnProperty(key)){", " if(key.includes(\"dataElementID\") && varObj[key] != \"\"){", " var dEObj_data = new Object();", " dEObj_data.id = varObj[key];", " dEObj_data.type = \"data_elements\";", " dEObj_data.meta = {};", " dEObj_data.meta.action = \"revise\";", " data_data_elements.push(JSON.stringify(dEObj_data));", " }", " if(key.includes(\"ruleID\") && varObj[key] != \"\"){", " var ruleObj_data = new Object();", " ruleObj_data.id = varObj[key];", " ruleObj_data.type = \"rules\";", " ruleObj_data.meta = {};", " ruleObj_data.meta.action = \"revise\";", " data_rules.push(JSON.stringify(ruleObj_data));", " }", " if(key.includes(\"extID\") && varObj[key] != \"\"){", " var extObj_data = new Object();", " extObj_data.id = varObj[key];", " extObj_data.type = \"extensions\";", " extObj_data.meta = {};", " extObj_data.meta.action = \"revise\";", " data_extensions.push(JSON.stringify(extObj_data));", " }", " }", "}", "//If there are data elements, create a JSON entry for them", "var data_elementsObj = \"\";", "if(data_data_elements.length != 0){", " data_elementsObj = `\"data_elements\": {", " \"data\": [`", " +data_data_elements+", " `]", " },`;", "}", "//If there are rules, create a JSON entry for them", "var rulesObj = \"\";", "if(data_rules.length != 0){", " rulesObj = `\"rules\": {", " \"data\": [`", " +data_rules+", " `]", " },`;", "}", "//If there are extensions, create a JSON entry for them", "var extensionsObj = \"\";", "if(data_extensions.length != 0){", " extensionsObj = `\"extensions\": {", " \"data\": [`", " +data_extensions+", " `]", " },`;", "}", "pm.variables.set(\"data_data_elements\", data_elementsObj);", "pm.variables.set(\"data_rules\", rulesObj);", "pm.variables.set(\"data_extensions\", extensionsObj);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"My Library\"\n },\n \"type\": \"libraries\",\n \"relationships\": {\n {{data_data_elements}}\n {{data_rules}}\n {{data_extensions}}\n \"environment\": {\n \"data\": { \n \"type\": \"environments\", \n \"id\": \"{{envID_Development}}\" \n }\n }\n }\n }\n}" }, "url": { "raw": "{{HOST}}/properties/{{propID}}/libraries", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "libraries" ] }, "description": "Finds all variables that start with:\n\n* extID\n* dataElementID\n* ruleID\n \n\nand adds the IDs to the Library to be built and published to production\n\n### Collection Variable Naming:\n\n* `libraryID` - ID of the library to be built" }, "response": [] }, { "name": "Build to Dev", "event": [ { "listen": "test", "script": { "exec": [ "console.log(\"Waiting 20 seconds for the build to complete\")", "setTimeout(function(){", " var resp = JSON.parse(responseBody);", "", " if(resp.data && resp.data.meta){", " console.log(\"Dev Artifact URL: \" + resp.data.meta.artifact_url);", " pm.environment.set(\"devArtifactURL\", resp.data.meta.artifact_url);", " }", "", " pm.test(\"Library is published to Dev\", function () {", " pm.response.to.have.status(201);", " });", "}, 20000);", "", "", "", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{HOST}}/libraries/{{libraryID}}/builds", "host": [ "{{HOST}}" ], "path": [ "libraries", "{{libraryID}}", "builds" ] }, "description": "Builds the library based on libraryID" }, "response": [] } ], "description": "### Run as a Collection Runner\n\n### Required variable: propID\n\n`propID` can be set multiple ways:\n\n* In the Pre-request Script\n \n\n``` javascript\nif (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){\n pm.environment.set(\"propID\",\"PR1234567890QWERTYUIOP\");\n}\n\n```\n\n* As a collection, environment, or global variable\n \n\n`propID = PR1234567890QWERTYUIOP`\n\n* In newman as a\n \n\n``` bash\n--env-var \"propID=PR1234567890QWERTYUIOP\"\n\n```", "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "if (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){", " pm.environment.set(\"propID\",\"not-specified\");", "}" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] }, { "name": "Publish Prod", "item": [ { "name": "Submit", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Library is submitted for approval\", function () {", " pm.response.to.have.status(200);", "});", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"id\": \"{{libraryID}}\",\n \"type\": \"libraries\",\n \"meta\": {\n \"action\": \"submit\"\n }\n }\n}" }, "url": { "raw": "{{HOST}}/libraries/{{libraryID}}", "host": [ "{{HOST}}" ], "path": [ "libraries", "{{libraryID}}" ] }, "description": "Submits the library based on libraryID" }, "response": [] }, { "name": "Approve", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Library is approved for production\", function () {", " pm.response.to.have.status(200);", "});", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"id\": \"{{libraryID}}\",\n \"type\": \"libraries\",\n \"meta\": {\n \"action\": \"approve\"\n }\n }\n}" }, "url": { "raw": "{{HOST}}/libraries/{{libraryID}}", "host": [ "{{HOST}}" ], "path": [ "libraries", "{{libraryID}}" ] }, "description": "Approves the library based on libraryID" }, "response": [] }, { "name": "Add to prod Environment", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Library is added to production\", function () {", " pm.response.to.have.status(200);", "});", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"id\": \"{{envID_Production}}\",\n \"type\": \"environments\"\n }\n}" }, "url": { "raw": "{{HOST}}/libraries/{{libraryID}}/relationships/environment", "host": [ "{{HOST}}" ], "path": [ "libraries", "{{libraryID}}", "relationships", "environment" ] }, "description": "Adds the library to the production environment based on `libraryID`" }, "response": [] }, { "name": "Publish", "event": [ { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "if(resp.data && resp.data.meta){", " console.log(\"Artifact URL: \" + resp.data.meta.artifact_url);", " pm.environment.set(\"prodArtifactURL\", resp.data.meta.artifact_url);", "}", "", "pm.test(\"Library is published\", function () {", " pm.response.to.have.status(201);", "});", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/libraries/{{libraryID}}/builds", "host": [ "{{HOST}}" ], "path": [ "libraries", "{{libraryID}}", "builds" ] }, "description": "Publishes the production library" }, "response": [] } ], "description": "### Run as a Collection Runner\n\n### Required variable: propID\n\n`propID` can be set multiple ways:\n\n* In the Pre-request Script\n \n\n``` javascript\nif (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){\n pm.environment.set(\"propID\",\"PR1234567890QWERTYUIOP\");\n}\n\n```\n\n* As a collection, environment, or global variable\n \n\n`propID = PR1234567890QWERTYUIOP`\n\n* In newman as a\n \n\n``` bash\n--env-var \"propID=PR1234567890QWERTYUIOP\"\n\n```", "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "if (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){", " pm.environment.set(\"propID\",\"not-specified\");", "}" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] }, { "name": "Publish Prod Copy", "item": [ { "name": "Save Extensions", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", "", "for(const obj of res.data){", " pm.variables.set(\"extID_\"+obj.attributes.name, obj.id);", "}", "", "pm.test(\"IDs for \"+res.data.length+\" Extensions saved.\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/properties/{{propID}}/extensions", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "extensions" ] }, "description": "Saves all extension IDs in this tag property.\n\n### Variables saved:\n\n* `extID_< name >`\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Save Data Elements", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", "", "for(const obj of res.data){", " pm.variables.set(\"dataElementID_\"+obj.attributes.name, obj.id);", "}", "", "pm.test(\"IDs for \"+res.data.length+\" Data Elements saved.\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/properties/{{propID}}/data_elements", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "data_elements" ] }, "description": "Saves all data element IDs in this tag property.\n\n### Variables saved:\n\n* `dataElementID_< name >`\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Save Rules", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", "", "for(const obj of res.data){", " pm.variables.set(\"ruleID_\"+obj.attributes.name, obj.id);", "}", "", "pm.test(\"IDs for \"+res.data.length+\" Rules saved.\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/properties/{{propID}}/rules", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "rules" ] }, "description": "Saves all rule IDs in this tag property.\n\n### Variables saved:\n\n* `ruleID_< name >`\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Save Environments", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", "", "for(const obj of res.data){", " pm.variables.set(\"envID_\"+obj.attributes.name, obj.id);", "}", "", "pm.test(\"IDs for \"+res.data.length+\" Environments saved.\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/properties/{{propID}}/environments", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "environments" ] }, "description": "Saves all environment IDs in this tag property.\n\n### Variables saved:\n\n* `envID_< name >`\n \n\nWhere `< name >` is derived from the response: `data.attributes.name`" }, "response": [] }, { "name": "Create Library", "event": [ { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "//evKey and evValue are the only values that should be changed in this script. Everything else is boilerplate.", "var evKey = \"libraryID\";", "var evValue = resp.data.id;", "", "pm.variables.set(evKey, evValue);", "", "pm.test(\"Library with ID: \"+evValue+\" has been created\", function () {", " pm.response.to.have.status(201);", " pm.expect(evValue).to.be.not.empty;", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "var data_data_elements = [];", "var data_rules = [];", "var data_extensions = [];", "// varObj = pm.environment.toObject();", "varObj = pm.variables.toObject();", "", "//Find all data elements, rules, and extensions in this property so they can be added to the Library", "for (var key in varObj){", " if(varObj.hasOwnProperty(key)){", " if(key.includes(\"dataElementID\") && varObj[key] != \"\"){", " var dEObj_data = new Object();", " dEObj_data.id = varObj[key];", " dEObj_data.type = \"data_elements\";", " dEObj_data.meta = {};", " dEObj_data.meta.action = \"revise\";", " data_data_elements.push(JSON.stringify(dEObj_data));", " }", " if(key.includes(\"ruleID\") && varObj[key] != \"\"){", " var ruleObj_data = new Object();", " ruleObj_data.id = varObj[key];", " ruleObj_data.type = \"rules\";", " ruleObj_data.meta = {};", " ruleObj_data.meta.action = \"revise\";", " data_rules.push(JSON.stringify(ruleObj_data));", " }", " if(key.includes(\"extID\") && varObj[key] != \"\"){", " var extObj_data = new Object();", " extObj_data.id = varObj[key];", " extObj_data.type = \"extensions\";", " extObj_data.meta = {};", " extObj_data.meta.action = \"revise\";", " data_extensions.push(JSON.stringify(extObj_data));", " }", " }", "}", "//If there are data elements, create a JSON entry for them", "var data_elementsObj = \"\";", "if(data_data_elements.length != 0){", " data_elementsObj = `\"data_elements\": {", " \"data\": [`", " +data_data_elements+", " `]", " },`;", "}", "//If there are rules, create a JSON entry for them", "var rulesObj = \"\";", "if(data_rules.length != 0){", " rulesObj = `\"rules\": {", " \"data\": [`", " +data_rules+", " `]", " },`;", "}", "//If there are extensions, create a JSON entry for them", "var extensionsObj = \"\";", "if(data_extensions.length != 0){", " extensionsObj = `\"extensions\": {", " \"data\": [`", " +data_extensions+", " `]", " },`;", "}", "pm.variables.set(\"data_data_elements\", data_elementsObj);", "pm.variables.set(\"data_rules\", rulesObj);", "pm.variables.set(\"data_extensions\", extensionsObj);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"My Library\"\n },\n \"type\": \"libraries\",\n \"relationships\": {\n {{data_data_elements}}\n {{data_rules}}\n {{data_extensions}}\n \"environment\": {\n \"data\": { \n \"type\": \"environments\", \n \"id\": \"{{envID_Development}}\" \n }\n }\n }\n }\n}" }, "url": { "raw": "{{HOST}}/properties/{{propID}}/libraries", "host": [ "{{HOST}}" ], "path": [ "properties", "{{propID}}", "libraries" ] }, "description": "Finds all variables that start with:\n\n* extID\n* dataElementID\n* ruleID\n \n\nand adds the IDs to the Library to be built and published to production\n\n### Collection Variable Naming:\n\n* `libraryID` - ID of the library to be built" }, "response": [] }, { "name": "Build to Dev", "event": [ { "listen": "test", "script": { "exec": [ "console.log(\"Waiting 20 seconds for the build to complete\")", "setTimeout(function(){", " pm.test(\"Library is built in dev\", function () {", " pm.response.to.have.status(201);", " });", "}, 20000);", "", "", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{HOST}}/libraries/{{libraryID}}/builds", "host": [ "{{HOST}}" ], "path": [ "libraries", "{{libraryID}}", "builds" ] }, "description": "Builds the library based on libraryID" }, "response": [] }, { "name": "Submit", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Library is submitted for approval\", function () {", " pm.response.to.have.status(200);", "});", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"id\": \"{{libraryID}}\",\n \"type\": \"libraries\",\n \"meta\": {\n \"action\": \"submit\"\n }\n }\n}" }, "url": { "raw": "{{HOST}}/libraries/{{libraryID}}", "host": [ "{{HOST}}" ], "path": [ "libraries", "{{libraryID}}" ] }, "description": "Submits the library based on libraryID" }, "response": [] }, { "name": "Approve", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Library is approved for production\", function () {", " pm.response.to.have.status(200);", "});", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"id\": \"{{libraryID}}\",\n \"type\": \"libraries\",\n \"meta\": {\n \"action\": \"approve\"\n }\n }\n}" }, "url": { "raw": "{{HOST}}/libraries/{{libraryID}}", "host": [ "{{HOST}}" ], "path": [ "libraries", "{{libraryID}}" ] }, "description": "Approves the library based on libraryID" }, "response": [] }, { "name": "Add to prod Environment", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Library is added to production\", function () {", " pm.response.to.have.status(200);", "});", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"data\": {\n \"id\": \"{{envID_Production}}\",\n \"type\": \"environments\"\n }\n}" }, "url": { "raw": "{{HOST}}/libraries/{{libraryID}}/relationships/environment", "host": [ "{{HOST}}" ], "path": [ "libraries", "{{libraryID}}", "relationships", "environment" ] }, "description": "Adds the library to the production environment based on `libraryID`" }, "response": [] }, { "name": "Publish", "event": [ { "listen": "test", "script": { "exec": [ "var resp = JSON.parse(responseBody);", "", "if(resp.data && resp.data.meta){", " console.log(\"Artifact URL: \" + resp.data.meta.artifact_url);", " pm.environment.set(\"prodArtifactURL\", resp.data.meta.artifact_url);", "}", "", "pm.test(\"Library is published\", function () {", " pm.response.to.have.status(201);", "});", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "bearer {{ACCESS_TOKEN}}", "type": "text" }, { "key": "x-api-key", "value": "{{CLIENT_ID}}", "type": "text" }, { "key": "X-Gw-Ims-Org-Id", "value": "{{ORG_ID}}", "type": "text" }, { "key": "Content-Type", "value": "application/vnd.api+json", "type": "text" }, { "key": "Accept", "value": "application/vnd.api+json;revision=1", "type": "text" } ], "url": { "raw": "{{HOST}}/libraries/{{libraryID}}/builds", "host": [ "{{HOST}}" ], "path": [ "libraries", "{{libraryID}}", "builds" ] }, "description": "Publishes the production library" }, "response": [] } ], "description": "### Run as a Collection Runner\n\n### Required variable: propID\n\n`propID` can be set multiple ways:\n\n* In the Pre-request Script\n \n\n``` javascript\nif (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){\n pm.environment.set(\"propID\",\"PR1234567890QWERTYUIOP\");\n}\n\n```\n\n* As a collection, environment, or global variable\n \n\n`propID = PR1234567890QWERTYUIOP`\n\n* In newman as a\n \n\n``` bash\n--env-var \"propID=PR1234567890QWERTYUIOP\"\n\n```", "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "if (!pm.variables.has(\"propID\") || (pm.variables.get(\"propID\") === \"\")){", " pm.environment.set(\"propID\",\"not-specified\");", "}" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] } ], "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] }