From 6640e08f078a6ca5fd71f2ba28dc6eff32dfd888 Mon Sep 17 00:00:00 2001 From: Jay Wu Date: Thu, 13 Mar 2025 18:57:28 +0800 Subject: [PATCH] Revert "move default templating into a web worker (#8447)" This reverts commit 3385bc5719f107a25af694d07465c5498774d4fe. --- packages/insomnia-inso/src/cli.test.ts | 8 +- packages/insomnia/src/common/har.ts | 2 +- packages/insomnia/src/common/render.ts | 80 +- packages/insomnia/src/common/settings.ts | 1 - packages/insomnia/src/hidden-window.html | 2 +- packages/insomnia/src/index.html | 1 - packages/insomnia/src/main/api.protocol.ts | 8 - .../extractPostmanDataDump.test.ts.snap | 63 + .../src/main/templating-worker-database.ts | 34 - packages/insomnia/src/models/settings.ts | 1 - packages/insomnia/src/network/network.ts | 3 +- .../src/templating/__tests__/utils.test.ts | 9 +- .../src/templating/base-extension-worker.ts | 228 - .../insomnia/src/templating/base-extension.ts | 4 +- packages/insomnia/src/templating/index.ts | 105 +- .../insomnia/src/templating/render-error.ts | 40 - packages/insomnia/src/templating/utils.ts | 21 + packages/insomnia/src/templating/worker.ts | 207 - .../ui/components/codemirror/code-editor.tsx | 4 +- .../codemirror/extensions/nunjucks-tags.ts | 6 +- .../components/codemirror/one-line-editor.tsx | 4 +- .../modals/request-render-error-modal.tsx | 2 +- .../ui/components/panes/grpc-request-pane.tsx | 3 +- .../src/ui/components/settings/plugins.tsx | 14 - .../templating/local-template-tags.ts | 2 +- .../websockets/websocket-request-pane.tsx | 3 +- packages/insomnia/src/ui/routes/actions.tsx | 2 +- packages/insomnia/src/ui/routes/design.tsx | 2 +- packages/insomnia/src/ui/routes/request.tsx | 3 +- packages/insomnia/src/ui/routes/workspace.tsx | 3 +- .../{spectral-handler.ts => spectral-run.ts} | 11 +- .../{spectral-worker.ts => spectral.ts} | 0 .../src/ui/worker/templating-handler.ts | 50 - .../src/ui/worker/templating-worker.ts | 32 - .../__snapshots__/convert.test.ts.snap | 4368 +++++++++++++++++ .../insomnia/src/utils/try-interpolate.ts | 3 +- packages/insomnia/vite.config.ts | 1 - 37 files changed, 4580 insertions(+), 750 deletions(-) delete mode 100644 packages/insomnia/src/main/templating-worker-database.ts delete mode 100644 packages/insomnia/src/templating/base-extension-worker.ts delete mode 100644 packages/insomnia/src/templating/render-error.ts delete mode 100644 packages/insomnia/src/templating/worker.ts rename packages/insomnia/src/ui/worker/{spectral-handler.ts => spectral-run.ts} (81%) rename packages/insomnia/src/ui/worker/{spectral-worker.ts => spectral.ts} (100%) delete mode 100644 packages/insomnia/src/ui/worker/templating-handler.ts delete mode 100644 packages/insomnia/src/ui/worker/templating-worker.ts create mode 100644 packages/insomnia/src/utils/importers/__tests__/__snapshots__/convert.test.ts.snap diff --git a/packages/insomnia-inso/src/cli.test.ts b/packages/insomnia-inso/src/cli.test.ts index c9dd6931ec..9326aef76a 100644 --- a/packages/insomnia-inso/src/cli.test.ts +++ b/packages/insomnia-inso/src/cli.test.ts @@ -1,6 +1,7 @@ import { exec, ExecException } from 'child_process'; import path from 'path'; -import { beforeAll, describe, expect, it } from 'vitest'; +import { describe, expect, it } from 'vitest'; + // Tests both bundle and packaged versions of the CLI with the same commands and expectations. // Intended to be coarse grained (only checks for success or failure) smoke test to ensure packaging worked as expected. @@ -58,10 +59,7 @@ const shouldReturnErrorCode = [ // after-response script and test '$PWD/packages/insomnia-inso/bin/inso run collection -w packages/insomnia-inso/src/examples/after-response-failed-test.yml wrk_616795 --verbose', ]; -beforeAll(async () => { - // ensure the test server is running - await fetch('http://localhost:4010'); -}); + describe('inso dev bundle', () => { describe('exit codes are consistent', () => { it.each(shouldReturnSuccessCode)('exit code should be 0: %p', async input => { diff --git a/packages/insomnia/src/common/har.ts b/packages/insomnia/src/common/har.ts index 734c159f2e..fa6dd3d676 100644 --- a/packages/insomnia/src/common/har.ts +++ b/packages/insomnia/src/common/har.ts @@ -11,7 +11,7 @@ import { isWorkspace, type Workspace } from '../models/workspace'; import { getAuthHeader } from '../network/authentication'; import * as plugins from '../plugins'; import * as pluginContexts from '../plugins/context/index'; -import { RenderError } from '../templating/render-error'; +import { RenderError } from '../templating/index'; import { parseGraphQLReqeustBody } from '../utils/graph-ql'; import { smartEncodeUrl } from '../utils/url/querystring'; import { getAppVersion } from './constants'; diff --git a/packages/insomnia/src/common/render.ts b/packages/insomnia/src/common/render.ts index 357917473d..0f1157fdcb 100644 --- a/packages/insomnia/src/common/render.ts +++ b/packages/insomnia/src/common/render.ts @@ -1,3 +1,4 @@ +import * as Sentry from '@sentry/electron/renderer'; import clone from 'clone'; import orderedJSON from 'json-order'; @@ -12,7 +13,6 @@ import type { WebSocketRequest } from '../models/websocket-request'; import { isWorkspace, type Workspace } from '../models/workspace'; import { getOrInheritAuthentication, getOrInheritHeaders } from '../network/network'; import * as templating from '../templating'; -import { RenderError } from '../templating/render-error'; import * as templatingUtils from '../templating/utils'; import { setDefaultProtocol } from '../utils/url/protocol'; import { CONTENT_TYPE_GRAPHQL, JSON_ORDER_SEPARATOR } from './constants'; @@ -220,7 +220,7 @@ export async function buildRenderContext( if (finalRenderContext[vaultEnvironmentPath]) { if (finalRenderContext[vaultEnvironmentRuntimePath] && typeof finalRenderContext[vaultEnvironmentRuntimePath] !== 'object') { const errorMsg = `${vaultEnvironmentRuntimePath} is a reserved key for insomnia vault, please rename your environment with vault as key.`; - const newError = new RenderError(errorMsg); + const newError = new templating.RenderError(errorMsg); newError.type = 'render'; newError.message = errorMsg; throw newError; @@ -267,13 +267,7 @@ export async function buildRenderContext( return finalRenderContext; } -const renderInThisProcess = async (input: { input: string; context: Record; path: string; ignoreUndefinedEnvVariable: boolean }) => { - return templating.render(input.input, { - context: input.context, - path: input.path, - ignoreUndefinedEnvVariable: input.ignoreUndefinedEnvVariable, - }); -}; + /** * Recursively render any JS object and return a new one * @param {*} obj - object to render @@ -296,12 +290,12 @@ export async function render( const undefinedEnvironmentVariables: string[] = []; - async function next(input: T, path: string, first = false) { + async function next(x: T, path: string, first = false) { if (blacklistPathRegex && path.match(blacklistPathRegex)) { - return input; + return x; } - const asStr = Object.prototype.toString.call(input); + const asStr = Object.prototype.toString.call(x); // Leave these types alone if ( @@ -314,87 +308,71 @@ export async function render( asStr === '[object Undefined]' ) { // Do nothing to these types - } else if (typeof input === 'string') { - const hasNunjucksInterpolationSymbols = input.includes('{{') && input.includes('}}'); - const hasNunjucksCustomTagSymbols = input.includes('{%') && input.includes('%}'); - const hasNunjucksCommentSymbols = input.includes('{#') && input.includes('#}'); - - if (!hasNunjucksInterpolationSymbols && !hasNunjucksCustomTagSymbols && !hasNunjucksCommentSymbols) { - return input; - } - - if (input === '') { - return input; + } else if (typeof x === 'string') { + // Detect if the string contains a require statement + if (/require\s*\(/ig.test(x)) { + console.warn('Short-circuiting `render`; string contains possible "require" invocation:', x); + Sentry.captureException(new Error(`Short-circuiting 'render'; string contains possible "require" invocation: ${x}`)); + return x; } try { - // Some plugins may, at the moment, require unique and intrusive access. Templates exposed by these - // plugins will not function correctly when rendering in a separate process or thread. The user can - // explicitly configure rendering to happen on the same thread/process as the rest of the app, in - // which case it's okay to render locally. - const settings = await models.settings.get(); - const pluginsAllowElevatedAccess = settings?.pluginsAllowElevatedAccess; - const shouldUseWorker = process.type === 'renderer' && pluginsAllowElevatedAccess === false; - const renderFork = shouldUseWorker - ? (await import('../ui/worker/templating-handler')).renderInWorker - : renderInThisProcess; - // @ts-expect-error -- TSCONVERSION - input = await renderFork({ input, context, path, ignoreUndefinedEnvVariable }); + x = await templating.render(x, { context, path, ignoreUndefinedEnvVariable }); // If the variable outputs a tag, render it again. This is a common use // case for environment variables: // {{ foo }} => {% uuid 'v4' %} => dd265685-16a3-4d76-a59c-e8264c16835a // @ts-expect-error -- TSCONVERSION - if (input.includes('{%')) { + if (x.includes('{%')) { // @ts-expect-error -- TSCONVERSION - input = await renderFork({ input, context, path, ignoreUndefinedEnvVariable }); + x = await templating.render(x, { context, path }); } } catch (err) { - console.log(`Failed to render element ${path}`, input); + console.log(`Failed to render element ${path}`, x); if (errorMode !== KEEP_ON_ERROR) { - if (err?.extraInfo?.subType === 'environmentVariable') { + if (err?.extraInfo?.subType === templating.RenderErrorSubType.EnvironmentVariable) { undefinedEnvironmentVariables.push(...err.extraInfo.undefinedEnvironmentVariables); } else { throw err; } } } - } else if (Array.isArray(input)) { - for (let i = 0; i < input.length; i++) { - input[i] = await next(input[i], `${path}[${i}]`); + } else if (Array.isArray(x)) { + for (let i = 0; i < x.length; i++) { + x[i] = await next(x[i], `${path}[${i}]`); } - } else if (typeof input === 'object' && input !== null) { + } else if (typeof x === 'object' && x !== null) { // Don't even try rendering disabled objects // Note, this logic probably shouldn't be here, but w/e for now // @ts-expect-error -- TSCONVERSION - if (input.disabled) { - return input; + if (x.disabled) { + return x; } - const keys = Object.keys(input); + const keys = Object.keys(x); for (const key of keys) { if (first && key.indexOf('_') === 0) { // @ts-expect-error -- mapping unsoundness - input[key] = await next(input[key], path); + x[key] = await next(x[key], path); } else { const pathPrefix = path ? path + '.' : ''; // @ts-expect-error -- mapping unsoundness - input[key] = await next(input[key], `${pathPrefix}${key}`); + x[key] = await next(x[key], `${pathPrefix}${key}`); } } } - return input; + return x; } const renderResult = await next(newObj, name, true); if (undefinedEnvironmentVariables.length > 0) { - const error = new RenderError(`Failed to render environment variables: ${undefinedEnvironmentVariables.join(', ')}`); + const error = new templating.RenderError(`Failed to render environment variables: ${undefinedEnvironmentVariables.join(', ')}`); error.type = 'render'; error.extraInfo = { - subType: 'environmentVariable', + subType: templating.RenderErrorSubType.EnvironmentVariable, undefinedEnvironmentVariables, }; throw error; diff --git a/packages/insomnia/src/common/settings.ts b/packages/insomnia/src/common/settings.ts index 6bff1ece53..f948afa90d 100644 --- a/packages/insomnia/src/common/settings.ts +++ b/packages/insomnia/src/common/settings.ts @@ -137,7 +137,6 @@ export interface Settings { pluginConfig: PluginConfigMap; pluginNodeExtraCerts: string; pluginPath: string; - pluginsAllowElevatedAccess: boolean; preferredHttpVersion: HttpVersion; proxyEnabled: boolean; showPasswords: boolean; diff --git a/packages/insomnia/src/hidden-window.html b/packages/insomnia/src/hidden-window.html index 5634422d1a..698916bdbb 100644 --- a/packages/insomnia/src/hidden-window.html +++ b/packages/insomnia/src/hidden-window.html @@ -4,7 +4,7 @@ Hidden Browser Window diff --git a/packages/insomnia/src/index.html b/packages/insomnia/src/index.html index cda03c76b3..82a08ffcbd 100644 --- a/packages/insomnia/src/index.html +++ b/packages/insomnia/src/index.html @@ -13,7 +13,6 @@ 'self' data: insomnia-event-source: - insomnia-templating-worker-database: https: http: ; diff --git a/packages/insomnia/src/main/api.protocol.ts b/packages/insomnia/src/main/api.protocol.ts index d1265e0152..2b669a6a60 100644 --- a/packages/insomnia/src/main/api.protocol.ts +++ b/packages/insomnia/src/main/api.protocol.ts @@ -1,7 +1,6 @@ import { app, net, protocol } from 'electron'; import { getApiBaseURL } from '../common/constants'; -import { resolveDbByKey } from './templating-worker-database'; export interface RegisterProtocolOptions { scheme: string; @@ -10,7 +9,6 @@ export interface RegisterProtocolOptions { const insomniaStreamScheme = 'insomnia-event-source'; const httpsScheme = 'https'; const httpScheme = 'http'; -const templatingWorkerDatabaseInterface = 'insomnia-templating-worker-database'; export async function registerInsomniaProtocols() { protocol.registerSchemesAsPrivileged([{ @@ -22,9 +20,6 @@ export async function registerInsomniaProtocols() { }, { scheme: httpScheme, privileges: { secure: true, standard: true, supportFetchAPI: true }, - }, { - scheme: templatingWorkerDatabaseInterface, - privileges: { secure: true, standard: true, supportFetchAPI: true }, }]); await app.whenReady(); @@ -48,7 +43,4 @@ export async function registerInsomniaProtocols() { return net.fetch(request, { bypassCustomProtocolHandlers: true }); }); } - if (!protocol.isProtocolHandled(templatingWorkerDatabaseInterface)) { - protocol.handle(templatingWorkerDatabaseInterface, resolveDbByKey); - } } diff --git a/packages/insomnia/src/main/ipc/__tests__/__snapshots__/extractPostmanDataDump.test.ts.snap b/packages/insomnia/src/main/ipc/__tests__/__snapshots__/extractPostmanDataDump.test.ts.snap index dc7dfce72f..317c8b6f01 100644 --- a/packages/insomnia/src/main/ipc/__tests__/__snapshots__/extractPostmanDataDump.test.ts.snap +++ b/packages/insomnia/src/main/ipc/__tests__/__snapshots__/extractPostmanDataDump.test.ts.snap @@ -62,3 +62,66 @@ exports[`Postman data dump extract > should extract collections and envs from po }, } `; + +exports[`extractPostmanDataDump > should extract data from postman dump 1`] = ` +{ + "data": { + "collectionList": [ + { + "contentStr": "{"info":{"_postman_id":"1b09d584-1b98-461b-b51c-25dc11cfbb0c","name":"RESTful API Basics #blueprint","description":"# 🚀 Get started here\\n\\nThis collection guides you through CRUD operations (GET, POST, PUT, DELETE), variables, and tests.\\n\\n## đź”– **How to use this collection**\\n\\n#### **Step 1: Send requests**\\n\\nRESTful APIs allow you to perform CRUD operations using the POST, GET, PUT, and DELETE HTTP methods.\\n\\nThis collection contains each of these request types. Open each request and click \\"Send\\" to see what happens.\\n\\n#### **Step 2: View responses**\\n\\nObserve the response tab for status code (200 OK), response time, and size.\\n\\n#### **Step 3: Send new Body data**\\n\\nUpdate or add new data in \\"Body\\" in the POST request. Typically, Body data is also used in PUT and PATCH requests.\\n\\n\`\`\`\\n{\\n \\"name\\": \\"Add your name in the body\\"\\n}\\n\\n\`\`\`\\n\\n#### **Step 4: Update the variable**\\n\\nVariables enable you to store and reuse values in Postman. We have created a variable called \`base_url\` with the sample request [https://postman-api-learner.glitch.me](https://postman-api-learner.glitch.me). Replace it with your API endpoint to customize this collection.\\n\\n#### **Step 5: Add tests in the \\"Tests\\" tab**\\n\\nTests help you confirm that your API is working as expected. You can write test scripts in JavaScript and view the output in the \\"Test Results\\" tab.\\n\\n\\n\\n## đź’Ş Pro tips\\n\\n- Use folders to group related requests and organize the collection.\\n- Add more scripts in \\"Tests\\" to verify if the API works as expected and execute flows.\\n \\n\\n## ℹ️ Resources\\n\\n[Building requests](https://learning.postman.com/docs/sending-requests/requests/) \\n[Authorizing requests](https://learning.postman.com/docs/sending-requests/authorization/) \\n[Using variables](https://learning.postman.com/docs/sending-requests/variables/) \\n[Managing environments](https://learning.postman.com/docs/sending-requests/managing-environments/) \\n[Writing scripts](https://learning.postman.com/docs/writing-scripts/intro-to-scripts/)","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},"item":[{"name":"Get data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () {"," pm.response.to.have.status(200);","});"],"type":"text/javascript","id":"70cf76a6-2a29-4749-9e45-4ca3879f9b91"}}],"id":"94606561-6f7f-404d-b9bd-aeac5bac0011","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":{"raw":"{{base_url}}/info?id=1","host":["{{base_url}}"],"path":["info"],"query":[{"key":"id","value":"1"}]},"description":"This is a GET request and it is used to \\"get\\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have \`id=1\`).\\n\\nA successful GET response will have a \`200 OK\` status, and should include some kind of response body - for example, HTML web content or JSON data."},"response":[]},{"name":"Post data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Successful POST request\\", function () {"," pm.expect(pm.response.code).to.be.oneOf([200, 201]);","});",""],"type":"text/javascript","id":"fd4c18c5-343e-4988-a733-12199d80eae5"}}],"id":"8bba999c-e3a2-4cbe-8702-71814709bf0d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\\n\\t\\"name\\": \\"Add your name in the body\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{base_url}}/info","host":["{{base_url}}"],"path":["info"]},"description":"This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.\\n\\nA successful POST request typically returns a \`200 OK\` or \`201 Created\` response code."},"response":[]},{"name":"Update data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Successful PUT request\\", function () {"," pm.expect(pm.response.code).to.be.oneOf([200, 201, 204]);","});",""],"type":"text/javascript","id":"1ea19fbf-cb82-4a4f-996a-108b9669854a"}}],"id":"834fbeee-a560-453a-b420-631a3c7a42fb","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\\n\\t\\"name\\": \\"Add your name in the body\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{base_url}}/info?id=1","host":["{{base_url}}"],"path":["info"],"query":[{"key":"id","value":"1"}]},"description":"This is a PUT request and it is used to overwrite an existing piece of data. For instance, after you create an entity with a POST request, you may want to modify that later. You can do that using a PUT request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`).\\n\\nA successful PUT request typically returns a \`200 OK\`, \`201 Created\`, or \`204 No Content\` response code."},"response":[]},{"name":"Delete data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Successful DELETE request\\", function () {"," pm.expect(pm.response.code).to.be.oneOf([200, 202, 204]);","});",""],"type":"text/javascript","id":"88d72790-215f-448d-b571-9da832ba61c1"}}],"id":"619395ec-0fbb-465d-8de9-59015781e185","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":{"raw":"{{base_url}}/info?id=1","host":["{{base_url}}"],"path":["info"],"query":[{"key":"id","value":"1"}]},"description":"This is a DELETE request, and it is used to delete data that was previously created via a POST request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`).\\n\\nA successful DELETE request typically returns a \`200 OK\`, \`202 Accepted\`, or \`204 No Content\` response code."},"response":[]}],"event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":[""],"id":"7b48da4b-9d55-483f-af23-b2c1c0af414d"}},{"listen":"test","script":{"type":"text/javascript","exec":[""],"id":"9a09d2e3-c932-4b5d-826f-80b04b4f1e17"}}],"variable":[{"id":"3d68d495-0a3c-421c-aece-7eed4a12880b","key":"id","value":"1"},{"id":"a2a164a2-36ea-49c9-99be-2b38ca59082e","key":"base_url","value":"https://postman-rest-api-learner.glitch.me/"}]}", + "oriFileName": "1b09d584-1b98-461b-b51c-25dc11cfbb0c.json", + }, + { + "contentStr": "{"info":{"_postman_id":"6c9e3e4a-a00b-44f2-9413-1c5cc8e16a7c","name":"Device Collection","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},"item":[{"name":"Ebiz Account & Device - M1A and WPS Devices","item":[{"name":"Subscription_Creation_MTP_1_Device","event":[{"listen":"test","script":{"exec":["tests[\\"response code is 201\\"] = responseCode.code === 201;\\r","tests[\\"Response Body contains ProvisionId\\"] = responseBody.has(\\"provision_id\\");\\r","\\r"," var responseJson = pm.response.json()\\r"," console.log(\\"Global_Reference_Id\\"+\\" - \\"+responseJson.Global_Reference_Id);\\r","\\r"," pm.environment.set(\\"Global_Reference_Id_MTP_1_Device\\", responseJson.Global_Reference_Id);\\r"," pm.environment.set(\\"Provision_Id_MTP_1_Device\\", responseJson.provision_list[0].provision_id);\\r"," pm.environment.set(\\"Product_Key_MTP_1_Device\\", responseJson.provision_list[0].product_key);\\r"," pm.environment.set(\\"Account_Id_MTP_1_Device\\", responseJson.provision_list[0].account_id);\\r"," pm.environment.set(\\"Exp_Date_MTP_1_Device\\", responseJson.provision_list[0].exp_date);"],"type":"text/javascript","id":"f46f698f-dddf-4ab9-93f2-ba4344a13ed8"}},{"listen":"prerequest","script":{"exec":["var appKey = pm.environment.get(\\"C2C_AppKey\\");\\r","var sharedKey = pm.environment.get(\\"C2C_SharedKey\\");\\r","pm.environment.set(\\"UserEmail_MTP_1_Device\\", pm.variables.replaceIn(\\"Test_{{$timestamp}}@mcafee.com\\"));\\r","var password = \\"Password@123\\";\\r","pm.environment.set(\\"UserPassword_MTP_1_Device\\", password);\\r","pm.environment.set(\\"sw_id\\", pm.variables.replaceIn(\\"{{$guid}}\\"));\\r","pm.environment.set(\\"hw_id\\", pm.variables.replaceIn(\\"{{$guid}}\\"));\\r","\\r",""],"type":"text/javascript","id":"f0fa6c49-e2be-48ad-934c-1d94d84913a7"}}],"id":"ab51cef2-e849-4bb7-931a-62f0d7853aee","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"},{"key":"st","value":"1","type":"text"},{"key":"sv","value":"V1","type":"text"},{"key":"ak","value":"{{C2C_AppKey}}","type":"text"},{"key":"ac","value":"{{ac}}","type":"text"}],"body":{"mode":"raw","raw":"{\\r\\n\\"email_address\\": \\"{{UserEmail_MTP_1_Device}}\\",\\r\\n\\"password\\": \\"{{UserPassword_MTP_1_Device}}\\",\\r\\n\\"culture\\": \\"en-us\\",\\r\\n\\"client_id\\": \\"{{csp_client_id}}\\",\\r\\n\\"is_fake_email\\": false,\\r\\n\\"sku_list\\": [{\\r\\n\\"app_id\\": \\"{{App_ID}}\\",\\r\\n\\"sku\\": \\"0-7018-93492\\",\\r\\n\\"branding_id\\": \\"\\"\\r\\n}]\\r\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{servicediscovery}}/v2/ProductProvision/","host":["{{servicediscovery}}"],"path":["v2","ProductProvision",""]},"description":"API: ActivateRequest\\r\\n\\r\\nSummary: This api is used for creating account, subscription for different products like WSS, SafeConnect etc.\\r\\n\\r\\nIncoming calls:\\r\\n 1. CONS_NEXS_PROD\\r\\n 2. CONS_PLATFORM_ Appapi_PROD\\r\\n 3. CONS_McAfeeMobileSecurity_PROD\\r\\n 4. CONS_CSP_SecurityMgmt_PROD\\r\\n 5. CONS_CSP_CSPToken_OTP_Service_PROD\\r\\n 6. CONS_PLATFORM_PARTNERSVC_PROD\\r\\n\\r\\nDB calls: Ebiz, EbizStats, Provision, MachineTracker\\r\\n\\r\\nExternal calls:\\r\\n 1. CONS_PLATFORM_App_PROD\\r\\n 2. CONS_PLATFORM_PARTNERSVC_PROD\\r\\n 3.\\tCONS_PLATFORM_PlatformSvc_Api_PROD\\r\\n 4.\\tCONS_PLATFORM_PlatformProv_Orch_PROD\\r\\n 5.\\tCONS_PLATFORM_BridgeService_PROD\\r\\n 6.\\tCONS_PLATFORM_BridgeService_PROD\\r\\n 7.\\tCONS_CSP_Basic_Config_Enroll_ServiceDiscovery_PROD\\r\\n 8.\\tCONS_CSP_Cloudlog_Cloudsecurity_PROD\\r\\n 9.\\tCONS_CSP_Contextenroll_PROD\\r\\n 10.\\tCONS_PLATFORM_Prodhome_PROD\\r\\n 11.\\tmcAsyncSvc\\r\\n 12.\\twww.transactonline.de\\r\\n 13.\\tapps.mcafeemobilesecurity.com"},"response":[]},{"name":"Get_Subscriptions_MTP_1_Device","event":[{"listen":"test","script":{"exec":["pm.test(\\"Verify the status code should be 200\\", function () {\\r"," pm.response.to.have.status(200);\\r","});\\r","\\r","pm.test(\\"Verify the response body\\", function () {\\r"," var jsonData = pm.response.json();\\r"," pm.expect(jsonData.Success).to.eql(true);\\r","});\\r","\\r","pm.test(\\"Body matches string\\", function () {\\r"," pm.expect(pm.response.text()).to.include(\\"McAfee® Total Protection - 1 Device\\");\\r","});\\r","\\r"," var responseJson = pm.response.json() \\r"," pm.globals.set(\\"email_MTP_1_device\\",responseJson.email_address);\\r"," pm.globals.set(\\"grid_MTP_1_device\\",responseJson.grid); \\r"," pm.globals.set(\\"acct_id_MTP_1_device\\",responseJson.acct_id); \\r"," pm.environment.set(\\"SubID_MTP_1_device\\",responseJson.provision_list[0].subscription_info.SubId)\\r"," pm.environment.set(\\"Actcode_MTP_1_device\\",responseJson.provision_list[0].activation_code)"],"type":"text/javascript","id":"d4b99749-1b78-4ec9-ac6c-7948c938900a"}},{"listen":"prerequest","script":{"exec":["var appKey = pm.environment.get(\\"C2C_AppKey\\");\\r","var sharedKey = pm.environment.get(\\"C2C_SharedKey\\");\\r","pm.environment.set(\\"UserEmail_MTP_1_Device\\", pm.variables.replaceIn(\\"Test_{{$timestamp}}@mcafee.com\\"));\\r","var password = \\"Password@123\\";\\r","pm.environment.set(\\"UserPassword_MTP_1_Device\\", password);\\r","pm.environment.set(\\"sw_id\\", pm.variables.replaceIn(\\"{{$guid}}\\"));\\r","pm.environment.set(\\"hw_id\\", pm.variables.replaceIn(\\"{{$guid}}\\"));\\r","\\r",""],"type":"text/javascript","id":"0d6990e3-6a7b-4050-bb51-a7e76daf5a6e"}}],"id":"6434724b-add0-4de1-a83b-d89d15f43883","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"ac","value":"{{ac}}","type":"text"},{"key":"ak","value":"{{CSI_AppKey}}","type":"text"},{"key":"cd","value":"{{cd}}","type":"text"},{"key":"st","value":"1","type":"text"},{"key":"sv","value":"V1","type":"text"}],"body":{"mode":"raw","raw":"{\\r\\n \\"app_id\\": \\"{{App_ID}}\\",\\r\\n \\"type\\": \\"Provision\\",\\r\\n \\"provision_id\\": \\"{{Provision_Id_MTP_1_Device}}\\",\\r\\n \\"Include_All_Subs\\": true\\r\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{servicediscovery}}/v2/ProductProvision/GetSubscriptions","host":["{{servicediscovery}}"],"path":["v2","ProductProvision","GetSubscriptions"]}},"response":[]},{"name":"Get_Serial_Number_MTP_1_Device","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () {\\r"," pm.response.to.have.status(200);\\r","});\\r","\\r"," var responseJson = pm.response.json() \\r","\\t\\t\\tpm.environment.set(\\"SerialNumber_MTP_1_device\\",responseJson.SerialNumber)\\r","\\t\\t\\tpm.environment.set(\\"EncryptSerialNumber_MTP_1_device\\",responseJson.EncryptSerialNumber)\\r"," pm.environment.set(\\"ProductKey_MTP_1_device\\",responseJson.ProductKey)\\r"," pm.environment.set(\\"AcctId_MTP_1_device\\",responseJson.Account.AcctId)\\r"," "],"type":"text/javascript","id":"f6a5a501-3a7e-43f3-b99f-047ac97028b2"}},{"listen":"prerequest","script":{"exec":["var appKey = pm.environment.get(\\"C2C_AppKey\\");","var sharedKey = pm.environment.get(\\"C2C_SharedKey\\");","pm.environment.set(\\"UserEmail_MTP_1_Device\\", pm.variables.replaceIn(\\"Test_{{$timestamp}}@mcafee.com\\"));","var password = \\"Password@123\\";","pm.environment.set(\\"UserPassword_MTP_1_Device\\", password);","pm.environment.set(\\"sw_id\\", pm.variables.replaceIn(\\"{{$guid}}\\"));","pm.environment.set(\\"hw_id\\", pm.variables.replaceIn(\\"{{$guid}}\\"));","",""],"type":"text/javascript","id":"ac2c2eac-d0a7-47e7-9473-2661ff0e4158"}}],"id":"dfb3253f-fea7-4be4-9164-997c480486af","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"},{"key":"st","value":"3","type":"text"},{"key":"sv","value":"V1","type":"text"},{"key":"ak","value":"{{pps_app_key}}","type":"text"},{"key":"ac","value":"{{ac}}","type":"text","disabled":true}],"body":{"mode":"raw","raw":"{\\r\\n \\"EbizSubId\\": {{SubID_MTP_1_device}},\\r\\n \\"DeviceType\\": \\"PC\\"\\r\\n} \\r\\n \\r\\n","options":{"raw":{"language":"json"}}},"url":{"raw":"{{servicediscovery}}/v2/ProductProvisionV2/AddDeviceSerialNumberBySubId?subscriptionId={{SubID_MTP_1_device}}","host":["{{servicediscovery}}"],"path":["v2","ProductProvisionV2","AddDeviceSerialNumberBySubId"],"query":[{"key":"subscriptionId","value":"{{SubID_MTP_1_device}}"}]}},"response":[]},{"name":"{{account-orch}}/v2/accounts/search - get userRefId","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"response schema\\", function () { "," const responseData = pm.response.json();"," pm.environment.set(\\"ebiz_userRefId\\", responseData.data[0].userRefId); "," // pm.expect(responseData.data[0].subRefId).to.eq(\\"required fields are missing\\");"," "," ","});",""],"type":"text/javascript","id":"7344bd01-e480-4a3a-81f4-d89132c35105"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"3e811fdf-48b9-4ad2-9016-f36214f2c7c6"}}],"id":"fd111a98-dad4-4a97-9c17-c5bf6c2efdc2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"globalRefId\\": \\"{{globalReferenceId}}\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{account-orch}}/v2/accounts/search","host":["{{account-orch}}"],"path":["v2","accounts","search"],"query":[{"key":"subRefId","value":"{{provision_id}}","disabled":true}]}},"response":[]},{"name":"Account status to Active","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","","",""],"type":"text/javascript","id":"d77b703f-f697-45fb-bf1b-c4d90fb807b1"}},{"listen":"prerequest","script":{"exec":["var appKey = pm.environment.get(\\"C2C_AppKey\\");","var sharedKey = pm.environment.get(\\"C2C_SharedKey\\");","pm.environment.set(\\"UserEmail_MTP_1_Device\\", pm.variables.replaceIn(\\"Test_{{$timestamp}}@mcafee.com\\"));","var password = \\"Password@123\\";","pm.environment.set(\\"UserPassword_MTP_1_Device\\", password);","pm.environment.set(\\"sw_id\\", pm.variables.replaceIn(\\"{{$guid}}\\"));","pm.environment.set(\\"hw_id\\", pm.variables.replaceIn(\\"{{$guid}}\\"));","",""],"type":"text/javascript","id":"ea9debe7-ce7a-4c62-b808-b827182556a1"}}],"id":"2a36bbe2-5ddd-4cbb-bd8d-b37139418189","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"},{"key":"","value":"Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImNNVGRoZHp4cV83UEhyaGNpRWprNyJ9.eyJpc3MiOiJodHRwczovL2lkcWEubWNhZmVlLmNvbS8iLCJzdWIiOiJOekxyenc1blE5NE0xT0hQejRlS3VKTm0yNHNyMVcxdkBjbGllbnRzIiwiYXVkIjoiaHR0cHM6Ly9zZXJ2aWNlYXBpLm1jYWZlZS5jb20iLCJpYXQiOjE2ODk1OTU2MjAsImV4cCI6MTY4OTY4MjAyMCwiYXpwIjoiTnpMcnp3NW5ROTRNMU9IUHo0ZUt1Sk5tMjRzcjFXMXYiLCJzY29wZSI6ImFjY291bnQ6ZnVsbCBzdWJzY3JpcHRpb246ZnVsbCBvcmRlcjpmdWxsIGNhdGFsb2c6ZnVsbCBlZndwdWJsaXNoZXI6d3JpdGUiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.rNEEzKN2mn1zf0l0yDQmydtQGKdGU80AbOhPXlBkxFWchjorFjrq8EfGfcibb7eemDVZ2x0u50lG4AvYA9KLYJc3h-kLHW2sjMgdzw5VedIu7rSe7nRMoIl8LeF1I63FIYc2eLd3jnJvHGVhyAIP6eOEgMQxLlhTNOfpWI1Q5HgR5a-ZVPCpwNP8V7gbtQrwttCGCyIPEiq9_T5Jhl54p6vIdlSnsNY6K8lqwc8EZsGocLjAKZuleZoFMRnM5bmjVfv5vGd1nASqy_DGNIJ5OQI7KeeeS3YHpXp3kesFSKTVa9CvkSEsufjYXob6QI3jN21Leh8zvVLg5lCmSBnmmg","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"status\\": \\"ACTIVE\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{servicediscovery}}/v1/users/{{ebiz_userRefId}}","host":["{{servicediscovery}}"],"path":["v1","users","{{ebiz_userRefId}}"],"query":[{"key":"subRefId","value":"{{tn_subRefId}}","disabled":true}]}},"response":[]},{"name":"without devices - v1/device-activations by userRefId","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"response schema validation\\", function () { "," pm.expect(pm.response.json().data.userRefId).to.be.a(\\"string\\", \\"userRefId\\");"," pm.expect(pm.response.json().data.accountRefId).to.be.a(\\"string\\", \\"accountRefId\\");"," pm.expect(pm.response.json().data.activationDevices).to.be.a(\\"array\\", \\"activationDevices\\");",""," pm.expect(pm.response.json().data.activationDevices.length).to.eq(0, \\"activationDevices array length should be 0\\");","","});","",""],"type":"text/javascript","id":"ef91430f-2c84-4993-82e4-ebd9a8558ef2"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"2429da83-d25a-4816-82f4-680728ca3018"}}],"id":"b4654078-55e5-4cb2-ae9a-3c3d317edb9c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"},{"key":"","value":"Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImNNVGRoZHp4cV83UEhyaGNpRWprNyJ9.eyJpc3MiOiJodHRwczovL2lkcWEubWNhZmVlLmNvbS8iLCJzdWIiOiJOekxyenc1blE5NE0xT0hQejRlS3VKTm0yNHNyMVcxdkBjbGllbnRzIiwiYXVkIjoiaHR0cHM6Ly9zZXJ2aWNlYXBpLm1jYWZlZS5jb20iLCJpYXQiOjE2ODk1OTU2MjAsImV4cCI6MTY4OTY4MjAyMCwiYXpwIjoiTnpMcnp3NW5ROTRNMU9IUHo0ZUt1Sk5tMjRzcjFXMXYiLCJzY29wZSI6ImFjY291bnQ6ZnVsbCBzdWJzY3JpcHRpb246ZnVsbCBvcmRlcjpmdWxsIGNhdGFsb2c6ZnVsbCBlZndwdWJsaXNoZXI6d3JpdGUiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.rNEEzKN2mn1zf0l0yDQmydtQGKdGU80AbOhPXlBkxFWchjorFjrq8EfGfcibb7eemDVZ2x0u50lG4AvYA9KLYJc3h-kLHW2sjMgdzw5VedIu7rSe7nRMoIl8LeF1I63FIYc2eLd3jnJvHGVhyAIP6eOEgMQxLlhTNOfpWI1Q5HgR5a-ZVPCpwNP8V7gbtQrwttCGCyIPEiq9_T5Jhl54p6vIdlSnsNY6K8lqwc8EZsGocLjAKZuleZoFMRnM5bmjVfv5vGd1nASqy_DGNIJ5OQI7KeeeS3YHpXp3kesFSKTVa9CvkSEsufjYXob6QI3jN21Leh8zvVLg5lCmSBnmmg","type":"text"}],"url":{"raw":"{{device-orch}}/v1/device-activations?userRefId={{ebiz_userRefId}}","host":["{{device-orch}}"],"path":["v1","device-activations"],"query":[{"key":"userRefId","value":"{{ebiz_userRefId}}"},{"key":"subRefId","value":"{{tn_subRefId}}","disabled":true}]}},"response":[]},{"name":"without devices - v2/device-activations by userRefId","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"response schema validation\\", function () { "," "," pm.expect(pm.response.json().data.length).to.eq(0, \\"data array length should be 0\\");","","});","",""],"type":"text/javascript","id":"68902be3-60cd-4de2-831a-48e27dcc6c3d"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"6cf79e45-49b9-49e2-9fc3-1c5593ae0ef4"}}],"id":"10e1ec58-e441-4c50-b52d-1002e73d96bc","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{ebiz_userRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{ebiz_userRefId}}"},{"key":"subRefId","value":"{{tn_subRefId}}","disabled":true}]}},"response":[]},{"name":"without devices - v1/device-activations by userRefId subrefId","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"response schema validation\\", function () { "," pm.expect(pm.response.json().data.userRefId).to.be.a(\\"string\\", \\"userRefId\\");"," pm.expect(pm.response.json().data.accountRefId).to.be.a(\\"string\\", \\"accountRefId\\");"," pm.expect(pm.response.json().data.activationDevices).to.be.a(\\"array\\", \\"activationDevices\\");",""," pm.expect(pm.response.json().data.activationDevices.length).to.eq(0, \\"activationDevices array length should be 0\\");","","});","",""],"type":"text/javascript","id":"ca1fad76-c023-4345-b81f-245f764c2718"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"c9b4abf4-bb1e-4060-9fcd-52e816e86bc6"}}],"id":"34a7a056-e2e0-4ab1-9288-8695c5b895b8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v1/device-activations?userRefId={{ebiz_userRefId}}&subRefId={{provision_id}}","host":["{{device-orch}}"],"path":["v1","device-activations"],"query":[{"key":"userRefId","value":"{{ebiz_userRefId}}"},{"key":"subRefId","value":"{{provision_id}}"}]}},"response":[]},{"name":"without devices - v1/device-activations by subrefId","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 400\\", function () { "," pm.expect(pm.response.code).to.eq(400);","});","","pm.test(\\"response schema validation\\", function () { "," pm.expect(pm.response.json().errors[0].reason).to.eq(\\"userRefId is required\\");"," "," ","","});","",""],"type":"text/javascript","id":"aa9d79b4-ba63-4c03-bd3a-7ca5d02637b3"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"da4f5b6d-e7aa-48ab-b038-5f5f96e2645a"}}],"id":"ce7a1647-a158-425e-b873-b175f54e0b2b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v1/device-activations?subRefId={{provision_id}}","host":["{{device-orch}}"],"path":["v1","device-activations"],"query":[{"key":"userRefId","value":"{{ebiz_userRefId}}","disabled":true},{"key":"subRefId","value":"{{provision_id}}"}]}},"response":[]},{"name":"without devices - v2/device-activations by userRefId subrefId","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"response schema validation\\", function () { "," "," pm.expect(pm.response.json().data.length).to.eq(0, \\"data array length should be 0\\");","","});","",""],"type":"text/javascript","id":"76a002d5-1271-4b40-aac1-7d44b0f2977b"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"53b591de-0f32-4bfb-a869-e017f25c976b"}}],"id":"95677e2e-be4b-4673-a6d0-a992669748cb","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{ebiz_userRefId}}&subRefId={{provision_id}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{ebiz_userRefId}}"},{"key":"subRefId","value":"{{provision_id}}"}]}},"response":[]},{"name":"without devices - v2/device-activations by subrefId","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"response schema validation\\", function () { "," "," pm.expect(pm.response.json().data.length).to.eq(0, \\"data array length should be 0\\");","","});","",""],"type":"text/javascript","id":"0b62a968-ff22-4603-8195-fe6786bd78fb"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"a50a156b-9902-4ad0-bfc1-ab56252af22a"}}],"id":"a898c114-e202-45d4-ad56-e0fb8db5b3e0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?subRefId={{provision_id}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{ebiz_userRefId}}","disabled":true},{"key":"subRefId","value":"{{provision_id}}"}]}},"response":[]},{"name":"Add Devcie-EBIZ-M1A-Mobile","event":[{"listen":"test","script":{"exec":["var responseJson = pm.response.json()","pm.globals.set(\\"ebiz_device_id_mobile\\",responseJson.device_id);"],"type":"text/javascript","id":"49c61dce-56e9-47dd-909c-29e14f35aa1c"}}],"id":"a9523f51-cdd2-49e2-801d-ff2f1454a065","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-McAfee-Agent","value":"M1A"},{"key":"X-McAfee-Agent-OS","value":"Android"},{"key":"Authorization","value":"Bearer {{access_token}}"},{"key":"Content-Type","value":"application/json"},{"key":"Cookie","value":"HPrst=loc=&rm=iq5nNK-ISQc78yUmSkAv9A2; ADRUM_BT=R:0|i:2118875|g:1f966472-35cd-4c1b-9a09-4b9a565beb261495|e:1391|s:f|n:mcafee-test_2835d011-e415-4bd4-bf96-d6820720dcdf"}],"body":{"mode":"raw","raw":"{\\n \\"device_name\\": \\"EinsteinPhone\\",\\n \\"device_type\\": \\"phone\\",\\n \\"device_os\\": \\"iOS\\",\\n \\"device_os_version\\": \\"5.0.1\\",\\n \\"app_install_status\\": \\"install\\",\\n \\"device_model\\": \\"Samsung GT-S5830L\\",\\n \\"device_brand_name\\": \\"Samsung\\",\\n \\"locale\\": \\"en-US\\",\\n \\"device_hardware_id\\": \\"2b22062f-ac5d-4855-8b67-87f271bebaee\\",\\n \\"device_number\\": \\"2b22062f-ac5d-4855-8b67-87f271bebaee\\", \\n \\"app_version\\": \\"7.7.0.0\\",\\n \\"app_install_date\\": \\"2022-06-23T00:00:00\\",\\n \\"eula_accept_date\\": \\"2022-10-23T00:00:00\\",\\n \\"device_memory\\": \\"300 MB\\",\\n \\"oobe_data\\": {\\n \\"sub_status\\": \\"Trial-Active\\",\\n \\"culture\\": \\"EN-US\\",\\n \\"aff_id\\": \\"0\\",\\n \\"plan\\": \\"Trial\\",\\n \\"pkg_id\\": \\"443\\",\\n \\"lcid\\": \\"1033\\",\\n \\"sku\\": \\"0-7323-103590\\",\\n \\"pkg_name\\": \\"McAfee® LiveSafe™\\",\\n \\"exp_date\\": \\"2023-10-23T00:00:00\\",\\n \\"email\\": \\"{{email_MTP_1_device}}\\",\\n \\"mobilenumber\\": \\"8888765498\\",\\n \\"provision_id\\": \\"{{provision_id}}\\",\\n \\"account_id\\": \\"{{acct_id_MTP_1_device}}\\",\\n \\"product_key\\": \\"AC5D6E9C-F6CD-4A84-A7E3-EB3F24A3DB24\\",\\n \\"Global_Reference_Id\\": \\"{{grid_MTP_1_device}}\\",\\n \\"productprovisionstate\\": \\"provision_complete\\"\\n },\\n \\"preinstall_data\\": {\\n \\"Mylocation\\": \\"off\\",\\n \\"user_test\\": \\"ab test Einstein\\"\\n }\\n}"},"url":{"raw":"{{einstein_url}}/apps/v1/devices","host":["{{einstein_url}}"],"path":["apps","v1","devices"]}},"response":[]},{"name":"Add Devcie-EBIZ-WPS-windows","event":[{"listen":"test","script":{"exec":["var responseJson = pm.response.json()","pm.globals.set(\\"ebiz_device_id_pc\\",responseJson.device_id);"],"type":"text/javascript","id":"07e20a29-7ec9-4aa5-8469-cce27ed06508"}}],"id":"68bd417e-e000-4d66-be7b-1cc570ed7d50","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-McAfee-Agent","value":"WPS"},{"key":"X-McAfee-Agent-OS","value":"Windows"},{"key":"Authorization","value":"Bearer {{access_token}}"},{"key":"Content-Type","value":"application/json"},{"key":"Cookie","value":"HPrst=loc=&rm=iq5nNK-ISQc78yUmSkAv9A2; ADRUM_BT=R:0|i:2118875|g:1f966472-35cd-4c1b-9a09-4b9a565beb261495|e:1391|s:f|n:mcafee-test_2835d011-e415-4bd4-bf96-d6820720dcdf"}],"body":{"mode":"raw","raw":"{\\n \\"device_name\\": \\"DESKTOP-QP1NA0T\\",\\n \\"device_type\\": \\"pc\\",\\n \\"device_os\\": \\"WINDOWS\\",\\n \\"device_os_version\\": \\"10.0.22621\\",\\n \\"app_install_status\\": \\"install\\",\\n \\"device_model\\": \\"VMware7,1\\",\\n \\"device_brand_name\\": \\"VMware, Inc.\\",\\n \\"locale\\": \\"en-US\\",\\n \\"device_hardware_id\\": \\"2b22062f-ac5d-4855-8b67-87f271bebaee\\",\\n \\"device_number\\": \\"2b22062f-ac5d-4855-8b67-87f271bebaee\\",\\n \\"product_market_name\\": \\"16.0 R111\\",\\n \\"app_install_date\\": \\"2022-06-23T00:00:00\\",\\n \\"eula_accept_date\\": \\"2022-10-23T00:00:00\\",\\n \\"device_memory\\": \\"300 MB\\",\\n \\"oobe_data\\": {\\n \\"sub_status\\": \\"Trial-Active\\",\\n \\"culture\\": \\"EN-US\\",\\n \\"aff_id\\": \\"0\\",\\n \\"plan\\": \\"Trial\\",\\n \\"pkg_id\\": \\"443\\",\\n \\"lcid\\": \\"1033\\",\\n \\"sku\\": \\"0-7323-103590\\",\\n \\"pkg_name\\": \\"McAfee® LiveSafe™\\",\\n \\"exp_date\\": \\"2023-10-23T00:00:00\\",\\n \\"email\\": \\"{{email_MTP_1_device}}\\",\\n \\"mobilenumber\\": \\"8888765498\\",\\n \\"provision_id\\": \\"{{provision_id}}\\",\\n \\"account_id\\": \\"{{acct_id_MTP_1_device}}\\",\\n \\"product_key\\": \\"AC5D6E9C-F6CD-4A84-A7E3-EB3F24A3DB24\\",\\n \\"Global_Reference_Id\\": \\"{{grid_MTP_1_device}}\\",\\n \\"productprovisionstate\\": \\"provision_complete\\"\\n },\\n \\"preinstall_data\\": {\\n \\"Mylocation\\": \\"off\\",\\n \\"user_test\\": \\"ab test Einstein\\"\\n }\\n}"},"url":{"raw":"{{einstein_url}}/apps/v1/devices","host":["{{einstein_url}}"],"path":["apps","v1","devices"]}},"response":[]},{"name":"success-ebiz-M1A-device","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 201\\", function () { "," pm.expect(pm.response.code).to.eq(201);"," const Request = JSON.parse(pm.request.body.raw);"," // pm.environment.set(\\"userRefId_tn\\", Request.userRefId);","});"],"type":"text/javascript","id":"3f6b8894-cb51-4679-b1da-cd5da95cd270"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"6804cefc-321f-4fa7-8d62-c71d98b5d723"}}],"id":"35efd46c-15cd-4793-88fb-1c315bb9cf9f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"deviceRefId\\": \\"{{ebiz_device_id_mobile}}\\",\\n \\"subRefId\\": \\"{{provision_id}}\\",\\n \\"userRefId\\": \\"{{globalReferenceId}}\\",\\n \\"activationTime\\": {{activationTime}},\\n \\"activationStatus\\": \\"ACTIVATED\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v1/device-activations","host":["{{device-orch}}"],"path":["v1","device-activations"]}},"response":[]},{"name":"success-ebiz-windows-device","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 201\\", function () { "," pm.expect(pm.response.code).to.eq(201);"," const Request = JSON.parse(pm.request.body.raw);"," // pm.environment.set(\\"userRefId_tn\\", Request.userRefId);","});"],"type":"text/javascript","id":"2d78fe1a-cace-4f5a-9472-dab5f4d2fa80"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"26be6e8a-c19b-49fb-bfcf-4c458f84f28b"}}],"id":"3f22c958-b7b0-4907-83bb-b6b36083aad4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"deviceRefId\\": \\"{{ebiz_device_id_pc}}\\",\\n \\"subRefId\\": \\"{{provision_id}}\\",\\n \\"userRefId\\": \\"{{globalReferenceId}}\\",\\n \\"activationTime\\": {{activationTime}},\\n \\"activationStatus\\": \\"ACTIVATED\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v1/device-activations","host":["{{device-orch}}"],"path":["v1","device-activations"]}},"response":[]}],"id":"ef2e8a2b-460c-4fd8-ac53-bc7f435dcfdb"},{"name":"TN Account & Device - M1A and WPS Devices - V2","item":[{"name":"create-tn-subscripiton-device-activate","item":[{"name":"Create Account","event":[{"listen":"test","script":{"exec":["pm.environment.set(\\"created_user_ref_id\\", pm.response.json().data.userRefID)","pm.environment.set(\\"globalRefID\\", pm.response.json().data.globalRefID)"],"type":"text/javascript","id":"cddf1ea2-4f9d-4aae-82c9-7423634be98d"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"e22a32a8-af0c-4010-9da0-5b1001988fc6"}}],"id":"1f50a950-a5b9-416e-90c6-2e7564b055e7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\r\\n \\"firstName\\": \\"{{$randomFirstName}}\\",\\r\\n \\"middleName\\": \\"Robert\\",\\r\\n \\"lastName\\": \\"{{$randomLastName}}\\",\\r\\n \\"accountName\\": \\"John\\",\\r\\n \\"emailAddress\\": \\"{{$randomEmail}}\\",\\r\\n \\"phoneNumber\\": \\"+7098764322\\",\\r\\n \\"userOptins\\": [\\r\\n 1\\r\\n ],\\r\\n \\"countryCode\\": \\"{{$randomCountryCode}}\\",\\r\\n \\"gender\\": \\"male\\",\\r\\n \\"password\\": \\"mypas@!#1sword\\",\\r\\n \\"passwordType\\": \\"AutoCreated\\",\\r\\n \\"accountType\\": \\"PERSONAL\\"\\r\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{account-func}}/v1/register","host":["{{account-func}}"],"path":["v1","register"]}},"response":[]},{"name":"Create Order","event":[{"listen":"test","script":{"exec":["","pm.test(\\"Status code is 201\\", function () {"," pm.response.to.have.status(201);"," pm.globals.set(\\"orderRefIdcreate\\", pm.response.json().data.orderRefId);"," console.log(\\"orderRefIdcreate generated is \\" + pm.globals.get(\\"orderRefIdcreate\\"));","});","","","","var bodydata = JSON.parse(pm.request.body.raw) ","","console.log(bodydata.channelRefId)","","pm.globals.set(\\"channelRefIdcreate\\", bodydata.channelRefId);","","pm.test(\\"Verify Response Json - Basic\\", function () {"," var jsonResData = pm.response.json(); "," var bodydata = JSON.parse(pm.request.body.raw) "," pm.globals.set(\\"postBodyData\\", bodydata);"," pm.expect(jsonResData.data.cultureCode).to.eq(bodydata.cultureCode); "," pm.expect(jsonResData.data.cultureCode).to.be.a(\\"string\\"); "," pm.expect(jsonResData.data.orderStatus).to.eq(\\"INITIATED\\"); "," pm.expect(jsonResData.data.orderStatus).to.be.a(\\"string\\"); "," pm.expect(jsonResData.data.orderItems.count()).to.eq(bodydata.orderItems.count());"," pm.expect(jsonResData.data.orderItems[0].planCode).to.eq(bodydata.orderItems[0].planCode); "," pm.expect(jsonResData.data.orderItems[0].planCode).to.be.a(\\"string\\");"," pm.expect(jsonResData.data.orderItems[0].planClientCode).to.eq(\\"666_1YEAR_BASE_PAID_AR\\"); "," pm.expect(jsonResData.data.orderItems[0].planClientCode).to.be.a(\\"string\\"); ","});","","pm.test(\\"Response Schema Validation\\", function () {"," pm.expect(pm.response.json().data.orderRefId).to.be.a(\\"string\\", \\"orderRefId\\");"," pm.expect(pm.response.json().data.orderCode).to.be.a(\\"string\\", \\"orderCode\\");"," pm.expect(pm.response.json().data.transactionSource).to.be.a(\\"string\\", \\"transactionSource\\");"," pm.expect(pm.response.json().data.cultureCode).to.be.a(\\"string\\", \\"cultureCode\\");"," pm.expect(pm.response.json().data.orderStatus).to.be.a(\\"string\\", \\"orderStatus\\");"," pm.expect(pm.response.json().data.orderItems).to.be.a(\\"array\\", \\"orderItems\\");"," pm.expect(pm.response.json().data.orderItems[0].id).to.be.a(\\"string\\", \\"id\\");"," pm.expect(pm.response.json().data.orderItems[0].planCode).to.be.a(\\"string\\", \\"planCode\\");"," pm.expect(pm.response.json().data.orderItems[0].planClientCode).to.be.a(\\"string\\", \\"planClientCode\\");"," ","});"],"type":"text/javascript","id":"afa6b4e3-7690-458f-a3ae-4771cc4c917d"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"d61e0943-7194-4388-b82b-81f5a2f53332"}}],"id":"fa3572eb-ee12-48b8-a9a5-0777f8fcc87a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"userRefId\\": \\"{{created_user_ref_id}}\\",\\n \\"channelRefId\\": \\"{{channelRefId}}\\",\\n \\"countryCode\\": \\"US\\",\\n \\"currencyCode\\": \\"{{currencyCode}}\\",\\n \\"cultureCode\\": \\"{{cultureCode}}\\",\\n \\"walletId\\": \\"{{walletId}}\\",\\n \\"promoCode\\": \\"{{promoCode}}\\",\\n \\"taxRefId\\": \\"{{taxRefId}}\\",\\n \\"orderItems\\": [\\n {\\n \\"action\\": \\"CREATE\\",\\n \\"planCode\\": \\"{{planCode}}\\",\\n \\"subRefId\\": \\"\\",\\n \\"offerId\\": \\"{{offerId}}\\",\\n \\"qty\\": 1,\\n \\"msrp\\": 110,\\n \\"tax\\": 9.25,\\n \\"taxRefId\\": \\"{{orderItemstaxRefId}}\\",\\n \\"discount\\": 20,\\n \\"netPayment\\": 100,\\n \\"currencyCode\\": \\"{{currencyCode}}\\",\\n \\"autoRenew\\": true,\\n \\"cultureCode\\": \\"{{cultureCode}}\\",\\n \\"daysToExtend\\": 100,\\n \\"instrumentCategory\\": \\"{{instrumentCategory}}\\",\\n \\"instrumentKey\\": \\"{{instrumentKey}}\\"\\n }\\n ],\\n \\"taxCountryCode\\": \\"US\\",\\n \\"vatRate\\": 0.0925,\\n \\"vatNumber\\": \\"P&G-851223_B24\\",\\n \\"msrp\\": 110,\\n \\"discount\\": 20,\\n \\"netPayment\\": 100,\\n \\"tax\\": 9.25\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{order-orch}}/v2/orders","host":["{{order-orch}}"],"path":["v2","orders"]}},"response":[]},{"name":"Create Subscription","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () {"," pm.response.to.have.status(200);","});","","pm.environment.set(\\"tn_subRefId\\", pm.response.json().data.subscriptions[0].id);","pm.environment.set(\\"tn_userRefId\\", pm.response.json().data.userRefId);","","",""],"type":"text/javascript","id":"ca90aef3-f8d1-4fbb-ab0a-1ac9602002a4"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"967a13ea-5c48-49fc-9543-6772e34b95cd"}}],"id":"6b31c465-53d3-4803-b5f3-2d2080d3fca5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"orderStatus\\": \\"FULFILLED\\",\\n \\"paymentRefId\\": \\"cfc51df9-f0b6-4aee-9fbd-5922f3ca548c\\",\\n \\"autoRenew\\": false\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{order-orch}}/v2/orders/{{orderRefIdcreate}}","host":["{{order-orch}}"],"path":["v2","orders","{{orderRefIdcreate}}"]}},"response":[]},{"name":"Device Installation - Mobile - IOS","event":[{"listen":"prerequest","script":{"exec":["var d1= new Date(Date.now()); installedTime=Math.floor(d1.getTime());\\r","pm.environment.set(\\"installedTime\\",installedTime);\\r","var platformUniqueId = pm.variables.replaceIn(\\"{{$guid}}\\");\\r","pm.environment.set(\\"platformUniqueId\\",platformUniqueId);\\r","var deviceName = pm.variables.replaceIn(\\"{{$randomUserName}}\\");\\r","pm.environment.set(\\"deviceName\\",deviceName);\\r","\\r","var Countrucode = pm.variables.replaceIn(\\"{{$randomCountryCode}}\\");\\r","pm.environment.set(\\"Countrucode\\", Countrucode);\\r","const Array_1 = [\\"Tablet\\",\\"PC\\",\\"Mobile\\"];\\r","var qty1 = _.random(0, 2);\\r","//pm.variables.set(\\"qty\\", qty1);\\r","console.log(\\"qty\\"+qty1);\\r","console.log(\\"array_1\\"+Array_1[qty1]);\\r","if(Array_1[qty1]===\\"Tablet\\")\\r","{\\r"," pm.environment.set(\\"type\\",\\"Tablet\\")\\r"," const Array_2 = [\\"IOS\\",\\"Android\\"];\\r"," var qty2 = _.random(0, 1);\\r"," console.log(\\"qty\\"+qty2);\\r"," console.log(\\"array_2\\"+Array_2[qty2]);\\r"," if(Array_2[qty2]===\\"IOS\\")\\r"," {\\r"," console.log(\\"IOS\\");\\r"," pm.environment.set(\\"platform\\", \\"IOS\\");\\r"," pm.environment.set(\\"platformVersion\\", \\"IPadOS 15.3.1\\");\\r"," pm.environment.set(\\"manufacturerModel\\", \\"Apple A10\\");\\r"," pm.environment.set(\\"manufacturerName\\", \\"Apple\\");\\r"," }\\r"," else\\r"," {\\r"," console.log(\\"Android\\");\\r"," pm.environment.set(\\"platform\\", \\"Android\\");\\r"," pm.environment.set(\\"platformVersion\\", \\"android- 3.1.225.0\\");\\r"," pm.environment.set(\\"manufacturerModel\\", \\"Samsung GT-S5830L\\");\\r"," pm.environment.set(\\"manufacturerName\\", \\"Samsung\\");\\r"," }\\r","\\r","}\\r","else if(Array_1[qty1]===\\"PC\\")\\r","{\\r"," console.log(\\"++++++++++++++++\\")\\r"," pm.environment.set(\\"type\\",\\"PC\\")\\r"," pm.environment.set(\\"platform\\", \\"Windows\\");\\r"," pm.environment.set(\\"platformVersion\\", \\"Windows- 3.1.225.0\\");\\r"," pm.environment.set(\\"manufacturerModel\\", \\"Windows GT-S5830L\\");\\r"," pm.environment.set(\\"manufacturerName\\", \\"Windows\\");\\r","}\\r","else\\r","{\\r"," console.log(\\"---------------------------\\")\\r"," pm.environment.set(\\"type\\",\\"Mobile\\")\\r"," const Array_3 = [\\"IOS\\",\\"Android\\"];\\r"," var qty3 = _.random(0, 1);\\r"," console.log(\\"qty\\"+qty3);\\r"," console.log(\\"array_3\\"+Array_3[qty3]);\\r"," if(Array_3[qty3]===\\"IOS\\")\\r"," {\\r"," console.log(\\"IOS\\");\\r"," pm.environment.set(\\"platform\\", \\"IOS\\");\\r"," pm.environment.set(\\"platformVersion\\", \\"IPadOS 15.3.1\\");\\r"," pm.environment.set(\\"manufacturerModel\\", \\"Apple A10\\");\\r"," pm.environment.set(\\"manufacturerName\\", \\"Apple\\");\\r"," }\\r"," else\\r"," {\\r"," console.log(\\"Android\\");\\r"," pm.environment.set(\\"platform\\", \\"Android\\");\\r"," pm.environment.set(\\"platformVersion\\", \\"android- 3.1.225.0\\");\\r"," pm.environment.set(\\"manufacturerModel\\", \\"Samsung GT-S5830L\\");\\r"," pm.environment.set(\\"manufacturerName\\", \\"Samsung\\");\\r"," }\\r","}\\r","\\r","\\r",""],"type":"text/javascript","id":"5c7405c1-4f89-4149-99d4-82247bf010e3"}},{"listen":"test","script":{"exec":["pm.test(\\"response is 201\\", function()\\r","{\\r"," pm.response.to.have.status(201);\\r","});\\r","var jsonData = pm.response.json();\\r","// pm.test(\\"response has id\\", function()\\r","// {\\r","// pm.expect(jsonData.data).to.haveOwnProperty(\\"id\\");\\r","// pm.expect(jsonData.data.id).to.not.equal(null);\\r","// });\\r","pm.environment.set(\\"tn_mobile_deviceRefId\\",jsonData.data.deviceRefId);\\r","\\r","var reqestData = JSON.parse(pm.request.body);\\r","pm.environment.set(\\"device_name\\",reqestData.name);\\r","pm.environment.set(\\"device_type\\",reqestData.type);\\r","pm.environment.set(\\"device_platform\\",reqestData.platform);\\r","pm.environment.set(\\"device_platformVersion\\",reqestData.platformVersion);\\r","pm.environment.set(\\"device_osLocale\\",reqestData.osLocale);\\r","pm.environment.set(\\"device_manufacturerModel\\",reqestData.manufacturerModel);\\r","pm.environment.set(\\"device_manufacturerName\\",reqestData.manufacturerName);"],"type":"text/javascript","id":"39f6936a-79aa-46ed-8363-c542c5ee5517"}}],"id":"d4218814-5113-4972-8ebc-8b07e3f94fd2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-Corelation-Id","value":"{{$guid}}","type":"text"},{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\r\\n \\"name\\": \\"{{$randomUserName}}\\",\\r\\n \\"type\\": \\"MOBILE\\",\\r\\n \\"platform\\": \\"IOS\\",\\r\\n \\"platformVersion\\": \\"IPadOS 15.3.1\\",\\r\\n \\"osLocale\\": \\"{{$randomCountryCode}}\\",\\r\\n \\"manufacturerModel\\": \\"Apple A10\\",\\r\\n \\"manufacturerName\\": \\"Apple\\",\\r\\n \\"platformUniqueId\\": \\"{{$guid}}\\",\\r\\n \\"installedTime\\": {{installedTime}}\\r\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-func}}/devices","host":["{{device-func}}"],"path":["devices"]}},"response":[]},{"name":"Device Installation - Windows","event":[{"listen":"prerequest","script":{"exec":["var d1= new Date(Date.now()); installedTime=Math.floor(d1.getTime());\\r","pm.environment.set(\\"installedTime\\",installedTime);\\r","var platformUniqueId = pm.variables.replaceIn(\\"{{$guid}}\\");\\r","pm.environment.set(\\"platformUniqueId\\",platformUniqueId);\\r","var deviceName = pm.variables.replaceIn(\\"{{$randomUserName}}\\");\\r","pm.environment.set(\\"deviceName\\",deviceName);\\r","\\r","var Countrucode = pm.variables.replaceIn(\\"{{$randomCountryCode}}\\");\\r","pm.environment.set(\\"Countrucode\\", Countrucode);\\r","const Array_1 = [\\"Tablet\\",\\"PC\\",\\"Mobile\\"];\\r","var qty1 = _.random(0, 2);\\r","//pm.variables.set(\\"qty\\", qty1);\\r","console.log(\\"qty\\"+qty1);\\r","console.log(\\"array_1\\"+Array_1[qty1]);\\r","if(Array_1[qty1]===\\"Tablet\\")\\r","{\\r"," pm.environment.set(\\"type\\",\\"Tablet\\")\\r"," const Array_2 = [\\"IOS\\",\\"Android\\"];\\r"," var qty2 = _.random(0, 1);\\r"," console.log(\\"qty\\"+qty2);\\r"," console.log(\\"array_2\\"+Array_2[qty2]);\\r"," if(Array_2[qty2]===\\"IOS\\")\\r"," {\\r"," console.log(\\"IOS\\");\\r"," pm.environment.set(\\"platform\\", \\"IOS\\");\\r"," pm.environment.set(\\"platformVersion\\", \\"IPadOS 15.3.1\\");\\r"," pm.environment.set(\\"manufacturerModel\\", \\"Apple A10\\");\\r"," pm.environment.set(\\"manufacturerName\\", \\"Apple\\");\\r"," }\\r"," else\\r"," {\\r"," console.log(\\"Android\\");\\r"," pm.environment.set(\\"platform\\", \\"Android\\");\\r"," pm.environment.set(\\"platformVersion\\", \\"android- 3.1.225.0\\");\\r"," pm.environment.set(\\"manufacturerModel\\", \\"Samsung GT-S5830L\\");\\r"," pm.environment.set(\\"manufacturerName\\", \\"Samsung\\");\\r"," }\\r","\\r","}\\r","else if(Array_1[qty1]===\\"PC\\")\\r","{\\r"," console.log(\\"++++++++++++++++\\")\\r"," pm.environment.set(\\"type\\",\\"PC\\")\\r"," pm.environment.set(\\"platform\\", \\"Windows\\");\\r"," pm.environment.set(\\"platformVersion\\", \\"Windows- 3.1.225.0\\");\\r"," pm.environment.set(\\"manufacturerModel\\", \\"Windows GT-S5830L\\");\\r"," pm.environment.set(\\"manufacturerName\\", \\"Windows\\");\\r","}\\r","else\\r","{\\r"," console.log(\\"---------------------------\\")\\r"," pm.environment.set(\\"type\\",\\"Mobile\\")\\r"," const Array_3 = [\\"IOS\\",\\"Android\\"];\\r"," var qty3 = _.random(0, 1);\\r"," console.log(\\"qty\\"+qty3);\\r"," console.log(\\"array_3\\"+Array_3[qty3]);\\r"," if(Array_3[qty3]===\\"IOS\\")\\r"," {\\r"," console.log(\\"IOS\\");\\r"," pm.environment.set(\\"platform\\", \\"IOS\\");\\r"," pm.environment.set(\\"platformVersion\\", \\"IPadOS 15.3.1\\");\\r"," pm.environment.set(\\"manufacturerModel\\", \\"Apple A10\\");\\r"," pm.environment.set(\\"manufacturerName\\", \\"Apple\\");\\r"," }\\r"," else\\r"," {\\r"," console.log(\\"Android\\");\\r"," pm.environment.set(\\"platform\\", \\"Android\\");\\r"," pm.environment.set(\\"platformVersion\\", \\"android- 3.1.225.0\\");\\r"," pm.environment.set(\\"manufacturerModel\\", \\"Samsung GT-S5830L\\");\\r"," pm.environment.set(\\"manufacturerName\\", \\"Samsung\\");\\r"," }\\r","}\\r","\\r","\\r",""],"type":"text/javascript","id":"78cbb2e1-de31-4b08-987a-6c8a57614d90"}},{"listen":"test","script":{"exec":["pm.test(\\"response is 201\\", function()\\r","{\\r"," pm.response.to.have.status(201);\\r","});\\r","var jsonData = pm.response.json();\\r","// pm.test(\\"response has id\\", function()\\r","// {\\r","// pm.expect(jsonData.data).to.haveOwnProperty(\\"id\\");\\r","// pm.expect(jsonData.data.id).to.not.equal(null);\\r","// });\\r","pm.environment.set(\\"tn_pc_deviceRefId\\",jsonData.data.deviceRefId);\\r","\\r","var reqestData = JSON.parse(pm.request.body);\\r","pm.environment.set(\\"device_name\\",reqestData.name);\\r","pm.environment.set(\\"device_type\\",reqestData.type);\\r","pm.environment.set(\\"device_platform\\",reqestData.platform);\\r","pm.environment.set(\\"device_platformVersion\\",reqestData.platformVersion);\\r","pm.environment.set(\\"device_osLocale\\",reqestData.osLocale);\\r","pm.environment.set(\\"device_manufacturerModel\\",reqestData.manufacturerModel);\\r","pm.environment.set(\\"device_manufacturerName\\",reqestData.manufacturerName);"],"type":"text/javascript","id":"e79602a0-6913-4aa1-9deb-cd267cc9f0c6"}}],"id":"973e0456-fe26-4b14-a917-ed8f8a599a9e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-Corelation-Id","value":"{{$guid}}","type":"text"},{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\r\\n \\"name\\": \\"{{$randomUserName}}\\",\\r\\n \\"type\\": \\"PC\\",\\r\\n \\"platform\\": \\"WINDOWS\\",\\r\\n \\"platformVersion\\": \\"Windows- 3.1.225.0\\",\\r\\n \\"osLocale\\": \\"{{$randomCountryCode}}\\",\\r\\n \\"manufacturerModel\\": \\"Windows GT-S5830L\\",\\r\\n \\"manufacturerName\\": \\"Windows\\",\\r\\n \\"platformUniqueId\\": \\"{{$guid}}\\",\\r\\n \\"installedTime\\": {{installedTime}}\\r\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-func}}/devices","host":["{{device-func}}"],"path":["devices"]}},"response":[]},{"name":"success-tn-M1A-device","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 201\\", function () { "," pm.expect(pm.response.code).to.eq(201);"," const Request = JSON.parse(pm.request.body.raw);"," // pm.environment.set(\\"userRefId_tn\\", Request.userRefId);","});","","pm.test(\\"Response should include activationRefId\\", function () { "," const responseData = pm.response.json(); "," pm.expect(responseData.data.activationRefId).to.be.a(\\"string\\", \\"activationRefId\\");"," pm.environment.set(\\"tn_mobile_activationRefId\\", responseData.data.activationRefId); "," pm.expect(responseData.data.activationRefId).to.not.include(\\"ez_\\", \\"activationRefId\\");","});"],"type":"text/javascript","id":"41db5c2e-b081-4df0-9b7b-901ff02616f6"}},{"listen":"prerequest","script":{"exec":["var epoch = (new Date).getTime();","postman.setEnvironmentVariable(\\"epoch\\", epoch);"],"type":"text/javascript","id":"a017ca00-ccb3-4641-bbb2-2adca61f967b"}}],"id":"f1a770c7-0849-43e4-b5ff-acc4c7bc1b5b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"deviceRefId\\": \\"{{tn_mobile_deviceRefId}}\\",\\n \\"subRefId\\": \\"{{tn_subRefId}}\\",\\n \\"userRefId\\": \\"{{tn_userRefId}}\\",\\n \\"activationTime\\": {{epoch}},\\n \\"activationStatus\\": \\"ACTIVATED\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v2/device-activations","host":["{{device-orch}}"],"path":["v2","device-activations"]}},"response":[]},{"name":"success-tn-userrefId","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","","const schema = {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"data\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"subRefid\\": {"," \\"type\\": \\"string\\""," },"," \\"accountRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"users\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"id\\": {"," \\"type\\": \\"string\\""," },"," \\"role\\": {"," \\"type\\": \\"string\\""," },"," \\"deviceActivations\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"deviceRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"activationRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"name\\": {"," \\"type\\": \\"string\\""," },"," \\"type\\": {"," \\"type\\": \\"string\\""," },"," \\"platform\\": {"," \\"type\\": \\"string\\""," },"," \\"platformVersion\\": {"," \\"type\\": \\"string\\""," },"," \\"osLocale\\": {"," \\"type\\": \\"string\\""," },"," \\"manufacturerModel\\": {"," \\"type\\": \\"string\\""," },"," \\"manufacturerName\\": {"," \\"type\\": \\"string\\""," },"," \\"platformUniqueId\\": {"," \\"type\\": \\"string\\""," },"," \\"activationStatus\\": {"," \\"type\\": \\"string\\""," },"," \\"deviceFirstSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceLastSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"activationTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deactivationTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceActivationFirstSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceActivationLastSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"uninstalledTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"installedTime\\": {"," \\"type\\": \\"integer\\""," }"," },"," \\"required\\": ["," \\"deviceRefId\\","," \\"activationRefId\\","," \\"name\\","," \\"type\\","," \\"platform\\","," \\"platformVersion\\","," \\"osLocale\\","," \\"manufacturerModel\\","," \\"manufacturerName\\","," \\"platformUniqueId\\","," \\"activationStatus\\","," \\"deviceFirstSeenTime\\","," \\"deviceLastSeenTime\\","," \\"activationTime\\","," \\"deactivationTime\\","," \\"deviceActivationFirstSeenTime\\","," \\"deviceActivationLastSeenTime\\","," \\"uninstalledTime\\","," \\"installedTime\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"id\\","," \\"role\\","," \\"deviceActivations\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"subRefId\\","," \\"accountRefId\\","," \\"users\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"data\\""," ]","}","","pm.test(\\"Validate schema\\", () => {"," pm.response.to.have.jsonSchema(schema);","});","","pm.test(\\"mobile device - last seen time should be updated\\",function(){"," var counter=0"," var jsonResData = pm.response.json();"," pm.environment.set(\\"tn_mobile_subRefId\\", jsonResData.data[0].subRefId);"," for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ "," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_mobile_activationRefId\\")){ "," counter++"," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"MOBILE\\"); "," pm.environment.set(\\"tn_mobile_deviceActivationFirstSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_mobile_deviceActivationLastSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," }"," }"," pm.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, \\"only mobile device should be returned in response\\") ","","})","",""],"type":"text/javascript","id":"0a9ec56d-a04f-405e-98ff-4fd1f3f50236"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"a6b01646-fff0-4b63-8b27-9faac7f59a1e"}}],"id":"0ccd75b8-31c4-4e42-bd95-66cdb1659686","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{tn_userRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{tn_userRefId}}"}]}},"response":[]},{"name":"success with tn-userRefID-subRefID","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","","const schema = {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"data\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"subRefid\\": {"," \\"type\\": \\"string\\""," },"," \\"accountRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"users\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"id\\": {"," \\"type\\": \\"string\\""," },"," \\"role\\": {"," \\"type\\": \\"string\\""," },"," \\"deviceActivations\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"deviceRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"activationRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"name\\": {"," \\"type\\": \\"string\\""," },"," \\"type\\": {"," \\"type\\": \\"string\\""," },"," \\"platform\\": {"," \\"type\\": \\"string\\""," },"," \\"platformVersion\\": {"," \\"type\\": \\"string\\""," },"," \\"osLocale\\": {"," \\"type\\": \\"string\\""," },"," \\"manufacturerModel\\": {"," \\"type\\": \\"string\\""," },"," \\"manufacturerName\\": {"," \\"type\\": \\"string\\""," },"," \\"platformUniqueId\\": {"," \\"type\\": \\"string\\""," },"," \\"activationStatus\\": {"," \\"type\\": \\"string\\""," },"," \\"deviceFirstSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceLastSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"activationTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deactivationTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceActivationFirstSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceActivationLastSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"uninstalledTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"installedTime\\": {"," \\"type\\": \\"integer\\""," }"," },"," \\"required\\": ["," \\"deviceRefId\\","," \\"activationRefId\\","," \\"name\\","," \\"type\\","," \\"platform\\","," \\"platformVersion\\","," \\"osLocale\\","," \\"manufacturerModel\\","," \\"manufacturerName\\","," \\"platformUniqueId\\","," \\"activationStatus\\","," \\"deviceFirstSeenTime\\","," \\"deviceLastSeenTime\\","," \\"activationTime\\","," \\"deactivationTime\\","," \\"deviceActivationFirstSeenTime\\","," \\"deviceActivationLastSeenTime\\","," \\"uninstalledTime\\","," \\"installedTime\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"id\\","," \\"role\\","," \\"deviceActivations\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"subRefId\\","," \\"accountRefId\\","," \\"users\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"data\\""," ]","}","","pm.test(\\"Validate schema\\", () => {"," pm.response.to.have.jsonSchema(schema);","});","","pm.test(\\"json response should have all the details\\",function(){"," const responseData = pm.response.json();",""," console.log(responseData)",""," pm.expect(pm.environment.get(\\"tn_userRefId\\")).to.eq(responseData.data[0].users[0].id); "," pm.expect(responseData.data[0].subRefId).to.eq(pm.environment.get(\\"tn_subRefId\\"));"," ","","})","","pm.test(\\"mobile device - last seen time should be updated\\",function(){"," var counter=0"," var jsonResData = pm.response.json();"," pm.environment.set(\\"tn_mobile_subRefId\\", jsonResData.data[0].subRefId);"," for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ "," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_mobile_activationRefId\\")){ "," counter++"," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"MOBILE\\"); "," pm.environment.set(\\"tn_mobile_deviceActivationFirstSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_mobile_deviceActivationLastSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," } "," }"," pm.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, \\"only mobile device should be returned in response\\") ","","})","",""],"type":"text/javascript","id":"516d3eee-447d-49cc-abb4-13d8a4ceae44"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"6d889fa8-3ed6-4d31-a2f7-2a5a6a483d41"}}],"id":"e96027d9-a97d-4391-9d80-c9a5807bf270","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{tn_userRefId}}&subRefId={{tn_subRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{tn_userRefId}}"},{"key":"subRefId","value":"{{tn_subRefId}}"}]}},"response":[]},{"name":"success-tn-windows-device","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 201\\", function () { "," pm.expect(pm.response.code).to.eq(201);"," const Request = JSON.parse(pm.request.body.raw);"," // pm.environment.set(\\"userRefId_tn\\", Request.userRefId);","});","","pm.test(\\"Response should include activationRefId\\", function () { "," const responseData = pm.response.json(); "," pm.expect(responseData.data.activationRefId).to.be.a(\\"string\\", \\"activationRefId\\");"," pm.environment.set(\\"tn_pc_activationRefId\\", responseData.data.activationRefId); "," pm.expect(responseData.data.activationRefId).to.not.include(\\"ez_\\", \\"activationRefId\\");","});"],"type":"text/javascript","id":"7aacd03e-8022-4fc3-aec9-947c950d349f"}},{"listen":"prerequest","script":{"exec":["var epoch = (new Date).getTime();","postman.setEnvironmentVariable(\\"epoch\\", epoch);"],"type":"text/javascript","id":"95aab262-8786-42d2-a6d5-81256bc1e722"}}],"id":"f626a4a1-aa32-4a05-9310-ae2950028739","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"deviceRefId\\": \\"{{tn_pc_deviceRefId}}\\",\\n \\"subRefId\\": \\"{{tn_subRefId}}\\",\\n \\"userRefId\\": \\"{{tn_userRefId}}\\",\\n \\"activationTime\\": {{epoch}},\\n \\"activationStatus\\": \\"ACTIVATED\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v2/device-activations","host":["{{device-orch}}"],"path":["v2","device-activations"]}},"response":[]},{"name":"success-tn-userrefId","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","","const schema = {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"data\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"subRefid\\": {"," \\"type\\": \\"string\\""," },"," \\"accountRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"users\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"id\\": {"," \\"type\\": \\"string\\""," },"," \\"role\\": {"," \\"type\\": \\"string\\""," },"," \\"deviceActivations\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"deviceRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"activationRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"name\\": {"," \\"type\\": \\"string\\""," },"," \\"type\\": {"," \\"type\\": \\"string\\""," },"," \\"platform\\": {"," \\"type\\": \\"string\\""," },"," \\"platformVersion\\": {"," \\"type\\": \\"string\\""," },"," \\"osLocale\\": {"," \\"type\\": \\"string\\""," },"," \\"manufacturerModel\\": {"," \\"type\\": \\"string\\""," },"," \\"manufacturerName\\": {"," \\"type\\": \\"string\\""," },"," \\"platformUniqueId\\": {"," \\"type\\": \\"string\\""," },"," \\"activationStatus\\": {"," \\"type\\": \\"string\\""," },"," \\"deviceFirstSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceLastSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"activationTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deactivationTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceActivationFirstSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceActivationLastSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"uninstalledTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"installedTime\\": {"," \\"type\\": \\"integer\\""," }"," },"," \\"required\\": ["," \\"deviceRefId\\","," \\"activationRefId\\","," \\"name\\","," \\"type\\","," \\"platform\\","," \\"platformVersion\\","," \\"osLocale\\","," \\"manufacturerModel\\","," \\"manufacturerName\\","," \\"platformUniqueId\\","," \\"activationStatus\\","," \\"deviceFirstSeenTime\\","," \\"deviceLastSeenTime\\","," \\"activationTime\\","," \\"deactivationTime\\","," \\"deviceActivationFirstSeenTime\\","," \\"deviceActivationLastSeenTime\\","," \\"uninstalledTime\\","," \\"installedTime\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"id\\","," \\"role\\","," \\"deviceActivations\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"subRefId\\","," \\"accountRefId\\","," \\"users\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"data\\""," ]","}","","pm.test(\\"Validate schema\\", () => {"," pm.response.to.have.jsonSchema(schema);","});","","pm.test(\\"pc device - last seen time should be updated\\",function(){"," var counter=0"," var jsonResData = pm.response.json();"," pm.environment.set(\\"tn_pc_subRefId\\", jsonResData.data[0].subRefId);"," for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ "," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_pc_activationRefId\\")){ "," counter++"," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"PC\\"); "," pm.environment.set(\\"tn_pc_deviceActivationFirstSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_pc_deviceActivationLastSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," }"," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_mobile_activationRefId\\")){ "," counter++"," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"MOBILE\\"); "," pm.environment.set(\\"tn_mobile_deviceActivationFirstSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_mobile_deviceActivationLastSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," }"," }"," pm.expect(counter).eq(2, \\"pc and mobile both should be returned in response\\"); ","","})","",""],"type":"text/javascript","id":"b76a5a6d-eb97-4fb4-ba2a-624e26bef127"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"33420094-52ee-40b4-af1b-cb9abf9f6253"}}],"id":"9cf1f1a2-d557-4793-951e-a477745359d8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{tn_userRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{tn_userRefId}}"}]}},"response":[]},{"name":"success with tn-userRefID-subRefID","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","","const schema = {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"data\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"subRefid\\": {"," \\"type\\": \\"string\\""," },"," \\"accountRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"users\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"id\\": {"," \\"type\\": \\"string\\""," },"," \\"role\\": {"," \\"type\\": \\"string\\""," },"," \\"deviceActivations\\": {"," \\"type\\": \\"array\\","," \\"items\\": ["," {"," \\"type\\": \\"object\\","," \\"properties\\": {"," \\"deviceRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"activationRefId\\": {"," \\"type\\": \\"string\\""," },"," \\"name\\": {"," \\"type\\": \\"string\\""," },"," \\"type\\": {"," \\"type\\": \\"string\\""," },"," \\"platform\\": {"," \\"type\\": \\"string\\""," },"," \\"platformVersion\\": {"," \\"type\\": \\"string\\""," },"," \\"osLocale\\": {"," \\"type\\": \\"string\\""," },"," \\"manufacturerModel\\": {"," \\"type\\": \\"string\\""," },"," \\"manufacturerName\\": {"," \\"type\\": \\"string\\""," },"," \\"platformUniqueId\\": {"," \\"type\\": \\"string\\""," },"," \\"activationStatus\\": {"," \\"type\\": \\"string\\""," },"," \\"deviceFirstSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceLastSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"activationTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deactivationTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceActivationFirstSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"deviceActivationLastSeenTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"uninstalledTime\\": {"," \\"type\\": \\"integer\\""," },"," \\"installedTime\\": {"," \\"type\\": \\"integer\\""," }"," },"," \\"required\\": ["," \\"deviceRefId\\","," \\"activationRefId\\","," \\"name\\","," \\"type\\","," \\"platform\\","," \\"platformVersion\\","," \\"osLocale\\","," \\"manufacturerModel\\","," \\"manufacturerName\\","," \\"platformUniqueId\\","," \\"activationStatus\\","," \\"deviceFirstSeenTime\\","," \\"deviceLastSeenTime\\","," \\"activationTime\\","," \\"deactivationTime\\","," \\"deviceActivationFirstSeenTime\\","," \\"deviceActivationLastSeenTime\\","," \\"uninstalledTime\\","," \\"installedTime\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"id\\","," \\"role\\","," \\"deviceActivations\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"subRefId\\","," \\"accountRefId\\","," \\"users\\""," ]"," }"," ]"," }"," },"," \\"required\\": ["," \\"data\\""," ]","}","","pm.test(\\"Validate schema\\", () => {"," pm.response.to.have.jsonSchema(schema);","});","","pm.test(\\"json response should have all the details\\",function(){"," const responseData = pm.response.json();",""," console.log(responseData)",""," pm.expect(pm.environment.get(\\"tn_userRefId\\")).to.eq(responseData.data[0].users[0].id); "," pm.expect(responseData.data[0].subRefId).to.eq(pm.environment.get(\\"tn_subRefId\\"));"," ","","})","","pm.test(\\"pc device - last seen time should be updated\\",function(){ "," var counter = 0;"," var jsonResData = pm.response.json();"," pm.environment.set(\\"tn_pc_subRefId\\", jsonResData.data[0].subRefId);"," for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ "," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_pc_activationRefId\\")){ "," counter++"," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"PC\\"); "," pm.environment.set(\\"tn_pc_deviceActivationFirstSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_pc_deviceActivationLastSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," }"," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_mobile_activationRefId\\")){ "," counter++"," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"MOBILE\\"); "," pm.environment.set(\\"tn_mobile_deviceActivationFirstSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_mobile_deviceActivationLastSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," }"," }"," pm.expect(counter).eq(2, \\"pc and mobile both should be returned in response\\"); "," ","","})","",""],"type":"text/javascript","id":"9117c87f-135c-4ae4-ba21-3ad1920bd9df"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"9f764a86-9692-4a14-a894-f9e67cb3bb45"}}],"id":"3fa5add3-fc6a-4f90-af02-5c9c82a1891c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{tn_userRefId}}&subRefId={{tn_subRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{tn_userRefId}}"},{"key":"subRefId","value":"{{tn_subRefId}}"}]}},"response":[]}],"id":"ec672f2d-218a-42f7-8910-eb37ecca80cb"},{"name":"patch-device-activations","item":[{"name":"M1A - success","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"Response should include activationRefId\\", function () { "," const responseData = pm.response.json(); "," pm.expect(responseData.data.activationRefId).to.eq(pm.environment.get(\\"tn_mobile_activationRefId\\"), \\"activationRefId\\"); ","});"],"type":"text/javascript","id":"2e6fbad5-4cac-401b-a995-de0965d4004b"}},{"listen":"prerequest","script":{"exec":["var epoch = (new Date).getTime();","postman.setEnvironmentVariable(\\"epoch\\", epoch);","console.log(pm.environment.get(\\"epoch\\"));"],"type":"text/javascript","id":"da373ffc-de51-422f-930a-dc75ec108593"}}],"id":"4d461d83-4d9f-45f2-aa4f-4caed0744cdf","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"deviceRefId\\": \\"{{tn_mobile_deviceRefId}}\\",\\n \\"userRefId\\": \\"{{tn_userRefId}}\\",\\n \\"globalRefId\\": \\"{{globalRefID}}\\",\\n \\"subRefId\\": \\"{{tn_subRefId}}\\",\\n \\"deviceActivationLastSeenTime\\": {{epoch}}\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v2/device-activations/{{tn_mobile_activationRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations","{{tn_mobile_activationRefId}}"]}},"response":[]},{"name":"activation status","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"mobile device - last seen time should be updated\\",function(){"," var jsonResData = pm.response.json();"," "," for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ "," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_mobile_activationRefId\\")){ "," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"MOBILE\\"); "," pm.environment.set(\\"tn_mobile_deviceActivationFirstSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_mobile_deviceActivationLastSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," }"," } ","","})","","pm.test(\\"deviceActivationLastSeenTime should not match\\", function () { "," pm.expect(pm.environment.get(\\"tn_mobile_deviceActivationLastSeenTime\\")).to.eq(parseInt(pm.environment.get(\\"epoch\\")))"," });"],"type":"text/javascript","id":"8da0b0e5-3b1c-4b81-89ac-c3d0f28036fa"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"a6169f6a-1d14-46d7-83ee-75bbc28cff80"}}],"id":"3c093c3a-119a-4caa-b039-26bd82de62d0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{tn_userRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{tn_userRefId}}"}]}},"response":[]},{"name":"WPS - success","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"Response should include activationRefId\\", function () { "," const responseData = pm.response.json(); "," pm.expect(responseData.data.activationRefId).to.eq(pm.environment.get(\\"tn_pc_activationRefId\\"), \\"activationRefId\\"); ","});"],"type":"text/javascript","id":"85c76a2c-7771-483f-9910-b3f356ae42ed"}},{"listen":"prerequest","script":{"exec":["var epoch = (new Date).getTime();","postman.setEnvironmentVariable(\\"epoch\\", epoch);","// console.log(pm.environment.get(\\"epoch\\"));"],"type":"text/javascript","id":"5ab92788-014e-4767-b41e-23afaa37fe19"}}],"id":"63841a8c-d132-4db1-ae32-22511fc8af07","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"deviceRefId\\": \\"{{tn_pc_deviceRefId}}\\",\\n \\"userRefId\\": \\"{{tn_userRefId}}\\",\\n \\"globalRefId\\": \\"{{globalRefID}}\\",\\n \\"subRefId\\": \\"{{tn_subRefId}}\\",\\n \\"deviceActivationLastSeenTime\\": {{epoch}}\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v2/device-activations/{{tn_pc_activationRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations","{{tn_pc_activationRefId}}"]}},"response":[]},{"name":"activation status","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"pc device - last seen time should be updated\\",function(){"," var jsonResData = pm.response.json();"," "," for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ "," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_pc_activationRefId\\")){ "," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"PC\\"); "," pm.environment.set(\\"tn_pc_deviceActivationFirstSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_pc_deviceActivationLastSeenTime\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," }"," } ","","})","","pm.test(\\"deviceActivationLastSeenTime should not match\\", function () { "," pm.expect(pm.environment.get(\\"tn_pc_deviceActivationLastSeenTime\\")).to.eq(parseInt(pm.environment.get(\\"epoch\\")))"," });"],"type":"text/javascript","id":"9ced282b-4c5b-400b-9791-0ee8f7e71858"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"730aa3ad-c494-487f-975c-a50af05f036b"}}],"id":"4691731e-6fac-4863-b061-a2cacd5e6faa","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{tn_userRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{tn_userRefId}}"}]}},"response":[]},{"name":"deviceRefId is not mandatory","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"Response should include activationRefId\\", function () { "," const responseData = pm.response.json(); "," pm.expect(responseData.data.activationRefId).to.eq(pm.environment.get(\\"tn_pc_activationRefId\\"), \\"activationRefId\\"); ","});"],"type":"text/javascript","id":"6ecab7c9-680c-40b3-ba6d-def007fa5021"}},{"listen":"prerequest","script":{"exec":["var epoch = (new Date).getTime();","postman.setEnvironmentVariable(\\"epoch\\", epoch);","// console.log(pm.environment.get(\\"epoch\\"));"],"type":"text/javascript","id":"8b0dc01b-739c-4f9e-9f18-38ac07c46b2d"}}],"id":"ad8d3d87-152e-4b20-946f-204c3580d372","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{ \\n \\"userRefId\\": \\"{{tn_userRefId}}\\",\\n \\"globalRefId\\": \\"{{globalRefID}}\\",\\n \\"subRefId\\": \\"{{tn_subRefId}}\\",\\n \\"deviceActivationLastSeenTime\\": {{epoch}}\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v2/device-activations/{{tn_pc_activationRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations","{{tn_pc_activationRefId}}"]}},"response":[]}],"id":"e6403951-4d6f-4488-aae2-3faec0daee95"},{"name":"patch-uninstall - Update test case subRefId ad mandatory","item":[{"name":"M1A","item":[{"name":"unistall mobile device - with lastSeenTime & uninstallTime","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"Response should include activationRefId\\", function () { "," const responseData = pm.response.json(); "," pm.expect(responseData.data.activationRefId).to.eq(pm.environment.get(\\"tn_mobile_activationRefId\\"), \\"activationRefId\\"); ","});"],"type":"text/javascript","id":"3b6003e9-77c1-44ec-80f3-d425c4f55624"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"c127d2cb-35dc-4eb6-8712-09824525b690"}}],"id":"131f9885-7954-4faa-ab1b-b5fefb77a5a4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"uninstalled\\": true,\\n \\"deviceRefId\\": \\"{{tn_mobile_deviceRefId}}\\",\\n \\"lastSeenTime\\": {{epoch}},\\n \\"uninstallTime\\": {{epoch}},\\n \\"subRefId\\": \\"{{tn_subRefId}}\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v2/device-activations/{{tn_mobile_activationRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations","{{tn_mobile_activationRefId}}"]}},"response":[]},{"name":"after mobile uninstallation","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","var jsonResData = pm.response.json();","","pm.test(\\"wps device should be returned in response since mobile is removed\\",function(){"," var counter=0"," "," for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ "," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_pc_activationRefId\\")){"," counter++",""," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"PC\\");"," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].activationStatus).to.eq(\\"ACTIVATED\\");"," pm.environment.set(\\"tn_pc_after_uninstall_firstSeen_25\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_pc_after_uninstall_lastSeen_25\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," }"," }"," pm.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, \\"Only PC device should be returned\\");","","})"],"type":"text/javascript","id":"f1b1a9b5-7d76-40b0-bb8f-c6e09da9d465"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"6a53c5d4-3d6a-4751-8f71-ab8c19de9351"}}],"id":"6246c0bb-a52c-46a5-850e-ebb59be23328","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{tn_userRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{tn_userRefId}}"}]}},"response":[]},{"name":"after mobile uninstallation include=uninstalled","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","var jsonResData = pm.response.json();","","pm.test(\\"pc & mobile device should be returned in response\\",function(){"," var counter = 0"," "," for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ "," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_mobile_activationRefId\\")){"," counter++",""," console.log(jsonResData.data[0].users[0].deviceActivations[i].activationRefId) "," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].activationStatus).to.eq(\\"ACTIVATED\\");"," pm.environment.set(\\"tn_mobile_after_uninstalled_firstSeen_25\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_mobile_after_uninstalled_lastSeen_25\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," console.log(jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime) "," }"," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_pc_activationRefId\\")){ "," counter++ "," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"PC\\");"," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].activationStatus).to.eq(\\"ACTIVATED\\");"," pm.environment.set(\\"tn_pc_after_uninstall_firstSeen_25\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_pc_after_uninstall_lastSeen_25\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," } "," }",""," pm.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, \\"PC & Mobile device should be returned\\"); ","","})","","pm.test(\\"uninstalledTime should be returned in response\\", function () { "," for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ "," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_mobile_activationRefId\\")){ "," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].uninstalledTime).to.be.a(\\"number\\"); "," "," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].uninstalledTime).to.eq(parseInt(pm.environment.get(\\"epoch\\"))); "," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].deviceLastSeenTime).to.eq(parseInt(pm.environment.get(\\"epoch\\"))); ","",""," }"," }","});","","pm.test(\\"deviceActivationFirstSeenTime should match before and after patch\\", function () { "," pm.expect(pm.environment.get(\\"tn_mobile_after_uninstalled_firstSeen_25\\")).to.eq(pm.environment.get(\\"tn_mobile_deviceActivationFirstSeenTime\\"))","});"],"type":"text/javascript","id":"d1a24cf7-7a5d-4b42-8a60-1b7e513ef35c"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"a3fac73f-532f-48fe-9c92-78da2d3d9a68"}}],"id":"1d258ee7-db03-4145-a3e6-3e3e6e80ae3b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{tn_userRefId}}&include=uninstalled","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{tn_userRefId}}"},{"key":"include","value":"uninstalled"}]}},"response":[]},{"name":"uninstall mobile device - without lastSeenTime & uninstallTime","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"Response should include activationRefId\\", function () { "," const responseData = pm.response.json(); "," pm.expect(responseData.data.activationRefId).to.eq(pm.environment.get(\\"tn_mobile_activationRefId\\"), \\"activationRefId\\"); ","});"],"type":"text/javascript","id":"ca687326-55f6-436f-a9e8-822bbd0d282e"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"0dd7a238-f3cc-4187-b291-50dd2c9ff115"}}],"id":"81674add-ddea-43bf-ab71-75c0a12d38bd","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"uninstalled\\": true,\\n \\"deviceRefId\\": \\"{{tn_mobile_deviceRefId}}\\",\\n \\"subRefId\\": \\"{{tn_subRefId}}\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v2/device-activations/{{tn_mobile_activationRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations","{{tn_mobile_activationRefId}}"]}},"response":[]},{"name":"after mobile uninstallation","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","var jsonResData = pm.response.json();","","pm.test(\\"wps device should be returned in response since mobile is removed\\",function(){"," var counter = 0"," for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ "," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_pc_activationRefId\\")){ "," counter++ "," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"PC\\");"," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].activationStatus).to.eq(\\"ACTIVATED\\");"," pm.environment.set(\\"tn_pc_after_uninstall_firstSeen_25\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_pc_after_uninstall_lastSeen_25\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," }"," }"," pm.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, \\"Only PC device should be returned\\");","","})"],"type":"text/javascript","id":"7407fa85-0c04-4b51-9cc0-06e19d35efdf"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"7420adc0-3f0f-46de-ae21-a6aab98a900e"}}],"id":"f72fb5a3-ad81-49f1-9fe4-817789800995","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{tn_userRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{tn_userRefId}}"}]}},"response":[]},{"name":"unistall mobile device - future lastSeen","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"Response should include activationRefId\\", function () { "," const responseData = pm.response.json(); "," pm.expect(responseData.data.activationRefId).to.eq(pm.environment.get(\\"tn_mobile_activationRefId\\"), \\"activationRefId\\"); ","});"],"type":"text/javascript","id":"486200c6-b1ce-4a01-8e0a-30c7f69f0e24"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"9d76b1a3-4e37-478f-a9b9-b3d2c6fd57d6"}}],"id":"2c9ba195-f86c-4bff-9f8b-ef45e15ac4b4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"uninstalled\\": true,\\n \\"deviceRefId\\": \\"{{tn_mobile_deviceRefId}}\\",\\n \\"lastSeenTime\\": {{epochAfter72}},\\n \\"uninstallTime\\": {{epoch}},\\n \\"subRefId\\": \\"{{tn_subRefId}}\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v2/device-activations/{{tn_mobile_activationRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations","{{tn_mobile_activationRefId}}"]}},"response":[]},{"name":"unistall mobile device - future uninstallTime","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"Response should include activationRefId\\", function () { "," const responseData = pm.response.json(); "," pm.expect(responseData.data.activationRefId).to.eq(pm.environment.get(\\"tn_mobile_activationRefId\\"), \\"activationRefId\\"); ","});"],"type":"text/javascript","id":"349aa454-76e4-48bb-8ce2-a60b7f1eb2d5"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"b6be3fa0-8851-4a02-ad2d-e3b2b22f00c7"}}],"id":"e5eb9d9c-b898-4233-9af1-c62aa4082d11","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"uninstalled\\": true,\\n \\"deviceRefId\\": \\"{{tn_mobile_deviceRefId}}\\",\\n \\"lastSeenTime\\": {{epoch}},\\n \\"uninstallTime\\": {{epochAfter72}},\\n \\"subRefId\\": \\"{{tn_subRefId}}\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v2/device-activations/{{tn_mobile_activationRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations","{{tn_mobile_activationRefId}}"]}},"response":[]},{"name":"after mobile uninstallation","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","var jsonResData = pm.response.json();","","pm.test(\\"wps device should be returned in response since mobile is removed\\",function(){"," var counter = 0"," for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ "," if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == pm.environment.get(\\"tn_pc_activationRefId\\")){ "," counter++"," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq(\\"PC\\");"," pm.expect(jsonResData.data[0].users[0].deviceActivations[i].activationStatus).to.eq(\\"ACTIVATED\\");"," pm.environment.set(\\"tn_pc_after_uninstall_firstSeen_25\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime);"," pm.environment.set(\\"tn_pc_after_uninstall_lastSeen_25\\", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime);"," }"," }"," pm.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, \\"Only PC device should be returned\\");","","})"],"type":"text/javascript","id":"f2341b96-7399-4fa4-94d6-30b1689a6ba9"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"958519e7-30e1-4ed4-b13e-db5d25920f3d"}}],"id":"8042ef97-87e9-4cab-960a-146930aee216","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"url":{"raw":"{{device-orch}}/v2/device-activations?userRefId={{tn_userRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations"],"query":[{"key":"userRefId","value":"{{tn_userRefId}}"}]}},"response":[]},{"name":"unistall mobile device - future uninstallTime and lastSeen","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () { "," pm.expect(pm.response.code).to.eq(200);","});","","pm.test(\\"Response should include activationRefId\\", function () { "," const responseData = pm.response.json(); "," pm.expect(responseData.data.activationRefId).to.eq(pm.environment.get(\\"tn_mobile_activationRefId\\"), \\"activationRefId\\"); ","});"],"type":"text/javascript","id":"e0df6621-2c9d-4607-bffe-800dc7bed15d"}},{"listen":"prerequest","script":{"exec":[""],"type":"text/javascript","id":"de631af5-cf42-4d32-ace7-ca58db112212"}}],"id":"054da1d4-3741-4fd8-b411-2bea4f49ef76","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"uninstalled\\": true,\\n \\"deviceRefId\\": \\"{{tn_mobile_deviceRefId}}\\",\\n \\"lastSeenTime\\": {{epochAfter72}},\\n \\"uninstallTime\\": {{epochAfter72}},\\n \\"subRefId\\": \\"{{tn_subRefId}}\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v2/device-activations/{{tn_mobile_activationRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations","{{tn_mobile_activationRefId}}"]}},"response":[]},{"name":"unistall mobile device - deviceRefId missing","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 400\\", function () { "," pm.expect(pm.response.code).to.eq(400);","});","","pm.test(\\"BAD_REQUEST\\", function () { "," const responseData = pm.response.json();"," pm.expect(responseData.errors[0].reason).to.eq(\\"deviceRefId is mandatory when uninstalled is true\\");","});"],"type":"text/javascript","id":"9c231e43-85c3-4d2e-8dd2-7bb9b0c2a947"}},{"listen":"prerequest","script":{"exec":["var epoch = (new Date).getTime();","postman.setEnvironmentVariable(\\"epoch\\", epoch);","var epochAfter72 = epoch + (72*60*60*1000)","postman.setEnvironmentVariable(\\"epochAfter72\\", epochAfter72)","","var epochPrev72 = epoch - (72*60*60*1000)","postman.setEnvironmentVariable(\\"epochPrev72\\", epochPrev72)","",""],"type":"text/javascript","id":"dbf56bb1-776e-4d96-8c76-20f2366de74a"}}],"id":"6c4ccb31-328b-4b97-9c17-7138681d74c4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Authorization","value":"{{pse_auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"uninstalled\\": true, \\n \\"lastSeenTime\\": {{epoch}},\\n \\"uninstallTime\\": {{epoch}},\\n \\"subRefId\\": \\"{{tn_subRefId}}\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{device-orch}}/v2/device-activations/{{tn_mobile_activationRefId}}","host":["{{device-orch}}"],"path":["v2","device-activations","{{tn_mobile_activationRefId}}"]}},"response":[]}],"id":"95275b63-d06b-4c5f-ae69-5411a80831e7"}],"id":"2abf27a8-b238-4acd-bfda-36cb06e743e9"}],"id":"51ae5b84-29e6-48e2-987e-bdb2195356e8"}],"event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":[""],"id":"258ca7f7-8201-4476-9d3d-5a24116c7d89"}},{"listen":"test","script":{"type":"text/javascript","exec":[""],"id":"e438c884-d8c0-43f1-9ca9-df095b1b6e91"}}],"variable":[{"id":"6731bbde-06fd-4c47-9483-945627aceb57","key":"usrrefid","value":""},{"id":"2d4047d7-4400-42da-9619-fbfe1ebb15e6","key":"refresh_token_authO","value":""},{"id":"78b0b393-ad29-4484-99dd-82d3a1048c06","key":"access_token_authO","value":""},{"id":"e91ebc6b-a3ce-47d9-ac94-a224348bca3f","key":"provision_id","value":""},{"id":"80f783dc-d8fa-4db2-999d-07c6e3c9e07b","key":"appid","value":""},{"id":"b86c825d-8698-4823-b27d-3c717da93198","key":"devid","value":""},{"id":"454a9842-b591-4f09-90ba-f92da66fe2aa","key":"globalReferenceId","value":""},{"id":"61630f0f-aaf8-4884-82e1-090b5ecb8405","key":"access_token","value":""}]}", + "oriFileName": "6c9e3e4a-a00b-44f2-9413-1c5cc8e16a7c.json", + }, + { + "contentStr": "{"info":{"_postman_id":"a08ea369-d3a0-4041-ae8e-b7c6f16969f1","name":"REST API basics: CRUD, test & variable","description":"# 🚀 Get started here\\n\\nThis template guides you through CRUD operations (GET, POST, PUT, DELETE), variables, and tests.\\n\\n## đź”– **How to use this template**\\n\\n#### **Step 1: Send requests**\\n\\nRESTful APIs allow you to perform CRUD operations using the POST, GET, PUT, and DELETE HTTP methods.\\n\\nThis collection contains each of these [request](https://learning.postman.com/docs/sending-requests/requests/) types. Open each request and click \\"Send\\" to see what happens.\\n\\n#### **Step 2: View responses**\\n\\nObserve the response tab for status code (200 OK), response time, and size.\\n\\n#### **Step 3: Send new Body data**\\n\\nUpdate or add new data in \\"Body\\" in the POST request. Typically, Body data is also used in PUT request.\\n\\n\`\`\`\\n{\\n \\"name\\": \\"Add your name in the body\\"\\n}\\n\\n \`\`\`\\n\\n#### **Step 4: Update the variable**\\n\\nVariables enable you to store and reuse values in Postman. We have created a [variable](https://learning.postman.com/docs/sending-requests/variables/) called \`base_url\` with the sample request [https://postman-api-learner.glitch.me](https://postman-api-learner.glitch.me). Replace it with your API endpoint to customize this collection.\\n\\n#### **Step 5: Add tests in the \\"Scripts\\" tab**\\n\\nAdding tests to your requests can help you confirm that your API is working as expected. You can write test scripts in JavaScript and view the output in the \\"Test Results\\" tab.\\n\\n\\"\\"\\n\\n## đź’Ş Pro tips\\n\\n- Use folders to group related requests and organize the collection.\\n \\n- Add more [scripts](https://learning.postman.com/docs/writing-scripts/intro-to-scripts/) to verify if the API works as expected and execute workflows.\\n \\n\\n## đź’ˇRelated templates\\n\\n[API testing basics](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=e9a37a28-055b-49cd-8c7e-97494a21eb54&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719) \\n[API documentation](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=e9c28f47-1253-44af-a2f3-20dce4da1f18&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719) \\n[Authorization methods](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=31a9a6ed-4cdf-4ced-984c-d12c9aec1c27&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719)","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},"item":[{"name":"Get data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () {"," pm.response.to.have.status(200);","});"],"type":"text/javascript","id":"190c795c-c77b-4091-8e44-f262b47070d3"}}],"id":"fb5bee37-220a-4e16-988f-37ab22650645","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":{"raw":"{{base_url}}/info?id=1","host":["{{base_url}}"],"path":["info"],"query":[{"key":"id","value":"1"}]},"description":"This is a GET request and it is used to \\"get\\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have \`id=1\`).\\n\\nA successful GET response will have a \`200 OK\` status, and should include some kind of response body - for example, HTML web content or JSON data."},"response":[]},{"name":"Post data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Successful POST request\\", function () {"," pm.expect(pm.response.code).to.be.oneOf([200, 201]);","});",""],"type":"text/javascript","id":"3fc1031e-2686-4f05-80b2-0d88c54c3978"}}],"id":"71f8e644-e334-4843-8014-8cae390b7357","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\\n\\t\\"name\\": \\"Add your name in the body\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{base_url}}/info","host":["{{base_url}}"],"path":["info"]},"description":"This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.\\n\\nA successful POST request typically returns a \`200 OK\` or \`201 Created\` response code."},"response":[]},{"name":"Update data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Successful PUT request\\", function () {"," pm.expect(pm.response.code).to.be.oneOf([200, 201, 204]);","});",""],"type":"text/javascript","id":"ad3f15be-e0e5-4511-b5cd-3181fed24398"}}],"id":"bfe4167a-ffde-45fc-ac9f-955d8aaa4379","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\\n\\t\\"name\\": \\"Add your name in the body\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{base_url}}/info?id=1","host":["{{base_url}}"],"path":["info"],"query":[{"key":"id","value":"1"}]},"description":"This is a PUT request and it is used to overwrite an existing piece of data. For instance, after you create an entity with a POST request, you may want to modify that later. You can do that using a PUT request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`).\\n\\nA successful PUT request typically returns a \`200 OK\`, \`201 Created\`, or \`204 No Content\` response code."},"response":[]},{"name":"Delete data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Successful DELETE request\\", function () {"," pm.expect(pm.response.code).to.be.oneOf([200, 202, 204]);","});",""],"type":"text/javascript","id":"6f4099a6-7e57-4f64-aac0-527fcc3bc923"}}],"id":"4b5c3c61-ef01-430d-b271-796e28f07858","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":{"raw":"{{base_url}}/info?id=1","host":["{{base_url}}"],"path":["info"],"query":[{"key":"id","value":"1"}]},"description":"This is a DELETE request, and it is used to delete data that was previously created via a POST request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`).\\n\\nA successful DELETE request typically returns a \`200 OK\`, \`202 Accepted\`, or \`204 No Content\` response code."},"response":[]}],"event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":[""],"id":"91c82aff-ebc4-48f0-8347-a26c83a6f4be"}},{"listen":"test","script":{"type":"text/javascript","exec":[""],"id":"62c1771c-9f97-4e5f-ba30-a5cd8318c17e"}}],"variable":[{"id":"9d7c4657-d984-4377-a2a7-fadaaaf96711","key":"id","value":"1"},{"id":"9fa9e85f-e810-47b9-9c33-4408f6a3c376","key":"base_url","value":"https://postman-rest-api-learner.glitch.me/"}]}", + "oriFileName": "a08ea369-d3a0-4041-ae8e-b7c6f16969f1.json", + }, + { + "contentStr": "{"info":{"_postman_id":"5328fd0d-3a3c-4cc2-82bc-b2d0d095c9dc","name":"GetSubscriberIdAPI","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},"item":[{"name":"Setup","item":[{"name":"BearerToken","event":[{"listen":"test","script":{"id":"545599dd-ad0d-41f2-8c7e-d581a9793ace","exec":["try\\r","{\\r"," if (pm.response.code === 200)\\r"," {\\r"," let response = pm.response.json();\\r","\\r"," pm.test(\\"Response code is 200\\", function(){\\r"," pm.response.to.have.status(200);\\r"," });\\r","\\r"," var token = response.access_token;\\r"," pm.globals.set(\\"BearerToken\\", \\"Bearer \\" + token);\\r"," pm.environment.set(\\"BearerToken\\", \\"Bearer \\" + token);\\r"," }\\r"," else\\r"," {\\r"," pm.test(\\"Response code is not 200\\", function(){\\r"," pm.response.to.have.status(200);\\r"," });\\r"," }\\r","}\\r","catch (error)\\r","{\\r"," tests[\\"Tests script failed due to exception; \\" + \\"Error Message - \\" + error] = (true === false);\\r","}"],"type":"text/javascript","packages":{}}}],"id":"379d4083-c20a-47aa-8f33-77e3409295dd","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"basic","basic":[{"key":"password","value":"pass","type":"string"},{"key":"username","value":"yaowei","type":"string"}]},"method":"POST","header":[{"key":"content-type","value":"application/x-www-form-urlencoded"},{"key":"Authorization","value":"Basic {{Auth-Header}}"}],"body":{"mode":"urlencoded","urlencoded":[{"key":"grant_type","value":"password","type":"text"},{"key":"username","value":"{{Auth-Name}}","type":"text"},{"key":"password","value":"{{Auth-Value}}","type":"text"}]},"url":{"raw":"{{AuthUri}}?param1=paramVal1","host":["{{AuthUri}}"],"query":[{"key":"param1","value":"paramVal1","type":"text"}]}},"response":[]}],"id":"06114831-e353-41fc-8fd8-b3eaec77bb07","auth":{"type":"basic","basic":[{"key":"password","value":"weqew","type":"string"},{"key":"username","value":"adsfasdf","type":"string"}]},"event":[{"listen":"prerequest","script":{"id":"4e8fe29b-32a7-44d6-a773-f9bb86f77cea","type":"text/javascript","packages":{},"exec":[""]}},{"listen":"test","script":{"id":"31c3b23d-cc4e-45ed-ac3c-174de9fea5a7","type":"text/javascript","packages":{},"exec":[""]}}]}],"auth":{"type":"basic","basic":[{"key":"password","value":"haha","type":"string"},{"key":"username","value":"yaowei","type":"string"}]},"event":[{"listen":"prerequest","script":{"id":"9b5aa03b-e5e7-406b-acf4-1ac601df804e","type":"text/javascript","packages":{},"exec":[""]}},{"listen":"test","script":{"id":"a45ba1f3-5f20-481f-9468-0b0b831a6896","type":"text/javascript","packages":{},"exec":[""]}}],"variable":[{"id":"edba0c37-82d3-4b89-a597-b288696cd5a0","key":"asd","value":"qwer","type":"string"},{"id":"4a6a2724-f3b2-4f7b-9eaa-73e47052c658","key":"asfd","value":"qtrsda","type":"string"}]}", + "oriFileName": "5328fd0d-3a3c-4cc2-82bc-b2d0d095c9dc.json", + }, + { + "contentStr": "{"info":{"_postman_id":"3536ef55-d73b-41e6-a318-3e070fffbd4f","name":"RESTful API Basics #blueprint","description":"# 🚀 Get started here\\n\\nThis collection guides you through CRUD operations (GET, POST, PUT, DELETE), variables, and tests.\\n\\n## đź”– **How to use this collection**\\n\\n#### **Step 1: Send requests**\\n\\nRESTful APIs allow you to perform CRUD operations using the POST, GET, PUT, and DELETE HTTP methods.\\n\\nThis collection contains each of these request types. Open each request and click \\"Send\\" to see what happens.\\n\\n#### **Step 2: View responses**\\n\\nObserve the response tab for status code (200 OK), response time, and size.\\n\\n#### **Step 3: Send new Body data**\\n\\nUpdate or add new data in \\"Body\\" in the POST request. Typically, Body data is also used in PUT and PATCH requests.\\n\\n\`\`\`\\n{\\n \\"name\\": \\"Add your name in the body\\"\\n}\\n\\n\`\`\`\\n\\n#### **Step 4: Update the variable**\\n\\nVariables enable you to store and reuse values in Postman. We have created a variable called \`base_url\` with the sample request [https://postman-api-learner.glitch.me](https://postman-api-learner.glitch.me). Replace it with your API endpoint to customize this collection.\\n\\n#### **Step 5: Add tests in the \\"Tests\\" tab**\\n\\nTests help you confirm that your API is working as expected. You can write test scripts in JavaScript and view the output in the \\"Test Results\\" tab.\\n\\n\\n\\n## đź’Ş Pro tips\\n\\n- Use folders to group related requests and organize the collection.\\n- Add more scripts in \\"Tests\\" to verify if the API works as expected and execute flows.\\n \\n\\n## ℹ️ Resources\\n\\n[Building requests](https://learning.postman.com/docs/sending-requests/requests/) \\n[Authorizing requests](https://learning.postman.com/docs/sending-requests/authorization/) \\n[Using variables](https://learning.postman.com/docs/sending-requests/variables/) \\n[Managing environments](https://learning.postman.com/docs/sending-requests/managing-environments/) \\n[Writing scripts](https://learning.postman.com/docs/writing-scripts/intro-to-scripts/)","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},"item":[{"name":"Get data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Status code is 200\\", function () {"," pm.response.to.have.status(200);","});"],"type":"text/javascript"}}],"id":"ac995b4a-b579-42eb-9fa4-e7d98adc9625","request":{"method":"GET","header":[],"url":{"raw":"{{base_url}}/info?id=1","host":["{{base_url}}"],"path":["info"],"query":[{"key":"id","value":"1"}]},"description":"This is a GET request and it is used to \\"get\\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have \`id=1\`).\\n\\nA successful GET response will have a \`200 OK\` status, and should include some kind of response body - for example, HTML web content or JSON data."},"response":[]},{"name":"Post data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Successful POST request\\", function () {"," pm.expect(pm.response.code).to.be.oneOf([200, 201]);","});",""],"type":"text/javascript"}}],"id":"e9f7049b-c408-4b27-8acd-3c3ab368709f","request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\\n\\t\\"name\\": \\"Add your name in the body\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{base_url}}/info","host":["{{base_url}}"],"path":["info"]},"description":"This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.\\n\\nA successful POST request typically returns a \`200 OK\` or \`201 Created\` response code."},"response":[]},{"name":"Update data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Successful PUT request\\", function () {"," pm.expect(pm.response.code).to.be.oneOf([200, 201, 204]);","});",""],"type":"text/javascript"}}],"id":"0c86afea-8335-48d1-9252-5993dbfd5a15","request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\\n\\t\\"name\\": \\"Add your name in the body\\"\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{base_url}}/info?id=1","host":["{{base_url}}"],"path":["info"],"query":[{"key":"id","value":"1"}]},"description":"This is a PUT request and it is used to overwrite an existing piece of data. For instance, after you create an entity with a POST request, you may want to modify that later. You can do that using a PUT request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`).\\n\\nA successful PUT request typically returns a \`200 OK\`, \`201 Created\`, or \`204 No Content\` response code."},"response":[]},{"name":"Delete data","event":[{"listen":"test","script":{"exec":["pm.test(\\"Successful DELETE request\\", function () {"," pm.expect(pm.response.code).to.be.oneOf([200, 202, 204]);","});",""],"type":"text/javascript"}}],"id":"320fa3f9-f083-4df2-804c-f46f25130edd","request":{"method":"DELETE","header":[],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":{"raw":"{{base_url}}/info?id=1","host":["{{base_url}}"],"path":["info"],"query":[{"key":"id","value":"1"}]},"description":"This is a DELETE request, and it is used to delete data that was previously created via a POST request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`).\\n\\nA successful DELETE request typically returns a \`200 OK\`, \`202 Accepted\`, or \`204 No Content\` response code."},"response":[]}],"event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":[""]}},{"listen":"test","script":{"type":"text/javascript","exec":[""]}}],"variable":[{"id":"ddd8dc5d-ed2f-485a-b8b1-59698cbcc5ff","key":"id","value":"1"},{"id":"5fb35165-8910-4a51-9cf6-0fa89ee8d753","key":"base_url","value":"https://postman-rest-api-learner.glitch.me/"}]}", + "oriFileName": "3536ef55-d73b-41e6-a318-3e070fffbd4f.json", + }, + { + "contentStr": "{"info":{"_postman_id":"b5c671ea-e590-48fd-859c-805f6fc522bd","name":"API Documentation #reference","description":"This template contains a boilerplate for documentation that you can quickly customize and reuse.\\n\\n### How to use this template:\\n\\n- Replace the content given brackets (()) with your API's details.\\n- Tips are formatted in \`codespan\` - feel free to read and remove them.\\n \\n\\n---\\n\\n\`Start with a brief overview of what your API offers.\`\\n\\nThe ((product name)) provides many API products, tools, and resources that enable you to ((add product value here)).\\n\\n\`You can also list the APIs you offer, link to the relevant pages, or do both in this section.\`\\n\\n## **Getting started guide**\\n\\n\`List the steps or points required to start using your APIs. Make sure to cover everything required to reach success with your API as quickly as possible.\`\\n\\nTo start using the ((add APIs here)), you need to -\\n\\n\`The points given below are from The Postman API's documentation. You can reference it to write your own getting started guide.\`\\n\\n- You must use a valid API Key to send requests to the API endpoints. You can get your API key from Postman's [integrations dashboard](https://go.postman.co/settings/me/api-keys).\\n- The API has [rate and usage limits](https://learning.postman.com/docs/developer/postman-api/postman-api-rate-limits/).\\n- The API only responds to HTTPS-secured communications. Any requests sent via HTTP return an HTTP 301 redirect to the corresponding HTTPS resources.\\n- The API returns request responses in JSON format. When an API request returns an error, it is sent in the JSON response as an error key.\\n \\n\\n## Authentication\\n\\n\`Add details on the authorization keys/tokens required, steps that cover how to get them, and the relevant error codes.\`\\n\\nThe ((product name)) API uses ((add your API's authorization type)) for authentication.\\n\\n\`The details given below are from the Postman API's documentation. You can reference it to write your own authentication section.\`\\n\\nPostman uses API keys for authentication. You can generate a Postman API key in the [API keys](https://postman.postman.co/settings/me/api-keys) section of your Postman account settings.\\n\\nYou must include an API key in each request to the Postman API with the X-Api-Key request header.\\n\\n### Authentication error response\\n\\nIf an API key is missing, malformed, or invalid, you will receive an HTTP 401 Unauthorized response code.\\n\\n## Rate and usage limits\\n\\n\`Use this section to cover your APIs' terms of use. Include API limits, constraints, and relevant error codes, so consumers understand the permitted API usage and practices.\`\\n\\n\`The example given below is from The Postman API's documentation. Use it as a reference to write your APIs' terms of use.\`\\n\\nAPI access rate limits apply at a per-API key basis in unit time. The limit is 300 requests per minute. Also, depending on your plan, you may have usage limits. If you exceed either limit, your request will return an HTTP 429 Too Many Requests status code.\\n\\nEach API response returns the following set of headers to help you identify your use status:\\n\\n| Header | Description |\\n| --- | --- |\\n| \`X-RateLimit-Limit\` | The maximum number of requests that the consumer is permitted to make per minute. |\\n| \`X-RateLimit-Remaining\` | The number of requests remaining in the current rate limit window. |\\n| \`X-RateLimit-Reset\` | The time at which the current rate limit window resets in UTC epoch seconds. |\\n\\n### 503 response\\n\\nAn HTTP \`503\` response from our servers indicates there is an unexpected spike in API access traffic. The server is usually operational within the next five minutes. If the outage persists or you receive any other form of an HTTP \`5XX\` error, [contact support](https://support.postman.com/hc/en-us/requests/new/).\\n\\n### **Need some help?**\\n\\n\`Add links that customers can refer to whenever they need help.\`\\n\\nIn case you have questions, go through our tutorials ((link to your video or help documentation here)). Or visit our FAQ page ((link to the relevant page)).\\n\\nOr you can check out our community forum, there’s a good chance our community has an answer for you. Visit our developer forum ((link to developer forum)) to review topics, ask questions, and learn from others.\\n\\n\`You can also document or add links to libraries, code examples, and other resources needed to make a request.\`","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},"item":[{"name":"User","item":[{"name":"Get authenticated user","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript"}}],"id":"c45b9fdb-ca65-46e0-b82f-8e329d8f72d0","request":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/me?foo=bar","protocol":"https","host":["api","getpostman","com"],"path":["me"],"query":[{"key":"foo","value":"bar"}]},"description":"Gets information about the authenticated user."},"response":[{"id":"fbc46823-e8f6-4d93-80bd-18cf38767fb5","name":"Successful Response","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/me","protocol":"https","host":["api","getpostman","com"],"path":["me"]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"user\\": {\\n \\"id\\": 12345678,\\n \\"username\\": \\"taylor-lee\\",\\n \\"email\\": \\"taylor.lee@example.com\\",\\n \\"fullName\\": \\"Taylor Lee\\",\\n \\"avatar\\": \\"https://example.com/user/r5u9qpvmujfjf6lbqmga.jpg\\",\\n \\"isPublic\\": true\\n },\\n \\"operations\\": [\\n {\\n \\"name\\": \\"mock_usage\\",\\n \\"limit\\": 1000000,\\n \\"usage\\": 110276,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"monitor_request_runs\\",\\n \\"limit\\": 10000000,\\n \\"usage\\": 1141750,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"api_usage\\",\\n \\"limit\\": 1000000,\\n \\"usage\\": 16240,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"custom_domains\\",\\n \\"limit\\": 25,\\n \\"usage\\": 25,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"serverless_requests\\",\\n \\"limit\\": 10000,\\n \\"usage\\": 0,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"integrations\\",\\n \\"limit\\": 5000,\\n \\"usage\\": 1018,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"cloud_agent_requests\\",\\n \\"limit\\": 1000000,\\n \\"usage\\": 1615,\\n \\"overage\\": 0\\n }\\n ]\\n}"},{"id":"0e06eed6-753d-44a3-8971-02524a837b34","name":"Rate Limit Exceeded","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/me","protocol":"https","host":["api","getpostman","com"],"path":["me"]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]}],"id":"06f2038f-e2ff-4eac-8199-ca6e80109fbc","description":"The \`/me\` endpoints let you manage information about the authenticated user."},{"name":"Collections","item":[{"name":"Create a collection","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript"}}],"id":"9fde55ff-03dc-4647-a2a6-e1a0ab688e6b","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"{{collectionName}}\\",\\n \\"schema\\": \\"{{collectionSchemaUrl}}\\"\\n },\\n \\"item\\": [\\n {\\n \\"request\\": {}\\n }\\n ]\\n }\\n}"},"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"{{workspaceId}}","description":"Optional. A workspace ID in which to create the collection.\\n\\nIf you do not include this query parameter, the system creates the collection in your \\"My Workspace\\" workspace.","disabled":true}]},"description":"Creates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html). Include a \`collection\` object in the request body that contains the following required properties:\\n\\n* \`info\` — An **object** that contains the following properties:\\n * \`name\` — A **string** value that contains the collection's name.\\n * \`schema\` — A **string** that contains a URL to the collection's schema. For example, the \`https://schema.getpostman.com/collection/v1\` URL.\\n* \`item\` — An **object** that contains the HTTP request and response information.\\n * \`request\` — An **object** that contains the collection's request information. For a complete list of values, refer to the \`definitions.request\` entry in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json). If you pass an empty object for this value, the system defaults to an untitled GET request.\\n\\n**Note:**\\n\\n* For a complete list of available property values for this endpoint, use the following references available in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json):\\n * \`info\` object — Use the \`definitions.info\` entry.\\n * \`item\` object — Use the \`definitions.items\` entry.\\n* For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json)."},"response":[{"id":"6d0bb769-cc1c-433c-861b-5d3857a3ba5b","name":"Successful Response","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID in which to create the collection.\\n\\nIf you do not include this query parameter, the system creates the collection in your \\"My Workspace\\" workspace.","disabled":true}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collection\\": {\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"name\\": \\"Test Collection\\",\\n \\"uid\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n}"},{"id":"564934db-16a7-4326-bb5b-6d95afe7a3c0","name":"Bad Request","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID in which to create the collection.\\n\\nIf you do not include this query parameter, the system creates the collection in your \\"My Workspace\\" workspace.","disabled":true}]}},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"instanceFoundError\\",\\n \\"message\\": \\"The specified item already exists.\\",\\n \\"details\\": {\\n \\"item\\": \\"collection\\",\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n }\\n}"},{"id":"3dfe49b5-04a4-40a8-9ee8-851f2c04f630","name":"Malformed Request","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID in which to create the collection.\\n\\nIf you do not include this query parameter, the system creates the collection in your \\"My Workspace\\" workspace.","disabled":true}]}},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"malformedRequestError\\",\\n \\"message\\": \\"Found 1 errors with the supplied collection.\\",\\n \\"details\\": [\\n \\": must have required property 'info'\\"\\n ]\\n }\\n}"},{"id":"4497da03-bdc3-426b-848c-044f4657c2e3","name":"Rate Limit Exceeded","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID in which to create the collection.\\n\\nIf you do not include this query parameter, the system creates the collection in your \\"My Workspace\\" workspace.","disabled":true}]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":""}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]},{"name":"Get a collection","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript"}}],"id":"842317ed-6f33-4431-877f-12b74b2fdfc3","request":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections/{{collectionId}}","protocol":"https","host":["api","getpostman","com"],"path":["collections","{{collectionId}}"],"query":[{"key":"access_key","value":"{{accessKey}}","description":"Optional. A collection's read-only access key. Using this query parameter does not require an API key to call the endpoint.","disabled":true}]},"description":"Gets information about a collection. For a complete list of this endpoint's possible values, use the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json)."},"response":[{"id":"b1ab935d-4278-43b5-8b6a-3c5fc55c0150","name":"Successful Response","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This is a test collection that makes a tiny request to Postman Echo service to get the list of request headers sent by a HTTP client.\\",\\n \\"_postman_id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.0.0/collection.json\\",\\n \\"updatedAt\\": \\"2022-06-16T20:21:13.000Z\\",\\n \\"fork\\": {\\n \\"label\\": \\"Test Fork\\",\\n \\"createdAt\\": \\"2022-06-16T19:51:44.069Z\\",\\n \\"from\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"id\\": \\"82ee981b-e19f-962a-401e-ea34ebfb4848\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n },\\n \\"response\\": []\\n }\\n ]\\n }\\n}"},{"id":"5c80382b-0a24-4e5f-95c6-d762f79b0fed","name":"Get Collection with Access Token","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2?access_key={{accessKey}}","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"],"query":[{"key":"access_key","value":"{{accessKey}}"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This is a test collection that makes a tiny request to Postman Echo service to get the list of request headers sent by a HTTP client.\\",\\n \\"_postman_id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.0.0/collection.json\\",\\n \\"updatedAt\\": \\"2022-06-16T20:21:13.000Z\\",\\n \\"fork\\": {\\n \\"label\\": \\"Test Fork\\",\\n \\"createdAt\\": \\"2022-06-16T19:51:44.069Z\\",\\n \\"from\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"id\\": \\"82ee981b-e19f-962a-401e-ea34ebfb4848\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n },\\n \\"response\\": []\\n }\\n ]\\n }\\n}"},{"id":"3dc98d61-85cf-450d-9f57-c2fa43b94beb","name":"Not Found","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Not Found","code":404,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"instanceNotFoundError\\",\\n \\"message\\": \\"We could not find the collection you are looking for\\"\\n }\\n}"},{"id":"b17c821e-4d3d-474d-8b21-11be4894ea6a","name":"Rate Limit Exceeded","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]},{"name":"Delete a collection","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript"}}],"id":"7254f847-5556-48b6-a93e-8c963cd4301d","request":{"method":"DELETE","header":[],"url":{"raw":"https://api.getpostman.com/collections/{{collectionId}}","protocol":"https","host":["api","getpostman","com"],"path":["collections","{{collectionId}}"]},"description":"Deletes a collection."},"response":[{"id":"caee4598-71c9-4903-9081-cb656ebc9801","name":"Successful Response","originalRequest":{"method":"DELETE","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collection\\": {\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"uid\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n}"},{"id":"52562d48-6a20-4a71-b502-e29145600a0e","name":"Not Found","originalRequest":{"method":"DELETE","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Not Found","code":404,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"instanceNotFoundError\\",\\n \\"message\\": \\"The specified item does not exist.\\",\\n \\"details\\": {\\n \\"item\\": \\"collection\\",\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n }\\n}"},{"id":"aaa204c3-3289-4b14-ab77-ed17b754ae7d","name":"Rate Limit Exceeded","originalRequest":{"method":"DELETE","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]},{"name":"Update a collection","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript"}}],"id":"8cd704f6-3da1-498f-bf43-748e8b899f08","request":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"{{collectionName}}\\",\\n \\"schema\\": \\"{{collectionSchemaUrl}}\\"\\n },\\n \\"item\\": [\\n {\\n \\"request\\": {}\\n }\\n ]\\n }\\n}"},"url":{"raw":"https://api.getpostman.com/collections/{{collectionId}}","protocol":"https","host":["api","getpostman","com"],"path":["collections","{{collectionId}}"]},"description":"Updates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html). Include a \`collection\` object in the request body that contains the following required properties:\\n\\n- \`info\` — An **object** that contains the following properties:\\n - \`name\` — A **string** value that contains the collection's name.\\n - \`schema\` — A **string** that contains a URL to the collection's schema. For example, the \`https://schema.getpostman.com/collection/v1\` URL.\\n- \`item\` — An **object** that contains the HTTP request and response information.\\n - \`request\` — An **object** that contains the collection's request information. For a complete list of values, refer to the \`definitions.request\` entry in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json). If you pass an empty object for this value, the system defaults to an untitled GET request.\\n\\n**Note:**\\n\\n- For a complete list of available property values for this endpoint, use the following references available in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json):\\n - \`info\` object — Use the \`definitions.info\` entry.\\n - \`item\` object — Use the \`definitions.items\` entry.\\n- For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json).\\n \\n\\n### Important\\n\\nUse caution when using this endpoint. The system will replace the existing collection with the values passed in the request body."},"response":[{"id":"217bf80c-e1a1-4baf-b314-8ea8896d2662","name":"Successful Response","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test POST Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"POST\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collection\\": {\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"name\\": \\"Test Collection\\",\\n \\"uid\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n}"},{"id":"7a607fbf-9b80-40e9-b7f3-5fda790ce5f8","name":"Forbidden","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test POST Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"POST\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Forbidden","code":403,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"forbiddenError\\",\\n \\"message\\": \\"You do not have enough permissions to perform this action.\\"\\n }\\n}"},{"id":"6d9a934c-e0bb-49fd-9878-1e9b0a1e0c9d","name":"Not Found","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test POST Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"POST\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Not Found","code":404,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"instanceNotFoundError\\",\\n \\"message\\": \\"The specified item does not exist.\\",\\n \\"details\\": {\\n \\"item\\": \\"collection\\",\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n }\\n}"},{"id":"566e2348-007a-47b3-a308-420422f65411","name":"Malformed Request","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\"\\n }\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"malformedRequestError\\",\\n \\"message\\": \\"Found 2 errors with the supplied collection.\\",\\n \\"details\\": [\\n \\": must have required property 'item'\\",\\n \\"info: must have required property 'schema'\\"\\n ]\\n }\\n}"},{"id":"64f4ecc7-2f3e-40b0-bc0e-8fab6a5e6461","name":"Collection ID Mismatch","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test POST Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"POST\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"collectionMismatchError\\",\\n \\"message\\": \\"The collection ID in the path does not match the collection ID in the request body.\\"\\n }\\n}"},{"id":"072842f8-01e1-4d4f-99e9-50ed9265966b","name":"Rate Limit Exceeded","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test POST Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"POST\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]},{"name":"Get all collections","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript"}}],"id":"5b05bc1b-3a2c-4612-be40-f427b8392e0b","request":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"{{workspaceId}}","description":"Optional. A workspace ID.","disabled":true}]},"description":"Gets all of your [collections](https://www.getpostman.com/docs/collections). The response includes all of your subscribed collections."},"response":[{"id":"fec2b543-4dda-46bb-92fd-d2faeae1a2c2","name":"Successful Response","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID.","disabled":true}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collections\\": [\\n {\\n \\"id\\": \\"dac5eac9-148d-a32e-b76b-3edee9da28f7\\",\\n \\"name\\": \\"Cloud API\\",\\n \\"owner\\": \\"12345678\\",\\n \\"createdAt\\": \\"2022-04-12T10:29:46.000Z\\",\\n \\"updatedAt\\": \\"2022-04-12T10:29:56.000Z\\",\\n \\"uid\\": \\"12345678-dac5eac9-148d-a32e-b76b-3edee9da28f7\\",\\n \\"isPublic\\": true\\n },\\n {\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"name\\": \\"Test Collection\\",\\n \\"owner\\": \\"12345678\\",\\n \\"createdAt\\": \\"2022-01-13T10:21:46.000Z\\",\\n \\"updatedAt\\": \\"2022-02-12T11:29:56.000Z\\",\\n \\"uid\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"isPublic\\": false,\\n \\"fork\\": {\\n \\"label\\": \\"Test Fork\\",\\n \\"createdAt\\": \\"2022-06-16T19:51:44.069Z\\",\\n \\"from\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n },\\n {\\n \\"id\\": \\"f695cab7-6878-eb55-7943-ad88e1ccfd65\\",\\n \\"name\\": \\"Postman Echo\\",\\n \\"owner\\": \\"12345678\\",\\n \\"createdAt\\": \\"2021-04-11T09:18:26.000Z\\",\\n \\"updatedAt\\": \\"2022-05-01T15:29:32.000Z\\",\\n \\"uid\\": \\"12345678-f695cab7-6878-eb55-7943-ad88e1ccfd65\\",\\n \\"isPublic\\": true\\n }\\n ]\\n}"},{"id":"97e0130c-7326-45dd-b247-8e89f31af84e","name":"Filter by Workspace","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections?workspace=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID."}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collections\\": [\\n {\\n \\"id\\": \\"dac5eac9-148d-a32e-b76b-3edee9da28f7\\",\\n \\"name\\": \\"Cloud API\\",\\n \\"owner\\": \\"12345678\\",\\n \\"createdAt\\": \\"2022-04-12T10:29:46.000Z\\",\\n \\"updatedAt\\": \\"2022-04-12T10:29:56.000Z\\",\\n \\"uid\\": \\"12345678-dac5eac9-148d-a32e-b76b-3edee9da28f7\\",\\n \\"isPublic\\": true\\n }\\n ]\\n}"},{"id":"6c7986b8-e177-4eb4-af8a-dd0b78a2d01a","name":"Rate Limit Exceeded","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID.","disabled":true}]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]}],"id":"feb947c5-d4b3-45f3-9b16-268d45acfb34","description":"The \`/collections\` endpoints let you manage your [collections](https://learning.postman.com/docs/sending-requests/intro-to-collections/)."}],"auth":{"type":"apikey","apikey":[{"key":"key","value":"X-API-Key","type":"string"},{"key":"value","value":"{{token}}","type":"string"}]},"event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":[""]}},{"listen":"test","script":{"type":"text/javascript","exec":[""]}}],"variable":[{"id":"50eeaf0a-dece-4593-8af0-4ebbc9832d00","key":"baseUrl","value":"https://farming-simulator.pstmn.io"}]}", + "oriFileName": "b5c671ea-e590-48fd-859c-805f6fc522bd.json", + }, + { + "contentStr": "{"info":{"_postman_id":"c1d9f3ea-a477-4303-a53e-66a68d730566","name":"API Documentation #reference","description":"This template contains a boilerplate for documentation that you can quickly customize and reuse.\\n\\n### How to use this template:\\n\\n- Replace the content given brackets (()) with your API's details.\\n- Tips are formatted in \`codespan\` - feel free to read and remove them.\\n \\n\\n---\\n\\n\`Start with a brief overview of what your API offers.\`\\n\\nThe ((product name)) provides many API products, tools, and resources that enable you to ((add product value here)).\\n\\n\`You can also list the APIs you offer, link to the relevant pages, or do both in this section.\`\\n\\n## **Getting started guide**\\n\\n\`List the steps or points required to start using your APIs. Make sure to cover everything required to reach success with your API as quickly as possible.\`\\n\\nTo start using the ((add APIs here)), you need to -\\n\\n\`The points given below are from The Postman API's documentation. You can reference it to write your own getting started guide.\`\\n\\n- You must use a valid API Key to send requests to the API endpoints. You can get your API key from Postman's [integrations dashboard](https://go.postman.co/settings/me/api-keys).\\n- The API has [rate and usage limits](https://learning.postman.com/docs/developer/postman-api/postman-api-rate-limits/).\\n- The API only responds to HTTPS-secured communications. Any requests sent via HTTP return an HTTP 301 redirect to the corresponding HTTPS resources.\\n- The API returns request responses in JSON format. When an API request returns an error, it is sent in the JSON response as an error key.\\n \\n\\n## Authentication\\n\\n\`Add details on the authorization keys/tokens required, steps that cover how to get them, and the relevant error codes.\`\\n\\nThe ((product name)) API uses ((add your API's authorization type)) for authentication.\\n\\n\`The details given below are from the Postman API's documentation. You can reference it to write your own authentication section.\`\\n\\nPostman uses API keys for authentication. You can generate a Postman API key in the [API keys](https://postman.postman.co/settings/me/api-keys) section of your Postman account settings.\\n\\nYou must include an API key in each request to the Postman API with the X-Api-Key request header.\\n\\n### Authentication error response\\n\\nIf an API key is missing, malformed, or invalid, you will receive an HTTP 401 Unauthorized response code.\\n\\n## Rate and usage limits\\n\\n\`Use this section to cover your APIs' terms of use. Include API limits, constraints, and relevant error codes, so consumers understand the permitted API usage and practices.\`\\n\\n\`The example given below is from The Postman API's documentation. Use it as a reference to write your APIs' terms of use.\`\\n\\nAPI access rate limits apply at a per-API key basis in unit time. The limit is 300 requests per minute. Also, depending on your plan, you may have usage limits. If you exceed either limit, your request will return an HTTP 429 Too Many Requests status code.\\n\\nEach API response returns the following set of headers to help you identify your use status:\\n\\n| Header | Description |\\n| --- | --- |\\n| \`X-RateLimit-Limit\` | The maximum number of requests that the consumer is permitted to make per minute. |\\n| \`X-RateLimit-Remaining\` | The number of requests remaining in the current rate limit window. |\\n| \`X-RateLimit-Reset\` | The time at which the current rate limit window resets in UTC epoch seconds. |\\n\\n### 503 response\\n\\nAn HTTP \`503\` response from our servers indicates there is an unexpected spike in API access traffic. The server is usually operational within the next five minutes. If the outage persists or you receive any other form of an HTTP \`5XX\` error, [contact support](https://support.postman.com/hc/en-us/requests/new/).\\n\\n### **Need some help?**\\n\\n\`Add links that customers can refer to whenever they need help.\`\\n\\nIn case you have questions, go through our tutorials ((link to your video or help documentation here)). Or visit our FAQ page ((link to the relevant page)).\\n\\nOr you can check out our community forum, there’s a good chance our community has an answer for you. Visit our developer forum ((link to developer forum)) to review topics, ask questions, and learn from others.\\n\\n\`You can also document or add links to libraries, code examples, and other resources needed to make a request.\`","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},"item":[{"name":"User","item":[{"name":"Get authenticated user","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript","id":"4970647e-50f1-4e26-9304-4381e3b39abd"}}],"id":"130a5b16-3637-4401-ba7b-5a694bf9c6a2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/me?foo=bar","protocol":"https","host":["api","getpostman","com"],"path":["me"],"query":[{"key":"foo","value":"bar"}]},"description":"Gets information about the authenticated user."},"response":[{"id":"90844e24-0167-44c6-b72e-b7bcadfcd885","name":"Successful Response","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/me","protocol":"https","host":["api","getpostman","com"],"path":["me"]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"user\\": {\\n \\"id\\": 12345678,\\n \\"username\\": \\"taylor-lee\\",\\n \\"email\\": \\"taylor.lee@example.com\\",\\n \\"fullName\\": \\"Taylor Lee\\",\\n \\"avatar\\": \\"https://example.com/user/r5u9qpvmujfjf6lbqmga.jpg\\",\\n \\"isPublic\\": true\\n },\\n \\"operations\\": [\\n {\\n \\"name\\": \\"mock_usage\\",\\n \\"limit\\": 1000000,\\n \\"usage\\": 110276,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"monitor_request_runs\\",\\n \\"limit\\": 10000000,\\n \\"usage\\": 1141750,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"api_usage\\",\\n \\"limit\\": 1000000,\\n \\"usage\\": 16240,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"custom_domains\\",\\n \\"limit\\": 25,\\n \\"usage\\": 25,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"serverless_requests\\",\\n \\"limit\\": 10000,\\n \\"usage\\": 0,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"integrations\\",\\n \\"limit\\": 5000,\\n \\"usage\\": 1018,\\n \\"overage\\": 0\\n },\\n {\\n \\"name\\": \\"cloud_agent_requests\\",\\n \\"limit\\": 1000000,\\n \\"usage\\": 1615,\\n \\"overage\\": 0\\n }\\n ]\\n}"},{"id":"b94090db-3f31-4bf5-b7a5-7679498fe818","name":"Rate Limit Exceeded","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/me","protocol":"https","host":["api","getpostman","com"],"path":["me"]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]}],"id":"045e13d8-5f1f-423a-ad1d-93e6f56ac5e9","description":"The \`/me\` endpoints let you manage information about the authenticated user."},{"name":"Collections","item":[{"name":"Create a collection","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript","id":"3b0b21ec-f15a-44a8-9acd-ea96570b65d4"}}],"id":"7edb3830-2e1e-4a56-bdab-ea96de05a6c3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"{{collectionName}}\\",\\n \\"schema\\": \\"{{collectionSchemaUrl}}\\"\\n },\\n \\"item\\": [\\n {\\n \\"request\\": {}\\n }\\n ]\\n }\\n}"},"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"{{workspaceId}}","description":"Optional. A workspace ID in which to create the collection.\\n\\nIf you do not include this query parameter, the system creates the collection in your \\"My Workspace\\" workspace.","disabled":true}]},"description":"Creates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html). Include a \`collection\` object in the request body that contains the following required properties:\\n\\n* \`info\` — An **object** that contains the following properties:\\n * \`name\` — A **string** value that contains the collection's name.\\n * \`schema\` — A **string** that contains a URL to the collection's schema. For example, the \`https://schema.getpostman.com/collection/v1\` URL.\\n* \`item\` — An **object** that contains the HTTP request and response information.\\n * \`request\` — An **object** that contains the collection's request information. For a complete list of values, refer to the \`definitions.request\` entry in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json). If you pass an empty object for this value, the system defaults to an untitled GET request.\\n\\n**Note:**\\n\\n* For a complete list of available property values for this endpoint, use the following references available in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json):\\n * \`info\` object — Use the \`definitions.info\` entry.\\n * \`item\` object — Use the \`definitions.items\` entry.\\n* For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json)."},"response":[{"id":"ab27d404-ae39-4384-9ec3-a7a1c2b745f3","name":"Successful Response","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID in which to create the collection.\\n\\nIf you do not include this query parameter, the system creates the collection in your \\"My Workspace\\" workspace.","disabled":true}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collection\\": {\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"name\\": \\"Test Collection\\",\\n \\"uid\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n}"},{"id":"48e152f2-d133-451a-8024-047f2ee99314","name":"Bad Request","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID in which to create the collection.\\n\\nIf you do not include this query parameter, the system creates the collection in your \\"My Workspace\\" workspace.","disabled":true}]}},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"instanceFoundError\\",\\n \\"message\\": \\"The specified item already exists.\\",\\n \\"details\\": {\\n \\"item\\": \\"collection\\",\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n }\\n}"},{"id":"96807f77-9e01-4847-b4c0-bac8473d1871","name":"Malformed Request","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID in which to create the collection.\\n\\nIf you do not include this query parameter, the system creates the collection in your \\"My Workspace\\" workspace.","disabled":true}]}},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"malformedRequestError\\",\\n \\"message\\": \\"Found 1 errors with the supplied collection.\\",\\n \\"details\\": [\\n \\": must have required property 'info'\\"\\n ]\\n }\\n}"},{"id":"f1f04710-e8e1-43cb-92b9-06651b5920e9","name":"Rate Limit Exceeded","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID in which to create the collection.\\n\\nIf you do not include this query parameter, the system creates the collection in your \\"My Workspace\\" workspace.","disabled":true}]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":""}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]},{"name":"Get a collection","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript","id":"ee889cdf-7c48-49ea-a5f5-b9cf7698131e"}}],"id":"30ff07f0-f24b-41db-ade3-717b7dfe33d6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections/{{collectionId}}","protocol":"https","host":["api","getpostman","com"],"path":["collections","{{collectionId}}"],"query":[{"key":"access_key","value":"{{accessKey}}","description":"Optional. A collection's read-only access key. Using this query parameter does not require an API key to call the endpoint.","disabled":true}]},"description":"Gets information about a collection. For a complete list of this endpoint's possible values, use the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json)."},"response":[{"id":"e16f3bad-19e9-498a-afa4-30d9d18fc8fb","name":"Successful Response","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This is a test collection that makes a tiny request to Postman Echo service to get the list of request headers sent by a HTTP client.\\",\\n \\"_postman_id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.0.0/collection.json\\",\\n \\"updatedAt\\": \\"2022-06-16T20:21:13.000Z\\",\\n \\"fork\\": {\\n \\"label\\": \\"Test Fork\\",\\n \\"createdAt\\": \\"2022-06-16T19:51:44.069Z\\",\\n \\"from\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"id\\": \\"82ee981b-e19f-962a-401e-ea34ebfb4848\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n },\\n \\"response\\": []\\n }\\n ]\\n }\\n}"},{"id":"6cf37b68-7216-4877-97ab-a8a71c34dc9c","name":"Get Collection with Access Token","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2?access_key={{accessKey}}","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"],"query":[{"key":"access_key","value":"{{accessKey}}"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This is a test collection that makes a tiny request to Postman Echo service to get the list of request headers sent by a HTTP client.\\",\\n \\"_postman_id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.0.0/collection.json\\",\\n \\"updatedAt\\": \\"2022-06-16T20:21:13.000Z\\",\\n \\"fork\\": {\\n \\"label\\": \\"Test Fork\\",\\n \\"createdAt\\": \\"2022-06-16T19:51:44.069Z\\",\\n \\"from\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test GET Response\\",\\n \\"id\\": \\"82ee981b-e19f-962a-401e-ea34ebfb4848\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"GET\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n },\\n \\"response\\": []\\n }\\n ]\\n }\\n}"},{"id":"1133038a-5a9f-4707-85f4-8967c8f7ec0a","name":"Not Found","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Not Found","code":404,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"instanceNotFoundError\\",\\n \\"message\\": \\"We could not find the collection you are looking for\\"\\n }\\n}"},{"id":"312e6d12-cb42-4780-b40b-26dc5475c2a1","name":"Rate Limit Exceeded","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]},{"name":"Delete a collection","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript","id":"8e9e145f-cc78-493f-908d-c8cc329d02ee"}}],"id":"72b29134-0943-4498-b882-4d7a4852a971","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":{"raw":"https://api.getpostman.com/collections/{{collectionId}}","protocol":"https","host":["api","getpostman","com"],"path":["collections","{{collectionId}}"]},"description":"Deletes a collection."},"response":[{"id":"40a0e1b1-448f-4562-b5c2-fa4c25c0ccbe","name":"Successful Response","originalRequest":{"method":"DELETE","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collection\\": {\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"uid\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n}"},{"id":"6153e93e-1c15-4654-be62-d17eaf6e9ea7","name":"Not Found","originalRequest":{"method":"DELETE","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Not Found","code":404,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"instanceNotFoundError\\",\\n \\"message\\": \\"The specified item does not exist.\\",\\n \\"details\\": {\\n \\"item\\": \\"collection\\",\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n }\\n}"},{"id":"27cd7904-106f-4709-a3d8-5d5abc7c8515","name":"Rate Limit Exceeded","originalRequest":{"method":"DELETE","header":[],"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]},{"name":"Update a collection","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript","id":"0ec8d372-1c52-4a2d-8cc1-8d4de7c87282"}}],"id":"2302503c-3714-4c93-8311-e5813b1b7965","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"{{collectionName}}\\",\\n \\"schema\\": \\"{{collectionSchemaUrl}}\\"\\n },\\n \\"item\\": [\\n {\\n \\"request\\": {}\\n }\\n ]\\n }\\n}"},"url":{"raw":"https://api.getpostman.com/collections/{{collectionId}}","protocol":"https","host":["api","getpostman","com"],"path":["collections","{{collectionId}}"]},"description":"Updates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html). Include a \`collection\` object in the request body that contains the following required properties:\\n\\n- \`info\` — An **object** that contains the following properties:\\n - \`name\` — A **string** value that contains the collection's name.\\n - \`schema\` — A **string** that contains a URL to the collection's schema. For example, the \`https://schema.getpostman.com/collection/v1\` URL.\\n- \`item\` — An **object** that contains the HTTP request and response information.\\n - \`request\` — An **object** that contains the collection's request information. For a complete list of values, refer to the \`definitions.request\` entry in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json). If you pass an empty object for this value, the system defaults to an untitled GET request.\\n\\n**Note:**\\n\\n- For a complete list of available property values for this endpoint, use the following references available in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json):\\n - \`info\` object — Use the \`definitions.info\` entry.\\n - \`item\` object — Use the \`definitions.items\` entry.\\n- For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json).\\n \\n\\n### Important\\n\\nUse caution when using this endpoint. The system will replace the existing collection with the values passed in the request body."},"response":[{"id":"2df93998-3d02-4e92-9f3d-74894abc24b5","name":"Successful Response","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test POST Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"POST\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collection\\": {\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"name\\": \\"Test Collection\\",\\n \\"uid\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n}"},{"id":"b5346f4b-94d3-4fde-a971-246923f1f93c","name":"Forbidden","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test POST Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"POST\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Forbidden","code":403,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"forbiddenError\\",\\n \\"message\\": \\"You do not have enough permissions to perform this action.\\"\\n }\\n}"},{"id":"69de4be7-ccb6-45be-bed2-61702b9cb410","name":"Not Found","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test POST Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"POST\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Not Found","code":404,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"instanceNotFoundError\\",\\n \\"message\\": \\"The specified item does not exist.\\",\\n \\"details\\": {\\n \\"item\\": \\"collection\\",\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n }\\n}"},{"id":"9bc6633c-9524-45c0-8cb5-65eb85821870","name":"Malformed Request","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\"\\n }\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"malformedRequestError\\",\\n \\"message\\": \\"Found 2 errors with the supplied collection.\\",\\n \\"details\\": [\\n \\": must have required property 'item'\\",\\n \\"info: must have required property 'schema'\\"\\n ]\\n }\\n}"},{"id":"6ff48ecc-3508-4ba8-be51-23a7d8332f8e","name":"Collection ID Mismatch","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test POST Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"POST\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Bad Request","code":400,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": {\\n \\"name\\": \\"collectionMismatchError\\",\\n \\"message\\": \\"The collection ID in the path does not match the collection ID in the request body.\\"\\n }\\n}"},{"id":"e4cdb1d9-3d3b-47aa-9598-15d0758f9d90","name":"Rate Limit Exceeded","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\\n \\"collection\\": {\\n \\"info\\": {\\n \\"name\\": \\"Test Collection\\",\\n \\"description\\": \\"This collection makes a request to the Postman Echo service to get a list of request headers sent by an HTTP client.\\",\\n \\"schema\\": \\"https://schema.getpostman.com/json/collection/v2.1.0/collection.json\\"\\n },\\n \\"item\\": [\\n {\\n \\"name\\": \\"Test POST Response\\",\\n \\"event\\": [\\n {\\n \\"listen\\": \\"test\\",\\n \\"script\\": {\\n \\"id\\": \\"7d2334fc-a84a-4c3d-b26c-7529afa4c0ae\\",\\n \\"exec\\": [\\n \\"pm.test(\\\\\\"Status code is 200\\\\\\", function () {\\",\\n \\" pm.response.to.have.status(200);\\",\\n \\"});\\"\\n ],\\n \\"type\\": \\"text/javascript\\"\\n }\\n }\\n ],\\n \\"request\\": {\\n \\"url\\": \\"https://echo.getpostman.com/headers\\",\\n \\"method\\": \\"POST\\",\\n \\"header\\": [\\n {\\n \\"key\\": \\"Content-Type\\",\\n \\"value\\": \\"application/json\\"\\n }\\n ]\\n }\\n }\\n ]\\n }\\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"https://api.getpostman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2","protocol":"https","host":["api","getpostman","com"],"path":["collections","12ece9e1-2abf-4edc-8e34-de66e74114d2"]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]},{"name":"Get all collections","event":[{"listen":"test","script":{"exec":[""],"type":"text/javascript","id":"3a98d801-0fd3-4600-849d-6acf40207b50"}}],"id":"0e37a837-218f-4d49-8097-1d823310df5f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"{{workspaceId}}","description":"Optional. A workspace ID.","disabled":true}]},"description":"Gets all of your [collections](https://www.getpostman.com/docs/collections). The response includes all of your subscribed collections."},"response":[{"id":"b4e93ea6-ddd7-4889-9687-7955bda4635d","name":"Successful Response","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID.","disabled":true}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collections\\": [\\n {\\n \\"id\\": \\"dac5eac9-148d-a32e-b76b-3edee9da28f7\\",\\n \\"name\\": \\"Cloud API\\",\\n \\"owner\\": \\"12345678\\",\\n \\"createdAt\\": \\"2022-04-12T10:29:46.000Z\\",\\n \\"updatedAt\\": \\"2022-04-12T10:29:56.000Z\\",\\n \\"uid\\": \\"12345678-dac5eac9-148d-a32e-b76b-3edee9da28f7\\",\\n \\"isPublic\\": true\\n },\\n {\\n \\"id\\": \\"12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"name\\": \\"Test Collection\\",\\n \\"owner\\": \\"12345678\\",\\n \\"createdAt\\": \\"2022-01-13T10:21:46.000Z\\",\\n \\"updatedAt\\": \\"2022-02-12T11:29:56.000Z\\",\\n \\"uid\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\",\\n \\"isPublic\\": false,\\n \\"fork\\": {\\n \\"label\\": \\"Test Fork\\",\\n \\"createdAt\\": \\"2022-06-16T19:51:44.069Z\\",\\n \\"from\\": \\"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\\"\\n }\\n },\\n {\\n \\"id\\": \\"f695cab7-6878-eb55-7943-ad88e1ccfd65\\",\\n \\"name\\": \\"Postman Echo\\",\\n \\"owner\\": \\"12345678\\",\\n \\"createdAt\\": \\"2021-04-11T09:18:26.000Z\\",\\n \\"updatedAt\\": \\"2022-05-01T15:29:32.000Z\\",\\n \\"uid\\": \\"12345678-f695cab7-6878-eb55-7943-ad88e1ccfd65\\",\\n \\"isPublic\\": true\\n }\\n ]\\n}"},{"id":"aa626b8e-5871-4b08-bd6a-b43f45aff02c","name":"Filter by Workspace","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections?workspace=1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID."}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"collections\\": [\\n {\\n \\"id\\": \\"dac5eac9-148d-a32e-b76b-3edee9da28f7\\",\\n \\"name\\": \\"Cloud API\\",\\n \\"owner\\": \\"12345678\\",\\n \\"createdAt\\": \\"2022-04-12T10:29:46.000Z\\",\\n \\"updatedAt\\": \\"2022-04-12T10:29:56.000Z\\",\\n \\"uid\\": \\"12345678-dac5eac9-148d-a32e-b76b-3edee9da28f7\\",\\n \\"isPublic\\": true\\n }\\n ]\\n}"},{"id":"d8f81b34-d4ef-486a-8b47-62414388adbd","name":"Rate Limit Exceeded","originalRequest":{"method":"GET","header":[],"url":{"raw":"https://api.getpostman.com/collections","protocol":"https","host":["api","getpostman","com"],"path":["collections"],"query":[{"key":"workspace","value":"1f0df51a-8658-4ee8-a2a1-d2567dfa09a9","description":"Optional. A workspace ID.","disabled":true}]}},"status":"Too Many Requests","code":429,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\\n \\"error\\": \\"rateLimited\\",\\n \\"message\\": \\"Rate limit exceeded. Please retry after 1669048687\\"\\n}"}]}],"id":"584a0128-6794-4c30-b192-7eb27d26447e","description":"The \`/collections\` endpoints let you manage your [collections](https://learning.postman.com/docs/sending-requests/intro-to-collections/)."}],"auth":{"type":"apikey","apikey":[{"key":"key","value":"X-API-Key","type":"string"},{"key":"value","value":"{{token}}","type":"string"}]},"event":[{"listen":"prerequest","script":{"id":"098593c2-abca-4ecb-9203-ac548320cbe6","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"0a308ac9-b704-4526-b3e9-9bc1e7137d72","type":"text/javascript","exec":[""]}}],"variable":[{"id":"c986303e-9c40-4e05-b0a0-8d5b59dc96fb","key":"baseUrl","value":"https://farming-simulator.pstmn.io"},{"id":"f987c273-1137-4f52-8fd6-91cd842a2581","key":"haha","value":"","type":"string"}]}", + "oriFileName": "c1d9f3ea-a477-4303-a53e-66a68d730566.json", + }, + ], + "envList": [ + { + "contentStr": "{"id":"cf9cf09a-dfc3-4854-84e8-87a0188a295d","name":"Project2Env1","values":[{"key":"token","value":"qwer","enabled":true,"type":"default"},{"key":"collectionName","value":"asdf","enabled":true,"type":"default"},{"key":"collectionSchemaUrl","value":"","enabled":true,"type":"default"},{"key":"accessKey","value":"agfd","enabled":true,"type":"default"},{"key":"workspaceId","value":"we","enabled":true,"type":"default"},{"key":"collectionId","value":"","enabled":true,"type":"default"}],"_postman_variable_scope":"environment"}", + "oriFileName": "cf9cf09a-dfc3-4854-84e8-87a0188a295d.json", + }, + { + "contentStr": "{"id":"ebb8eead-714c-4118-8a2a-b1f0682261ef","name":"GlobalSubEnv2","values":[{"key":"haha","value":"","enabled":true,"type":"default"}],"_postman_variable_scope":"environment"}", + "oriFileName": "ebb8eead-714c-4118-8a2a-b1f0682261ef.json", + }, + { + "contentStr": "{"id":"3cbd5933-c08b-4104-b45b-ce1d1cbd23e9","name":"Project2Env2","values":[{"key":"token","value":"","enabled":true,"type":"default"},{"key":"collectionName","value":"wqeasd","enabled":true,"type":"default"},{"key":"collectionSchemaUrl","value":"","enabled":true,"type":"default"},{"key":"accessKey","value":"asdf","enabled":true,"type":"default"},{"key":"workspaceId","value":"","enabled":true,"type":"default"},{"key":"collectionId","value":"wer","enabled":true,"type":"default"}],"_postman_variable_scope":"environment"}", + "oriFileName": "3cbd5933-c08b-4104-b45b-ce1d1cbd23e9.json", + }, + { + "contentStr": "{"id":"e194f9d8-d132-47b0-815a-5bdd37eac7b2","name":"GlobalSubEnv3","values":[{"key":"lala","value":"sadfasd","enabled":true,"type":"default"}],"_postman_variable_scope":"environment"}", + "oriFileName": "e194f9d8-d132-47b0-815a-5bdd37eac7b2.json", + }, + { + "contentStr": "{"id":"fc30987d-62e4-4663-8c54-fbc8ade7be49","name":"GlobalSubEnv4","values":[{"key":"token","value":"sfgd","enabled":true,"type":"default"},{"key":"collectionName","value":"asdf","enabled":true,"type":"default"},{"key":"collectionSchemaUrl","value":"","enabled":true,"type":"default"},{"key":"accessKey","value":"asfd","enabled":false,"type":"default"},{"key":"workspaceId","value":"","enabled":false,"type":"default"},{"key":"collectionId","value":"afd","enabled":true,"type":"default"}],"_postman_variable_scope":"environment"}", + "oriFileName": "fc30987d-62e4-4663-8c54-fbc8ade7be49.json", + }, + { + "contentStr": "{"id":"9379ca61-f09f-45b0-85b8-4b0c9284961e","name":"GlobalSubEnv1","values":[{"key":"token","value":"","type":"default","enabled":true},{"key":"collectionName","value":"","type":"default","enabled":true},{"key":"collectionSchemaUrl","value":"","type":"default","enabled":true},{"key":"accessKey","value":"","type":"default","enabled":true},{"key":"workspaceId","value":"","type":"default","enabled":true},{"key":"collectionId","value":"","type":"default","enabled":true}],"_postman_variable_scope":"environment"}", + "oriFileName": "9379ca61-f09f-45b0-85b8-4b0c9284961e.json", + }, + ], + }, +} +`; diff --git a/packages/insomnia/src/main/templating-worker-database.ts b/packages/insomnia/src/main/templating-worker-database.ts deleted file mode 100644 index d785bc6523..0000000000 --- a/packages/insomnia/src/main/templating-worker-database.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { database as db } from '../common/database'; -import * as models from '../models'; -import type { Request as DBRequest } from '../models/request'; -import type { RequestGroup } from '../models/request-group'; -import type { Workspace } from '../models/workspace'; - -export const resolveDbByKey = async (request: Request) => { - const url = new URL(request.url); - let result; - const body = await request.json(); - if (url.host === 'request.getById'.toLowerCase()) { - result = await models.request.getById(body.id); - } - if (url.host === 'request.getAncestors'.toLowerCase()) { - result = await db.withAncestors(body.request, body.types); - } - if (url.host === 'workspace.getById'.toLowerCase()) { - result = await models.workspace.getById(body.id); - } - if (url.host === 'oAuth2Token.getByRequestId'.toLowerCase()) { - result = await models.oAuth2Token.getByParentId(body.parentId); - } - if (url.host === 'cookieJar.getOrCreateForWorkspace'.toLowerCase()) { - result = await models.cookieJar.getOrCreateForParentId(body.id); - } - if (url.host === 'response.getLatestForRequestId'.toLowerCase()) { - result = await models.response.getLatestForRequest(body.requestId, body.environmentId); - } - if (url.host === 'response.getBodyBuffer'.toLowerCase()) { - result = await models.response.getBodyBuffer(body.response, body.readFailureValue); - } - - return new Response(JSON.stringify(result)); -}; diff --git a/packages/insomnia/src/models/settings.ts b/packages/insomnia/src/models/settings.ts index 9a465c3503..819657ac7d 100644 --- a/packages/insomnia/src/models/settings.ts +++ b/packages/insomnia/src/models/settings.ts @@ -56,7 +56,6 @@ export function init(): BaseSettings { maxRedirects: 10, maxTimelineDataSizeKB: 10, pluginNodeExtraCerts: '', - pluginsAllowElevatedAccess: false, noProxy: '', nunjucksPowerUserMode: false, pluginConfig: {}, diff --git a/packages/insomnia/src/network/network.ts b/packages/insomnia/src/network/network.ts index ca457d341c..562bb792aa 100644 --- a/packages/insomnia/src/network/network.ts +++ b/packages/insomnia/src/network/network.ts @@ -34,7 +34,6 @@ import type { WebSocketRequest } from '../models/websocket-request'; import { isWorkspace, type Workspace } from '../models/workspace'; import * as pluginContexts from '../plugins/context/index'; import * as plugins from '../plugins/index'; -import { RenderError } from '../templating/render-error'; import { maskOrDecryptContextIfNecessary } from '../templating/utils'; import { defaultSendActionRuntime, type SendActionRuntime } from '../ui/routes/request'; import { invariant } from '../utils/invariant'; @@ -631,7 +630,7 @@ export const tryToInterpolateRequest = async ({ ignoreUndefinedEnvVariable, }); } catch (err) { - if (err instanceof RenderError) { + if ('type' in err && err.type === 'render') { throw err; } throw new Error(`Failed to render request: ${request._id}`); diff --git a/packages/insomnia/src/templating/__tests__/utils.test.ts b/packages/insomnia/src/templating/__tests__/utils.test.ts index 5618dc674e..32574de6b1 100644 --- a/packages/insomnia/src/templating/__tests__/utils.test.ts +++ b/packages/insomnia/src/templating/__tests__/utils.test.ts @@ -1,6 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { extractUndefinedVariableKey } from '../render-error'; import * as utils from '../utils'; describe('forceBracketNotation()', () => { @@ -340,9 +339,9 @@ describe('decodeEncoding()', () => { describe('extractUndefinedVariableKey()', () => { it('extract nunjucks variable key', () => { - expect(extractUndefinedVariableKey('{{name}}', {})).toEqual(['name']); - expect(extractUndefinedVariableKey('{{name}}', { name: '' })).toEqual([]); - expect(extractUndefinedVariableKey('aaaaaa{{a}}{{b}}{{c}}', { a: 1 })).toEqual(['b', 'c']); - expect(extractUndefinedVariableKey('{{a.b}}\n\n{{c}} {{d}}', { a: { b: 1 } })).toEqual(['c', 'd']); + expect(utils.extractUndefinedVariableKey('{{name}}', {})).toEqual(['name']); + expect(utils.extractUndefinedVariableKey('{{name}}', { name: '' })).toEqual([]); + expect(utils.extractUndefinedVariableKey('aaaaaa{{a}}{{b}}{{c}}', { a: 1 })).toEqual(['b', 'c']); + expect(utils.extractUndefinedVariableKey('{{a.b}}\n\n{{c}} {{d}}', { a: { b: 1 } })).toEqual(['c', 'd']); }); }); diff --git a/packages/insomnia/src/templating/base-extension-worker.ts b/packages/insomnia/src/templating/base-extension-worker.ts deleted file mode 100644 index 33dc36c995..0000000000 --- a/packages/insomnia/src/templating/base-extension-worker.ts +++ /dev/null @@ -1,228 +0,0 @@ - -import type { PluginTemplateTag } from './extensions'; -import * as templating from './worker'; -export function decodeEncoding(value: T) { - if (typeof value !== 'string') { - return value; - } - - const results = value.match(/^b64::(.+)::46b$/); - - if (results) { - return Buffer.from(results[1], 'base64').toString('utf8'); - } - - return value; -} -const EMPTY_ARG = '__EMPTY_NUNJUCKS_ARG__'; -export interface HelperContext { - context: any; - meta: any; - renderPurpose: any; - util: any; -} -export default class BaseExtension { - _ext: PluginTemplateTag | null = null; - _plugin: Plugin | null = null; - tags: PluginTemplateTag['name'][] = []; - - constructor(ext: PluginTemplateTag, plugin: Plugin) { - this._ext = ext; - this._plugin = plugin; - const tag = this.getTag(); - this.tags = [ - ...(tag === null ? [] : [tag]), - ]; - } - - getTag() { - return this._ext?.name || null; - } - - getPriority() { - return this._ext?.priority || -1; - } - - getName() { - return typeof this._ext?.displayName === 'string' ? this._ext?.displayName : this.getTag(); - } - - getDescription() { - return this._ext?.description || 'no description'; - } - - getLiveDisplayName() { - return ( - // @ts-expect-error -- TSCONVERSION - this._ext?.liveDisplayName || - (() => '') - ); - } - - getDisablePreview() { - return this._ext?.disablePreview || (() => false); - } - - getArgs() { - return this._ext?.args || []; - } - - getActions() { - return this._ext?.actions || []; - } - - isDeprecated() { - return this._ext?.deprecated || false; - } - - run(...args: any[]) { - // @ts-expect-error -- TSCONVERSION - return this._ext?.run(...args); - } - - parse(parser: any, nodes: any, lexer: any) { - const tok = parser.nextToken(); - let args; - - if (parser.peekToken().type !== lexer.TOKEN_BLOCK_END) { - args = parser.parseSignature(null, true); - } else { - // Not sure why this is needed, but it fails without it - args = new nodes.NodeList(tok.lineno, tok.colno); - args.addChild(new nodes.Literal(0, 0, EMPTY_ARG)); - } - - parser.advanceAfterBlockEnd(tok.value); - return new nodes.CallExtensionAsync(this, 'asyncRun', args); - } - - asyncRun({ ctx: renderContext }: any, ...runArgs: any[]) { - // Pull the callback off the end - const callback = runArgs[runArgs.length - 1]; - // Pull out the meta helper - const renderMeta = renderContext.getMeta ? renderContext.getMeta() : {}; - // Pull out the purpose - const renderPurpose = renderContext.getPurpose ? renderContext.getPurpose() : null; - // Extract the rest of the args - const args = runArgs - .slice(0, runArgs.length - 1) - .filter(a => a !== EMPTY_ARG) - .map(decodeEncoding); - // Define a helper context with utils - const helperContext: HelperContext = { - // ...pluginContexts.app.init(renderPurpose), - // ...pluginContexts.store.init(this._plugin), - // ...pluginContexts.network.init(), - context: renderContext, - meta: renderMeta, - renderPurpose, - util: { - render: (str: string) => - templating.render(str, { - context: renderContext, - }), - models: { - request: { - getById: async (id: string) => { - const resp = await fetch('insomnia-templating-worker-database://request.getById', { - method: 'post', - body: JSON.stringify({ id }), - }); - - const req = await resp.json(); - return req; - }, - getAncestors: async (request: any) => { - const resp = await fetch('insomnia-templating-worker-database://request.getAncestors', { - method: 'post', - body: JSON.stringify({ request, types: ['RequestGroup', 'Workspace'] }), - }); - - const ancestors = await resp.json(); - return ancestors; - }, - }, - workspace: { - getById: async (id: string) => { - const resp = await fetch('insomnia-templating-worker-database://workspace.getById', { - method: 'post', - body: JSON.stringify({ id }), - }); - - const workspace = await resp.json(); - return workspace; - }, - }, - oAuth2Token: { - getByRequestId: async (parentId: string) => { - const resp = await fetch('insomnia-templating-worker-database://oAuth2Token.getByRequestId', { - method: 'post', - body: JSON.stringify({ parentId }), - }); - - const oAuth2Token = await resp.json(); - return oAuth2Token; - }, - }, - cookieJar: { - getOrCreateForWorkspace: async (workspace: any) => { - const resp = await fetch('insomnia-templating-worker-database://cookieJar.getOrCreateForParentId', { - method: 'post', - body: JSON.stringify({ parentId: workspace._id }), - }); - - const cookieJar = await resp.json(); - return cookieJar; - }, - }, - response: { - getLatestForRequestId: async (requestId: string, environmentId: string | null) => { - const resp = await fetch('insomnia-templating-worker-database://response.getLatestForRequestId', { - method: 'post', - body: JSON.stringify({ requestId, environmentId }), - }); - - const latest = await resp.json(); - return latest; - }, - getBodyBuffer: async (response?: { bodyPath?: string; bodyCompression?: 'zip' | null | '__NEEDS_MIGRATION__' | undefined }, - readFailureValue?: string) => { - const resp = await fetch('insomnia-templating-worker-database://response.getBodyBuffer', { - method: 'post', - body: JSON.stringify({ response, readFailureValue }), - }); - - const buffer = await resp.json(); - return buffer; - }, - }, - }, - }, - }; - let result; - - try { - result = this.run(helperContext, ...args); - } catch (err) { - // Catch sync errors - callback(err); - return; - } - - // FIX THIS: this is throwing unhandled exceptions - // If the result is a promise, resolve it async - if (result instanceof Promise) { - result - .then(r => { - callback(null, r); - }) - .catch(err => { - callback(err); - }); - return; - } - - // If the result is not a Promise, return it synchronously - callback(null, result); - } -} diff --git a/packages/insomnia/src/templating/base-extension.ts b/packages/insomnia/src/templating/base-extension.ts index 66ad10f572..7aa13b7027 100644 --- a/packages/insomnia/src/templating/base-extension.ts +++ b/packages/insomnia/src/templating/base-extension.ts @@ -49,7 +49,9 @@ export default class BaseExtension { return ( // @ts-expect-error -- TSCONVERSION this._ext?.liveDisplayName || - (() => '') + function() { + return ''; + } ); } diff --git a/packages/insomnia/src/templating/index.ts b/packages/insomnia/src/templating/index.ts index ad9a3c6b2e..fcf23d4b79 100644 --- a/packages/insomnia/src/templating/index.ts +++ b/packages/insomnia/src/templating/index.ts @@ -1,9 +1,34 @@ -import type { Environment } from 'nunjucks'; +import { Environment } from 'nunjucks'; import nunjucks from 'nunjucks/browser/nunjucks'; +import * as plugins from '../plugins/index'; import { localTemplateTags } from '../ui/components/templating/local-template-tags'; import BaseExtension from './base-extension'; -import { extractUndefinedVariableKey, RenderError } from './render-error'; +import { extractUndefinedVariableKey, type NunjucksParsedTag } from './utils'; + +export enum RenderErrorSubType { + EnvironmentVariable = 'environmentVariable' +} + +export class RenderError extends Error { + // TODO: unsound definite assignment assertions + // This is easy to fix, but be careful: extending from Error has especially tricky behavior. + message!: string; + path!: string | null; + location!: { + line: number; + column: number; + }; + + type!: string; + reason!: string; + extraInfo?: Record; + + constructor(message: string) { + super(message); + this.message = message; + } +} // Some constants export const RENDER_ALL = 'all'; @@ -12,7 +37,7 @@ export const RENDER_TAGS = 'tags'; export const NUNJUCKS_TEMPLATE_GLOBAL_PROPERTY_NAME = '_'; type NunjucksEnvironment = Environment & { - extensions: Record; + extensions: Record; }; // Cached globals @@ -56,38 +81,39 @@ export function render( const nj = await getNunjucks(renderMode, config.ignoreUndefinedEnvVariable); nj?.renderString(text, templatingContext, (err: Error | null, result: any) => { clearTimeout(id); - if (!err) { - return resolve(result); - } - console.warn('[templating] Error rendering template', err); - const sanitizedMsg = err.message - .replace(/\(unknown path\)\s/, '') - .replace(/\[Line \d+, Column \d*]/, '') - .replace(/^\s*Error:\s*/, '') - .trim(); - const location = err.message.match(/\[Line (\d+), Column (\d+)*]/); - const line = location ? parseInt(location[1]) : 1; - const column = location ? parseInt(location[2]) : 1; - const reason = err.message.includes('attempted to output null or undefined value') - ? 'undefined' - : 'error'; - const newError = new RenderError(sanitizedMsg); - newError.path = path || ''; - newError.message = sanitizedMsg; - newError.location = { - line, - column, - }; - newError.type = 'render'; - newError.reason = reason; - // regard as environment variable missing - if (hasNunjucksInterpolationSymbols && reason === 'undefined') { - newError.extraInfo = { - subType: 'environmentVariable', - undefinedEnvironmentVariables: extractUndefinedVariableKey(text, templatingContext), + if (err) { + console.warn('[templating] Error rendering template', err); + const sanitizedMsg = err.message + .replace(/\(unknown path\)\s/, '') + .replace(/\[Line \d+, Column \d*]/, '') + .replace(/^\s*Error:\s*/, '') + .trim(); + const location = err.message.match(/\[Line (\d+), Column (\d+)*]/); + const line = location ? parseInt(location[1]) : 1; + const column = location ? parseInt(location[2]) : 1; + const reason = err.message.includes('attempted to output null or undefined value') + ? 'undefined' + : 'error'; + const newError = new RenderError(sanitizedMsg); + newError.path = path || ''; + newError.message = sanitizedMsg; + newError.location = { + line, + column, }; + newError.type = 'render'; + newError.reason = reason; + // regard as environment variable missing + if (hasNunjucksInterpolationSymbols && reason === 'undefined') { + newError.extraInfo = { + subType: RenderErrorSubType.EnvironmentVariable, + undefinedEnvironmentVariables: extractUndefinedVariableKey(text, templatingContext), + }; + } + reject(newError); + } else { + resolve(result); } - reject(newError); }); }); } @@ -111,7 +137,7 @@ export async function getTagDefinitions() { .map(k => env.extensions[k]) .filter(ext => !ext.isDeprecated()) .sort((a, b) => (a.getPriority() > b.getPriority() ? 1 : -1)) - .map(ext => ({ + .map(ext => ({ name: ext.getTag() || '', displayName: ext.getName() || '', liveDisplayName: ext.getLiveDisplayName(), @@ -172,20 +198,15 @@ async function getNunjucks(renderMode: string, ignoreUndefinedEnvVariable?: bool // Create Env with Extensions // // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // const nunjucksEnvironment = nunjucks.configure(config) as NunjucksEnvironment; - const pluginTemplateTags = await (await import('../plugins')).getTemplateTags(); - const allExtensions = [ - ...localTemplateTags, + const pluginTemplateTags = await plugins.getTemplateTags(); - // Spread after local tags to allow plugins to override them. - // TODO: Determine if this is in fact the behavior we've explicitly decided to support. - ...pluginTemplateTags, - ]; + const allExtensions = [...pluginTemplateTags, ...localTemplateTags]; for (const extension of allExtensions) { const { templateTag, plugin } = extension; templateTag.priority = templateTag.priority || allExtensions.indexOf(extension); - // @ts-expect-error -- TODO + // @ts-expect-error -- TSCONVERSION const instance = new BaseExtension(templateTag, plugin); nunjucksEnvironment.addExtension(instance.getTag() || '', instance); // Hidden helper filter to debug complicated things diff --git a/packages/insomnia/src/templating/render-error.ts b/packages/insomnia/src/templating/render-error.ts deleted file mode 100644 index c79245157d..0000000000 --- a/packages/insomnia/src/templating/render-error.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { get as _get } from 'lodash'; -export class RenderError extends Error { - // TODO: unsound definite assignment assertions - // This is easy to fix, but be careful: extending from Error has especially tricky behavior. - message!: string; - path!: string | null; - location!: { - line: number; - column: number; - }; - - type!: string; - reason!: string; - extraInfo?: { subType: 'environmentVariable'; undefinedEnvironmentVariables: string[] }; - - constructor(message: string) { - super(message); - this.message = message; - } -} - -// because nunjucks only report the first error, we need to extract all missing variables that are not present in the context -// for example, if the text is `{{ a }} {{ b }}`, nunjucks only report `a` is missing, but we need to report both `a` and `b` -export function extractUndefinedVariableKey(text: string = '', templatingContext: Record): string[] { - const regexVariable = /{{\s*([^ }]+)\s*}}/g; - const missingVariables: string[] = []; - let match; - - while ((match = regexVariable.exec(text)) !== null) { - let variable = match[1]; - if (variable.includes('_.')) { - variable = variable.split('_.')[1]; - } - // Check if the variable is not present in the context - if (_get(templatingContext, variable) === undefined) { - missingVariables.push(variable); - } - } - return missingVariables; -} diff --git a/packages/insomnia/src/templating/utils.ts b/packages/insomnia/src/templating/utils.ts index 154f21145d..8bb18f26df 100644 --- a/packages/insomnia/src/templating/utils.ts +++ b/packages/insomnia/src/templating/utils.ts @@ -1,4 +1,5 @@ import type { EditorFromTextArea, MarkerRange } from 'codemirror'; +import _ from 'lodash'; import type { RenderPurpose } from '../common/render'; import type { BaseModel } from '../models'; @@ -287,6 +288,26 @@ export function decodeEncoding(value: T) { return value; } +// because nunjucks only report the first error, we need to extract all missing variables that are not present in the context +// for example, if the text is `{{ a }} {{ b }}`, nunjucks only report `a` is missing, but we need to report both `a` and `b` +export function extractUndefinedVariableKey(text: string = '', templatingContext: Record): string[] { + const regexVariable = /{{\s*([^ }]+)\s*}}/g; + const missingVariables: string[] = []; + let match; + + while ((match = regexVariable.exec(text)) !== null) { + let variable = match[1]; + if (variable.includes('_.')) { + variable = variable.split('_.')[1]; + } + // Check if the variable is not present in the context + if (_.get(templatingContext, variable) === undefined) { + missingVariables.push(variable); + } + } + return missingVariables; +} + export async function maskOrDecryptContextIfNecessary(context: Record & { getPurpose: () => RenderPurpose | undefined }) { // all secret variables are under vaultEnvironmentPath property in context const vaultEnvironmentData = context[vaultEnvironmentPath]; diff --git a/packages/insomnia/src/templating/worker.ts b/packages/insomnia/src/templating/worker.ts deleted file mode 100644 index 833025ef0f..0000000000 --- a/packages/insomnia/src/templating/worker.ts +++ /dev/null @@ -1,207 +0,0 @@ - -import type { Environment } from 'nunjucks'; -import nunjucks from 'nunjucks/browser/nunjucks'; - -import { localTemplateTags } from '../ui/components/templating/local-template-tags'; -import BaseExtensionWorker from './base-extension-worker'; -import { extractUndefinedVariableKey, RenderError } from './render-error'; - -// Some constants -export const RENDER_ALL = 'all'; -export const RENDER_VARS = 'variables'; -export const RENDER_TAGS = 'tags'; -export const NUNJUCKS_TEMPLATE_GLOBAL_PROPERTY_NAME = '_'; - -type NunjucksEnvironment = Environment & { - extensions: Record; -}; - -// Cached globals -let nunjucksVariablesOnly: NunjucksEnvironment | null = null; -let nunjucksTagsOnly: NunjucksEnvironment | null = null; -let nunjucksAll: NunjucksEnvironment | null = null; - -/** - * Render text based on stuff - * @param {String} text - Nunjucks template in text form - * @param {Object} [config] - Config options for rendering - * @param {Object} [config.context] - Context to render with - * @param {Object} [config.path] - Path to include in the error message - * @param {Object} [config.renderMode] - Only render variables (not tags) - */ -export function render( - text: string, - config: { - context?: Record; - path?: string; - renderMode?: string; - ignoreUndefinedEnvVariable?: boolean; - } = {}, -) { - const hasNunjucksInterpolationSymbols = text.includes('{{') && text.includes('}}'); - const hasNunjucksCustomTagSymbols = text.includes('{%') && text.includes('%}'); - const hasNunjucksCommentSymbols = text.includes('{#') && text.includes('#}'); - if (!hasNunjucksInterpolationSymbols && !hasNunjucksCustomTagSymbols && !hasNunjucksCommentSymbols) { - return text; - } - const context = config.context || {}; - // context needs to exist on the root for the old templating syntax, and in _ for the new templating syntax - // old: {{ arr[0].prop }} - // new: {{ _['arr-name-with-dash'][0].prop }} - const templatingContext = { ...context, [NUNJUCKS_TEMPLATE_GLOBAL_PROPERTY_NAME]: context }; - const path = config.path || null; - const renderMode = config.renderMode || RENDER_ALL; - return new Promise(async (resolve, reject) => { - // NOTE: this is added as a breadcrumb because renderString sometimes hangs - const id = setTimeout(() => console.log('[templating] Warning: nunjucks failed to respond within 5 seconds'), 5000); - const nj = await getNunjucks(renderMode, config.ignoreUndefinedEnvVariable); - nj?.renderString(text, templatingContext, (err: Error | null, result: any) => { - clearTimeout(id); - if (!err) { - return resolve(result); - } - console.warn('[templating] Error rendering template', err); - const sanitizedMsg = err.message - .replace(/\(unknown path\)\s/, '') - .replace(/\[Line \d+, Column \d*]/, '') - .replace(/^\s*Error:\s*/, '') - .trim(); - const location = err.message.match(/\[Line (\d+), Column (\d+)*]/); - const line = location ? parseInt(location[1]) : 1; - const column = location ? parseInt(location[2]) : 1; - const reason = err.message.includes('attempted to output null or undefined value') - ? 'undefined' - : 'error'; - const newError = new RenderError(sanitizedMsg); - newError.path = path || ''; - newError.message = sanitizedMsg; - newError.location = { - line, - column, - }; - newError.type = 'render'; - newError.reason = reason; - // regard as environment variable missing - if (hasNunjucksInterpolationSymbols && reason === 'undefined') { - newError.extraInfo = { - subType: 'environmentVariable', - undefinedEnvironmentVariables: extractUndefinedVariableKey(text, templatingContext), - }; - } - reject(newError); - }); - }); -} - -/** - * Reload Nunjucks environments. Useful for if plugins change. - */ -export function reload() { - nunjucksAll = null; - nunjucksVariablesOnly = null; - nunjucksTagsOnly = null; -} - -/** - * Get definitions of template tags - */ -export async function getTagDefinitions() { - const env = await getNunjucks(RENDER_ALL); - - return Object.keys(env.extensions) - .map(k => env.extensions[k]) - .filter(ext => !ext.isDeprecated()) - .sort((a, b) => (a.getPriority() > b.getPriority() ? 1 : -1)) - .map(ext => ({ - name: ext.getTag() || '', - displayName: ext.getName() || '', - liveDisplayName: ext.getLiveDisplayName(), - description: ext.getDescription(), - disablePreview: ext.getDisablePreview(), - args: ext.getArgs(), - actions: ext.getActions(), - })); -} - -async function getNunjucks(renderMode: string, ignoreUndefinedEnvVariable?: boolean): Promise { - let throwOnUndefined = true; - if (ignoreUndefinedEnvVariable) { - throwOnUndefined = false; - } else { - if (renderMode === RENDER_VARS && nunjucksVariablesOnly) { - return nunjucksVariablesOnly; - } - if (renderMode === RENDER_TAGS && nunjucksTagsOnly) { - return nunjucksTagsOnly; - } - if (renderMode === RENDER_ALL && nunjucksAll) { - return nunjucksAll; - } - } - - // ~~~~~~~~~~~~ // - // Setup Config // - // ~~~~~~~~~~~~ // - const config = { - autoescape: false, - // Don't escape HTML - throwOnUndefined, - // Strict mode - tags: { - blockStart: '{%', - blockEnd: '%}', - variableStart: '{{', - variableEnd: '}}', - commentStart: '{#', - commentEnd: '#}', - }, - }; - - if (renderMode === RENDER_VARS) { - // Set tag syntax to something that will never happen naturally - config.tags.blockStart = '<[{[{[{[{[$%'; - config.tags.blockEnd = '%$]}]}]}]}]>'; - } - - if (renderMode === RENDER_TAGS) { - // Set tag syntax to something that will never happen naturally - config.tags.variableStart = '<[{[{[{[{[$%'; - config.tags.variableEnd = '%$]}]}]}]}]>'; - } - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // - // Create Env with Extensions // - // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // - const nunjucksEnvironment = nunjucks.configure(config) as NunjucksEnvironment; - - const allExtensions = [ - ...localTemplateTags, - ]; - - for (const extension of allExtensions) { - const { templateTag, plugin } = extension; - templateTag.priority = templateTag.priority || allExtensions.indexOf(extension); - // @ts-expect-error -- TODO - const instance = new BaseExtensionWorker(templateTag, plugin); - nunjucksEnvironment.addExtension(instance.getTag() || '', instance); - // Hidden helper filter to debug complicated things - // eg. `{{ foo | urlencode | debug | upper }}` - nunjucksEnvironment.addFilter('debug', (o: any) => o); - } - - // ~~~~~~~~~~~~~~~~~~~~ // - // Cache Env and Return (when ignoreUndefinedEnvVariable is false) // - // ~~~~~~~~~~~~~~~~~~~~ // - if (ignoreUndefinedEnvVariable) { - return nunjucksEnvironment; - } - if (renderMode === RENDER_VARS) { - nunjucksVariablesOnly = nunjucksEnvironment; - } else if (renderMode === RENDER_TAGS) { - nunjucksTagsOnly = nunjucksEnvironment; - } else { - nunjucksAll = nunjucksEnvironment; - } - - return nunjucksEnvironment; -} diff --git a/packages/insomnia/src/ui/components/codemirror/code-editor.tsx b/packages/insomnia/src/ui/components/codemirror/code-editor.tsx index 685825ba10..88b244fd92 100644 --- a/packages/insomnia/src/ui/components/codemirror/code-editor.tsx +++ b/packages/insomnia/src/ui/components/codemirror/code-editor.tsx @@ -482,9 +482,7 @@ export const CodeEditor = memo(forwardRef(({ codeMirror.current.foldCode(from, to); } } - // settings.pluginsAllowElevatedAccess is not used here but we want to trigger this effect when it changes - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [hideGutters, hideLineNumbers, placeholder, settings.editorLineWrapping, settings.editorKeyMap, settings.hotKeyRegistry, settings.autocompleteDelay, settings.nunjucksPowerUserMode, settings.pluginsAllowElevatedAccess, settings.showVariableSourceAndValue, noLint, readOnly, noMatchBrackets, indentSize, hintOptions, infoOptions, dynamicHeight, jumpOptions, noStyleActiveLine, indentWithTabs, extraKeys, handleRender, mode, getAutocompleteConstants, getAutocompleteSnippets, persistState, maybePrettifyAndSetValue, defaultValue, filter, onClickLink, uniquenessKey, handleGetRenderContext, pinToBottom, onPaste, id]); + }, [hideGutters, hideLineNumbers, placeholder, settings.editorLineWrapping, settings.editorKeyMap, settings.hotKeyRegistry, settings.autocompleteDelay, settings.nunjucksPowerUserMode, settings.showVariableSourceAndValue, noLint, readOnly, noMatchBrackets, indentSize, hintOptions, infoOptions, dynamicHeight, jumpOptions, noStyleActiveLine, indentWithTabs, extraKeys, handleRender, mode, getAutocompleteConstants, getAutocompleteSnippets, persistState, maybePrettifyAndSetValue, defaultValue, filter, onClickLink, uniquenessKey, handleGetRenderContext, pinToBottom, onPaste, id]); const cleanUpEditor = useCallback(() => { codeMirror.current?.toTextArea(); diff --git a/packages/insomnia/src/ui/components/codemirror/extensions/nunjucks-tags.ts b/packages/insomnia/src/ui/components/codemirror/extensions/nunjucks-tags.ts index 56a62b2c2a..0bd30a9045 100644 --- a/packages/insomnia/src/ui/components/codemirror/extensions/nunjucks-tags.ts +++ b/packages/insomnia/src/ui/components/codemirror/extensions/nunjucks-tags.ts @@ -130,7 +130,6 @@ async function _highlightNunjucksTags(this: CodeMirror.Editor, render: HandleRen el.setAttribute('draggable', 'true'); el.setAttribute('data-error', 'off'); el.setAttribute('data-template', tok.string); - el.innerHTML = '' + tok.string; const mark = this.markText(start, end, { // @ts-expect-error not a known property of TextMarkerOptions __nunjucks: true, @@ -275,7 +274,7 @@ async function _updateElementText( showVariableSourceAndValue: boolean ) { const el = mark.replacedWith!; - let innerHTML = text; + let innerHTML = ''; let title = ''; let dataIgnore = ''; let dataError = ''; @@ -295,6 +294,7 @@ async function _updateElementText( if (tagDefinition) { // Try rendering these so we can show errors if needed + // @ts-expect-error -- TSCONVERSION const liveDisplayName = tagDefinition.liveDisplayName(tagData.args); const firstArg = tagDefinition.args[0]; @@ -304,6 +304,7 @@ async function _updateElementText( const argData = tagData.args[0]; // @ts-expect-error -- TSCONVERSION const foundOption = firstArg.options.find(d => d.value === argData.value); + // @ts-expect-error -- TSCONVERSION const option = foundOption || firstArg.options[0]; innerHTML = `${tagDefinition.displayName} ⇒ ${option.displayName}`; } else { @@ -311,6 +312,7 @@ async function _updateElementText( } const preview = await render(text); + // @ts-expect-error -- TSCONVERSION title = tagDefinition.disablePreview(tagData.args) ? preview.replace(/./g, '*') : preview; } else { innerHTML = cleanedStr; diff --git a/packages/insomnia/src/ui/components/codemirror/one-line-editor.tsx b/packages/insomnia/src/ui/components/codemirror/one-line-editor.tsx index 351c269061..4a344c3cce 100644 --- a/packages/insomnia/src/ui/components/codemirror/one-line-editor.tsx +++ b/packages/insomnia/src/ui/components/codemirror/one-line-editor.tsx @@ -211,9 +211,7 @@ export const OneLineEditor = forwardRef id, ); } - // settings.pluginsAllowElevatedAccess is not used here but we want to trigger this effect when it changes - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [defaultValue, getAutocompleteConstants, handleGetRenderContext, handleRender, onBlur, onKeyDown, onPaste, placeholder, readOnly, settings.autocompleteDelay, getKeyMap, settings.hotKeyRegistry, settings.nunjucksPowerUserMode, settings.pluginsAllowElevatedAccess, settings.showVariableSourceAndValue, eventListeners, id]); + }, [defaultValue, getAutocompleteConstants, handleGetRenderContext, handleRender, onBlur, onKeyDown, onPaste, placeholder, readOnly, settings.autocompleteDelay, getKeyMap, settings.hotKeyRegistry, settings.nunjucksPowerUserMode, settings.showVariableSourceAndValue, eventListeners, id]); const cleanUpEditor = useCallback(() => { codeMirror.current?.toTextArea(); diff --git a/packages/insomnia/src/ui/components/modals/request-render-error-modal.tsx b/packages/insomnia/src/ui/components/modals/request-render-error-modal.tsx index 840222ad7b..6d205e92f4 100644 --- a/packages/insomnia/src/ui/components/modals/request-render-error-modal.tsx +++ b/packages/insomnia/src/ui/components/modals/request-render-error-modal.tsx @@ -5,7 +5,7 @@ import { docsTemplateTags } from '../../../common/documentation'; import type { GrpcRequest } from '../../../models/grpc-request'; import type { Request } from '../../../models/request'; import type { WebSocketRequest } from '../../../models/websocket-request'; -import { RenderError } from '../../../templating/render-error'; +import { RenderError } from '../../../templating'; import { Link } from '../base/link'; import { Modal, type ModalHandle, type ModalProps } from '../base/modal'; import { ModalBody } from '../base/modal-body'; diff --git a/packages/insomnia/src/ui/components/panes/grpc-request-pane.tsx b/packages/insomnia/src/ui/components/panes/grpc-request-pane.tsx index a7d445b828..1e8647ed19 100644 --- a/packages/insomnia/src/ui/components/panes/grpc-request-pane.tsx +++ b/packages/insomnia/src/ui/components/panes/grpc-request-pane.tsx @@ -15,7 +15,6 @@ import { queryAllWorkspaceUrls } from '../../../models/helpers/query-all-workspa import { isRequestGroup, type RequestGroup } from '../../../models/request-group'; import { getOrInheritHeaders } from '../../../network/network'; import { urlMatchesCertHost } from '../../../network/url-matches-cert-host'; -import { RenderError } from '../../../templating/render-error'; import { getGrpcConnectionErrorDetails } from '../../../utils/grpc'; import { tryToInterpolateRequestOrShowRenderErrorModal } from '../../../utils/try-interpolate'; import { setDefaultProtocol } from '../../../utils/url/protocol'; @@ -145,7 +144,7 @@ export const GrpcRequestPane: FunctionComponent = ({ error: undefined, }); } catch (err) { - if (err instanceof RenderError) { + if (err.type === 'render') { showModal(RequestRenderErrorModal, { request: activeRequest, error: err, diff --git a/packages/insomnia/src/ui/components/settings/plugins.tsx b/packages/insomnia/src/ui/components/settings/plugins.tsx index 751a68d1e6..873e4514ae 100644 --- a/packages/insomnia/src/ui/components/settings/plugins.tsx +++ b/packages/insomnia/src/ui/components/settings/plugins.tsx @@ -20,7 +20,6 @@ import { HelpTooltip } from '../help-tooltip'; import { Icon } from '../icon'; import { showAlert, showPrompt } from '../modals'; import { Tooltip } from '../tooltip'; -import { BooleanSetting } from './boolean-setting'; interface State { plugins: Plugin[]; npmPluginValue: string; @@ -77,19 +76,6 @@ export const Plugins: FC = () => { Plugins is still an experimental feature. See{' '} Documentation for more info.

- -
-
-

- Plugins with elevated access can access anything Insomnia can. It's recommended that elevated access remain disabled. -

- -
-
- {plugins.length === 0 ? (
No Plugins Added
) : ( diff --git a/packages/insomnia/src/ui/components/templating/local-template-tags.ts b/packages/insomnia/src/ui/components/templating/local-template-tags.ts index 5ea94744c4..7855e2723e 100644 --- a/packages/insomnia/src/ui/components/templating/local-template-tags.ts +++ b/packages/insomnia/src/ui/components/templating/local-template-tags.ts @@ -745,7 +745,7 @@ const localTemplatePlugins: { templateTag: PluginTemplateTag }[] = [ } const sanitizedFilter = filter.trim(); - const bodyBuffer = await context.util.models.response.getBodyBuffer(response, ''); + const bodyBuffer = context.util.models.response.getBodyBuffer(response, ''); const match = response.contentType && response.contentType.match(/charset=([\w-]+)/); const charset = match && match.length >= 2 ? match[1] : 'utf-8'; if (field === 'url') { diff --git a/packages/insomnia/src/ui/components/websockets/websocket-request-pane.tsx b/packages/insomnia/src/ui/components/websockets/websocket-request-pane.tsx index 5abbc1f953..11b404862c 100644 --- a/packages/insomnia/src/ui/components/websockets/websocket-request-pane.tsx +++ b/packages/insomnia/src/ui/components/websockets/websocket-request-pane.tsx @@ -10,7 +10,6 @@ import type { Environment } from '../../../models/environment'; import { type AuthTypes, getCombinedPathParametersFromUrl, type RequestPathParameter } from '../../../models/request'; import type { WebSocketRequest } from '../../../models/websocket-request'; import { getAuthObjectOrNull } from '../../../network/authentication'; -import { RenderError } from '../../../templating/render-error'; import { tryToInterpolateRequestOrShowRenderErrorModal } from '../../../utils/try-interpolate'; import { buildQueryStringFromParams, deconstructQueryStringToParams, extractQueryStringFromUrl, joinUrlAndQueryString } from '../../../utils/url/querystring'; import { useReadyState } from '../../hooks/use-ready-state'; @@ -108,7 +107,7 @@ const WebSocketRequestForm: FC = ({ } window.main.webSocket.event.send({ requestId: request._id, payload: renderedMessage }); } catch (err) { - if (err instanceof RenderError) { + if (err.type === 'render') { showModal(RequestRenderErrorModal, { request, error: err, diff --git a/packages/insomnia/src/ui/routes/actions.tsx b/packages/insomnia/src/ui/routes/actions.tsx index 8ecf79efb2..e40b466ce5 100644 --- a/packages/insomnia/src/ui/routes/actions.tsx +++ b/packages/insomnia/src/ui/routes/actions.tsx @@ -30,7 +30,7 @@ import { VCSInstance } from '../../sync/vcs/insomnia-sync'; import { insomniaFetch } from '../../ui/insomniaFetch'; import { invariant } from '../../utils/invariant'; import { SegmentEvent } from '../analytics'; -import { SpectralRunner } from '../worker/spectral-handler'; +import { SpectralRunner } from '../worker/spectral-run'; // Project export const createNewProjectAction: ActionFunction = async ({ request, params }) => { diff --git a/packages/insomnia/src/ui/routes/design.tsx b/packages/insomnia/src/ui/routes/design.tsx index 3556c0ef7f..9ecad1cc1a 100644 --- a/packages/insomnia/src/ui/routes/design.tsx +++ b/packages/insomnia/src/ui/routes/design.tsx @@ -75,7 +75,7 @@ import { useActiveApiSpecSyncVCSVersion, useGitVCSVersion, } from '../hooks/use-vcs-version'; -import { SpectralRunner } from '../worker/spectral-handler'; +import { SpectralRunner } from '../worker/spectral-run'; import { useRootLoaderData } from './root'; import type { WorkspaceLoaderData } from './workspace'; diff --git a/packages/insomnia/src/ui/routes/request.tsx b/packages/insomnia/src/ui/routes/request.tsx index b1ba5babd6..97ec4c8ef0 100644 --- a/packages/insomnia/src/ui/routes/request.tsx +++ b/packages/insomnia/src/ui/routes/request.tsx @@ -35,6 +35,7 @@ import { isWebSocketRequest, isWebSocketRequestId, type WebSocketRequest } from import { isWebSocketResponse, type WebSocketResponse } from '../../models/websocket-response'; import { getAuthHeader } from '../../network/authentication'; import { fetchRequestData, responseTransform, sendCurlAndWriteTimeline, tryToExecuteAfterResponseScript, tryToExecutePreRequestScript, tryToInterpolateRequest, tryToTransformRequestWithPlugins } from '../../network/network'; +import { RenderErrorSubType } from '../../templating'; import { parseGraphQLReqeustBody } from '../../utils/graph-ql'; import { invariant } from '../../utils/invariant'; import { SegmentEvent } from '../analytics'; @@ -448,7 +449,7 @@ export const sendAction: ActionFunction = async ({ request, params }) => { } else { // if the error is not from response, we need to set it to url param and show it in modal url.searchParams.set('error', e); - if (e?.extraInfo && e?.extraInfo?.subType === 'environmentVariable') { + if (e?.extraInfo && e?.extraInfo?.subType === RenderErrorSubType.EnvironmentVariable) { url.searchParams.set('envVariableMissing', '1'); url.searchParams.set('undefinedEnvironmentVariables', e?.extraInfo?.undefinedEnvironmentVariables); } diff --git a/packages/insomnia/src/ui/routes/workspace.tsx b/packages/insomnia/src/ui/routes/workspace.tsx index 6d29facd7d..1cf54306c8 100644 --- a/packages/insomnia/src/ui/routes/workspace.tsx +++ b/packages/insomnia/src/ui/routes/workspace.tsx @@ -260,8 +260,7 @@ export const workspaceLoader: LoaderFunction = async ({ } const userSession = await models.userSession.getOrCreate(); - const isLoggedinIsCloudProjectAndIsNotGitRepo = userSession.id && activeProject.remoteId && !gitRepository; - if (isLoggedinIsCloudProjectAndIsNotGitRepo) { + if (userSession.id && !gitRepository) { try { const vcs = VCSInstance(); await vcs.switchAndCreateBackendProjectIfNotExist(workspaceId, activeWorkspace.name); diff --git a/packages/insomnia/src/ui/worker/spectral-handler.ts b/packages/insomnia/src/ui/worker/spectral-run.ts similarity index 81% rename from packages/insomnia/src/ui/worker/spectral-handler.ts rename to packages/insomnia/src/ui/worker/spectral-run.ts index 6a4af2ac39..a3f175f750 100644 --- a/packages/insomnia/src/ui/worker/spectral-handler.ts +++ b/packages/insomnia/src/ui/worker/spectral-run.ts @@ -1,16 +1,19 @@ import type { ISpectralDiagnostic } from '@stoplight/spectral-core'; -import type { SpectralResponse } from './spectral-worker'; +import type { SpectralResponse } from './spectral'; export class SpectralRunner { private worker: Worker; private taskId = 0; constructor() { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- see below - // @ts-ignore -- inso transpiles to commonjs so doesn't play nice with this - this.worker = new Worker(new URL('./spectral-worker.ts', import.meta.url), { type: 'module' }); + // @INFO: This is only for inso cli since it ends up in the import map and gets type-checked against a node environment + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + this.worker = new Worker(new URL('./spectral.ts', import.meta.url), { + type: 'module', + }); } terminate() { diff --git a/packages/insomnia/src/ui/worker/spectral-worker.ts b/packages/insomnia/src/ui/worker/spectral.ts similarity index 100% rename from packages/insomnia/src/ui/worker/spectral-worker.ts rename to packages/insomnia/src/ui/worker/spectral.ts diff --git a/packages/insomnia/src/ui/worker/templating-handler.ts b/packages/insomnia/src/ui/worker/templating-handler.ts deleted file mode 100644 index f600170542..0000000000 --- a/packages/insomnia/src/ui/worker/templating-handler.ts +++ /dev/null @@ -1,50 +0,0 @@ - -import { extractUndefinedVariableKey, RenderError } from '../../templating/render-error'; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- see below -// @ts-ignore -- inso transpiles to commonjs so doesn't play nice with this -const worker = new Worker(new URL('./templating-worker.ts', import.meta.url), { type: 'module' }); - -// Triggered by a mistake in the work initialization code above -worker.addEventListener('error', event => { - console.error('Error from worker:', event.message); -}); - -export function renderInWorker({ input, context, path, ignoreUndefinedEnvVariable }: { input: string; context: Record; path: string; ignoreUndefinedEnvVariable: boolean }): Promise { - const newContext = { - ...context, - serializedFunctions: { - requestId: context.getMeta().requestId, - workspaceId: context.getMeta().workspaceId, - environmentId: context.getEnvironmentId(), - extraInfo: context.getExtraInfo(), - globalEnvironmentId: context.getGlobalEnvironmentId(), - keysContext: context.getKeysContext(), - projectId: context.getProjectId(), - purpose: context.getPurpose(), - }, - }; - - // Id to avoid race conditions - const id = window.crypto.randomUUID(); - const payloadWithHash = JSON.stringify({ id, input, context: newContext, path, ignoreUndefinedEnvVariable }); - worker.postMessage(payloadWithHash); - return new Promise((resolve, reject) => { - const messageHandler = (event: MessageEvent) => { - if (event.data.id === id) { - worker.removeEventListener('message', messageHandler); - if (event.data.err) { - const error = new RenderError(event.data.err); - error.type = 'render'; - error.extraInfo = { - subType: 'environmentVariable', - undefinedEnvironmentVariables: extractUndefinedVariableKey(input, newContext), - }; - return reject(error); - } - return resolve(event.data.result); - } - }; - worker.addEventListener('message', messageHandler); - }); -} diff --git a/packages/insomnia/src/ui/worker/templating-worker.ts b/packages/insomnia/src/ui/worker/templating-worker.ts deleted file mode 100644 index 85f9c6548e..0000000000 --- a/packages/insomnia/src/ui/worker/templating-worker.ts +++ /dev/null @@ -1,32 +0,0 @@ -import * as templating from '../../templating/worker'; - -const originalRequire = self.require; -const interceptor: any = (moduleName: string): NodeRequire => { - const allowList = ['crypto', 'date-fns', 'fs', 'iconv-lite', 'jsonpath-plus', 'os', 'tough-cookie', 'uuid']; - if (allowList.includes(moduleName)) { - return originalRequire(moduleName); - } - throw new Error(`Cannot find module '${moduleName}', untrusted modules are not available in protected mode, this can be enabled in plugin settings`); -}; -async function performJob(input: { input: string; context: Record; path: string; ignoreUndefinedEnvVariable: boolean }) { - self.require = interceptor; - return templating.render(input.input, { context: input.context, path: input.path, ignoreUndefinedEnvVariable: input.ignoreUndefinedEnvVariable }); -} - -// Listen for messages from the main thread -self.onmessage = async event => { - const { id, input, context, path, ignoreUndefinedEnvVariable } = JSON.parse(event.data); - try { - context.getMeta = () => ({ requestId: context.serializedFunctions.requestId, workspaceId: context.serializedFunctions.workspaceId }); - context.getEnvironmentId = () => context.serializedFunctions.environmentId; - context.getExtraInfo = () => context.serializedFunctions.extraInfo; - context.getGlobalEnvironmentId = () => context.serializedFunctions.globalEnvironmentId; - context.getKeysContext = () => context.serializedFunctions.keysContext; - context.getProjectId = () => context.serializedFunctions.projectId; - context.getPurpose = () => context.serializedFunctions.purpose; - const result = await performJob({ input, context, path, ignoreUndefinedEnvVariable }); - self.postMessage({ id, result }); - } catch (err) { - self.postMessage({ id, err }); - } -}; diff --git a/packages/insomnia/src/utils/importers/__tests__/__snapshots__/convert.test.ts.snap b/packages/insomnia/src/utils/importers/__tests__/__snapshots__/convert.test.ts.snap new file mode 100644 index 0000000000..7d78c929b1 --- /dev/null +++ b/packages/insomnia/src/utils/importers/__tests__/__snapshots__/convert.test.ts.snap @@ -0,0 +1,4368 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Postman data dump convert > should convert postman data dump 1`] = ` +{ + "data": { + "__export_format": 4, + "__export_source": "insomnia.importers:v0.1.0", + "_type": "export", + "resources": [ + { + "_id": "__WORKSPACE_ID__", + "_type": "workspace", + "name": "RESTful API Basics #blueprint", + "parentId": null, + "scope": "collection", + }, + { + "_id": "__GRP_1__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "# 🚀 Get started here + +This collection guides you through CRUD operations (GET, POST, PUT, DELETE), variables, and tests. + +## 🔖 **How to use this collection** + +#### **Step 1: Send requests** + +RESTful APIs allow you to perform CRUD operations using the POST, GET, PUT, and DELETE HTTP methods. + +This collection contains each of these request types. Open each request and click "Send" to see what happens. + +#### **Step 2: View responses** + +Observe the response tab for status code (200 OK), response time, and size. + +#### **Step 3: Send new Body data** + +Update or add new data in "Body" in the POST request. Typically, Body data is also used in PUT and PATCH requests. + +\`\`\` +{ + "name": "Add your name in the body" +} + +\`\`\` + +#### **Step 4: Update the variable** + +Variables enable you to store and reuse values in Postman. We have created a variable called \`base_url\` with the sample request [https://postman-api-learner.glitch.me](https://postman-api-learner.glitch.me). Replace it with your API endpoint to customize this collection. + +#### **Step 5: Add tests in the "Tests" tab** + +Tests help you confirm that your API is working as expected. You can write test scripts in JavaScript and view the output in the "Test Results" tab. + + + +## 💪 Pro tips + +- Use folders to group related requests and organize the collection. +- Add more scripts in "Tests" to verify if the API works as expected and execute flows. + + +## ℹ️ Resources + +[Building requests](https://learning.postman.com/docs/sending-requests/requests/) +[Authorizing requests](https://learning.postman.com/docs/sending-requests/authorization/) +[Using variables](https://learning.postman.com/docs/sending-requests/variables/) +[Managing environments](https://learning.postman.com/docs/sending-requests/managing-environments/) +[Writing scripts](https://learning.postman.com/docs/writing-scripts/intro-to-scripts/)", + "environment": { + "base_url": "https://postman-rest-api-learner.glitch.me/", + "id": "1", + }, + "name": "RESTful API Basics #blueprint", + "parentId": "__WORKSPACE_ID__", + "preRequestScript": "", + "variable": { + "base_url": "https://postman-rest-api-learner.glitch.me/", + "id": "1", + }, + }, + { + "_id": "__REQ_1__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.response.to.have.status(200); +});", + "authentication": {}, + "body": {}, + "description": "This is a GET request and it is used to "get" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have \`id=1\`). + +A successful GET response will have a \`200 OK\` status, and should include some kind of response body - for example, HTML web content or JSON data.", + "headers": [], + "method": "GET", + "name": "Get data", + "parameters": [ + { + "disabled": false, + "name": "id", + "value": "1", + }, + ], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__REQ_2__", + "_type": "request", + "afterResponseScript": "insomnia.test("Successful POST request", function () { + insomnia.expect(insomnia.response.code).to.be.oneOf([200, 201]); +}); +", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "name": "Add your name in the body" +}", + }, + "description": "This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response. + +A successful POST request typically returns a \`200 OK\` or \`201 Created\` response code.", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "Post data", + "parameters": [], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__REQ_3__", + "_type": "request", + "afterResponseScript": "insomnia.test("Successful PUT request", function () { + insomnia.expect(insomnia.response.code).to.be.oneOf([200, 201, 204]); +}); +", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "name": "Add your name in the body" +}", + }, + "description": "This is a PUT request and it is used to overwrite an existing piece of data. For instance, after you create an entity with a POST request, you may want to modify that later. You can do that using a PUT request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`). + +A successful PUT request typically returns a \`200 OK\`, \`201 Created\`, or \`204 No Content\` response code.", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PUT", + "name": "Update data", + "parameters": [ + { + "disabled": false, + "name": "id", + "value": "1", + }, + ], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__REQ_4__", + "_type": "request", + "afterResponseScript": "insomnia.test("Successful DELETE request", function () { + insomnia.expect(insomnia.response.code).to.be.oneOf([200, 202, 204]); +}); +", + "authentication": {}, + "body": {}, + "description": "This is a DELETE request, and it is used to delete data that was previously created via a POST request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`). + +A successful DELETE request typically returns a \`200 OK\`, \`202 Accepted\`, or \`204 No Content\` response code.", + "headers": [], + "method": "DELETE", + "name": "Delete data", + "parameters": [ + { + "disabled": false, + "name": "id", + "value": "1", + }, + ], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__WORKSPACE_ID__", + "_type": "workspace", + "name": "Device Collection", + "parentId": null, + "scope": "collection", + }, + { + "_id": "__GRP_1__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "", + "environment": { + "access_token": "", + "access_token_authO": "", + "appid": "", + "devid": "", + "globalReferenceId": "", + "provision_id": "", + "refresh_token_authO": "", + "usrrefid": "", + }, + "name": "Device Collection", + "parentId": "__WORKSPACE_ID__", + "preRequestScript": "", + "variable": { + "access_token": "", + "access_token_authO": "", + "appid": "", + "devid": "", + "globalReferenceId": "", + "provision_id": "", + "refresh_token_authO": "", + "usrrefid": "", + }, + }, + { + "_id": "__GRP_2__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "", + "environment": {}, + "name": "Ebiz Account & Device - M1A and WPS Devices", + "parentId": "__GRP_1__", + "preRequestScript": "", + }, + { + "_id": "__REQ_1__", + "_type": "request", + "afterResponseScript": "tests["response code is 201"] = responseCode.code === 201; +tests["Response Body contains ProvisionId"] = responseBody.has("provision_id"); + + var responseJson = insomnia.response.json() + console.log("Global_Reference_Id"+" - "+responseJson.Global_Reference_Id); + + insomnia.environment.set("Global_Reference_Id_MTP_1_Device", responseJson.Global_Reference_Id); + insomnia.environment.set("Provision_Id_MTP_1_Device", responseJson.provision_list[0].provision_id); + insomnia.environment.set("Product_Key_MTP_1_Device", responseJson.provision_list[0].product_key); + insomnia.environment.set("Account_Id_MTP_1_Device", responseJson.provision_list[0].account_id); + insomnia.environment.set("Exp_Date_MTP_1_Device", responseJson.provision_list[0].exp_date);", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ +"email_address": "{{_['UserEmail_MTP_1_Device']}}", +"password": "{{_['UserPassword_MTP_1_Device']}}", +"culture": "en-us", +"client_id": "{{_['csp_client_id']}}", +"is_fake_email": false, +"sku_list": [{ +"app_id": "{{_['App_ID']}}", +"sku": "0-7018-93492", +"branding_id": "" +}] +}", + }, + "description": "API: ActivateRequest + +Summary: This api is used for creating account, subscription for different products like WSS, SafeConnect etc. + +Incoming calls: + 1. CONS_NEXS_PROD + 2. CONS_PLATFORM_ Appapi_PROD + 3. CONS_McAfeeMobileSecurity_PROD + 4. CONS_CSP_SecurityMgmt_PROD + 5. CONS_CSP_CSPToken_OTP_Service_PROD + 6. CONS_PLATFORM_PARTNERSVC_PROD + +DB calls: Ebiz, EbizStats, Provision, MachineTracker + +External calls: + 1. CONS_PLATFORM_App_PROD + 2. CONS_PLATFORM_PARTNERSVC_PROD + 3. CONS_PLATFORM_PlatformSvc_Api_PROD + 4. CONS_PLATFORM_PlatformProv_Orch_PROD + 5. CONS_PLATFORM_BridgeService_PROD + 6. CONS_PLATFORM_BridgeService_PROD + 7. CONS_CSP_Basic_Config_Enroll_ServiceDiscovery_PROD + 8. CONS_CSP_Cloudlog_Cloudsecurity_PROD + 9. CONS_CSP_Contextenroll_PROD + 10. CONS_PLATFORM_Prodhome_PROD + 11. mcAsyncSvc + 12. www.transactonline.de + 13. apps.mcafeemobilesecurity.com", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + { + "name": "st", + "value": "1", + }, + { + "name": "sv", + "value": "V1", + }, + { + "name": "ak", + "value": "{{C2C_AppKey}}", + }, + { + "name": "ac", + "value": "{{ac}}", + }, + ], + "method": "POST", + "name": "Subscription_Creation_MTP_1_Device", + "parameters": [], + "parentId": "__GRP_2__", + "preRequestScript": "var appKey = insomnia.environment.get("C2C_AppKey"); +var sharedKey = insomnia.environment.get("C2C_SharedKey"); +insomnia.environment.set("UserEmail_MTP_1_Device", insomnia.variables.replaceIn("Test_{{$timestamp}}@mcafee.com")); +var password = "Password@123"; +insomnia.environment.set("UserPassword_MTP_1_Device", password); +insomnia.environment.set("sw_id", insomnia.variables.replaceIn("{{$guid}}")); +insomnia.environment.set("hw_id", insomnia.variables.replaceIn("{{$guid}}")); + +", + "url": "{{servicediscovery}}/v2/ProductProvision/", + }, + { + "_id": "__REQ_2__", + "_type": "request", + "afterResponseScript": "insomnia.test("Verify the status code should be 200", function () { + insomnia.response.to.have.status(200); +}); + +insomnia.test("Verify the response body", function () { + var jsonData = insomnia.response.json(); + insomnia.expect(jsonData.Success).to.eql(true); +}); + +insomnia.test("Body matches string", function () { + insomnia.expect(insomnia.response.text()).to.include("McAfee® Total Protection - 1 Device"); +}); + + var responseJson = insomnia.response.json() + insomnia.globals.set("email_MTP_1_device",responseJson.email_address); + insomnia.globals.set("grid_MTP_1_device",responseJson.grid); + insomnia.globals.set("acct_id_MTP_1_device",responseJson.acct_id); + insomnia.environment.set("SubID_MTP_1_device",responseJson.provision_list[0].subscription_info.SubId) + insomnia.environment.set("Actcode_MTP_1_device",responseJson.provision_list[0].activation_code)", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "app_id": "{{App_ID}}", + "type": "Provision", + "provision_id": "{{Provision_Id_MTP_1_Device}}", + "Include_All_Subs": true +}", + }, + "description": "", + "headers": [ + { + "name": "ac", + "value": "{{ac}}", + }, + { + "name": "ak", + "value": "{{CSI_AppKey}}", + }, + { + "name": "cd", + "value": "{{cd}}", + }, + { + "name": "st", + "value": "1", + }, + { + "name": "sv", + "value": "V1", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "Get_Subscriptions_MTP_1_Device", + "parameters": [], + "parentId": "__GRP_2__", + "preRequestScript": "var appKey = insomnia.environment.get("C2C_AppKey"); +var sharedKey = insomnia.environment.get("C2C_SharedKey"); +insomnia.environment.set("UserEmail_MTP_1_Device", insomnia.variables.replaceIn("Test_{{$timestamp}}@mcafee.com")); +var password = "Password@123"; +insomnia.environment.set("UserPassword_MTP_1_Device", password); +insomnia.environment.set("sw_id", insomnia.variables.replaceIn("{{$guid}}")); +insomnia.environment.set("hw_id", insomnia.variables.replaceIn("{{$guid}}")); + +", + "url": "{{servicediscovery}}/v2/ProductProvision/GetSubscriptions", + }, + { + "_id": "__REQ_3__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.response.to.have.status(200); +}); + + var responseJson = insomnia.response.json() + insomnia.environment.set("SerialNumber_MTP_1_device",responseJson.SerialNumber) + insomnia.environment.set("EncryptSerialNumber_MTP_1_device",responseJson.EncryptSerialNumber) + insomnia.environment.set("ProductKey_MTP_1_device",responseJson.ProductKey) + insomnia.environment.set("AcctId_MTP_1_device",responseJson.Account.AcctId) + ", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "EbizSubId": {{SubID_MTP_1_device}}, + "DeviceType": "PC" +} + +", + }, + "description": "", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + { + "name": "st", + "value": "3", + }, + { + "name": "sv", + "value": "V1", + }, + { + "name": "ak", + "value": "{{pps_app_key}}", + }, + { + "disabled": true, + "name": "ac", + "value": "{{ac}}", + }, + ], + "method": "POST", + "name": "Get_Serial_Number_MTP_1_Device", + "parameters": [ + { + "disabled": false, + "name": "subscriptionId", + "value": "{{SubID_MTP_1_device}}", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "var appKey = insomnia.environment.get("C2C_AppKey"); +var sharedKey = insomnia.environment.get("C2C_SharedKey"); +insomnia.environment.set("UserEmail_MTP_1_Device", insomnia.variables.replaceIn("Test_{{$timestamp}}@mcafee.com")); +var password = "Password@123"; +insomnia.environment.set("UserPassword_MTP_1_Device", password); +insomnia.environment.set("sw_id", insomnia.variables.replaceIn("{{$guid}}")); +insomnia.environment.set("hw_id", insomnia.variables.replaceIn("{{$guid}}")); + +", + "url": "{{servicediscovery}}/v2/ProductProvisionV2/AddDeviceSerialNumberBySubId", + }, + { + "_id": "__REQ_4__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("response schema", function () { + const responseData = insomnia.response.json(); + insomnia.environment.set("ebiz_userRefId", responseData.data[0].userRefId); + // insomnia.expect(responseData.data[0].subRefId).to.eq("required fields are missing"); + + +}); +", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "globalRefId": "{{globalReferenceId}}" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "{{account-orch}}/v2/accounts/search - get userRefId", + "parameters": [ + { + "disabled": true, + "name": "subRefId", + "value": "{{provision_id}}", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{_['account-orch']}}/v2/accounts/search", + }, + { + "_id": "__REQ_5__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + + + +", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "status": "ACTIVE" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "", + "value": "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImNNVGRoZHp4cV83UEhyaGNpRWprNyJ9.eyJpc3MiOiJodHRwczovL2lkcWEubWNhZmVlLmNvbS8iLCJzdWIiOiJOekxyenc1blE5NE0xT0hQejRlS3VKTm0yNHNyMVcxdkBjbGllbnRzIiwiYXVkIjoiaHR0cHM6Ly9zZXJ2aWNlYXBpLm1jYWZlZS5jb20iLCJpYXQiOjE2ODk1OTU2MjAsImV4cCI6MTY4OTY4MjAyMCwiYXpwIjoiTnpMcnp3NW5ROTRNMU9IUHo0ZUt1Sk5tMjRzcjFXMXYiLCJzY29wZSI6ImFjY291bnQ6ZnVsbCBzdWJzY3JpcHRpb246ZnVsbCBvcmRlcjpmdWxsIGNhdGFsb2c6ZnVsbCBlZndwdWJsaXNoZXI6d3JpdGUiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.rNEEzKN2mn1zf0l0yDQmydtQGKdGU80AbOhPXlBkxFWchjorFjrq8EfGfcibb7eemDVZ2x0u50lG4AvYA9KLYJc3h-kLHW2sjMgdzw5VedIu7rSe7nRMoIl8LeF1I63FIYc2eLd3jnJvHGVhyAIP6eOEgMQxLlhTNOfpWI1Q5HgR5a-ZVPCpwNP8V7gbtQrwttCGCyIPEiq9_T5Jhl54p6vIdlSnsNY6K8lqwc8EZsGocLjAKZuleZoFMRnM5bmjVfv5vGd1nASqy_DGNIJ5OQI7KeeeS3YHpXp3kesFSKTVa9CvkSEsufjYXob6QI3jN21Leh8zvVLg5lCmSBnmmg", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PATCH", + "name": "Account status to Active", + "parameters": [ + { + "disabled": true, + "name": "subRefId", + "value": "{{tn_subRefId}}", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "var appKey = insomnia.environment.get("C2C_AppKey"); +var sharedKey = insomnia.environment.get("C2C_SharedKey"); +insomnia.environment.set("UserEmail_MTP_1_Device", insomnia.variables.replaceIn("Test_{{$timestamp}}@mcafee.com")); +var password = "Password@123"; +insomnia.environment.set("UserPassword_MTP_1_Device", password); +insomnia.environment.set("sw_id", insomnia.variables.replaceIn("{{$guid}}")); +insomnia.environment.set("hw_id", insomnia.variables.replaceIn("{{$guid}}")); + +", + "url": "{{servicediscovery}}/v1/users/{{ebiz_userRefId}}", + }, + { + "_id": "__REQ_6__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("response schema validation", function () { + insomnia.expect(insomnia.response.json().data.userRefId).to.be.a("string", "userRefId"); + insomnia.expect(insomnia.response.json().data.accountRefId).to.be.a("string", "accountRefId"); + insomnia.expect(insomnia.response.json().data.activationDevices).to.be.a("array", "activationDevices"); + + insomnia.expect(insomnia.response.json().data.activationDevices.length).to.eq(0, "activationDevices array length should be 0"); + +}); + +", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "", + "value": "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImNNVGRoZHp4cV83UEhyaGNpRWprNyJ9.eyJpc3MiOiJodHRwczovL2lkcWEubWNhZmVlLmNvbS8iLCJzdWIiOiJOekxyenc1blE5NE0xT0hQejRlS3VKTm0yNHNyMVcxdkBjbGllbnRzIiwiYXVkIjoiaHR0cHM6Ly9zZXJ2aWNlYXBpLm1jYWZlZS5jb20iLCJpYXQiOjE2ODk1OTU2MjAsImV4cCI6MTY4OTY4MjAyMCwiYXpwIjoiTnpMcnp3NW5ROTRNMU9IUHo0ZUt1Sk5tMjRzcjFXMXYiLCJzY29wZSI6ImFjY291bnQ6ZnVsbCBzdWJzY3JpcHRpb246ZnVsbCBvcmRlcjpmdWxsIGNhdGFsb2c6ZnVsbCBlZndwdWJsaXNoZXI6d3JpdGUiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.rNEEzKN2mn1zf0l0yDQmydtQGKdGU80AbOhPXlBkxFWchjorFjrq8EfGfcibb7eemDVZ2x0u50lG4AvYA9KLYJc3h-kLHW2sjMgdzw5VedIu7rSe7nRMoIl8LeF1I63FIYc2eLd3jnJvHGVhyAIP6eOEgMQxLlhTNOfpWI1Q5HgR5a-ZVPCpwNP8V7gbtQrwttCGCyIPEiq9_T5Jhl54p6vIdlSnsNY6K8lqwc8EZsGocLjAKZuleZoFMRnM5bmjVfv5vGd1nASqy_DGNIJ5OQI7KeeeS3YHpXp3kesFSKTVa9CvkSEsufjYXob6QI3jN21Leh8zvVLg5lCmSBnmmg", + }, + ], + "method": "GET", + "name": "without devices - v1/device-activations by userRefId", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{ebiz_userRefId}}", + }, + { + "disabled": true, + "name": "subRefId", + "value": "{{tn_subRefId}}", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v1/device-activations", + }, + { + "_id": "__REQ_7__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("response schema validation", function () { + + insomnia.expect(insomnia.response.json().data.length).to.eq(0, "data array length should be 0"); + +}); + +", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "without devices - v2/device-activations by userRefId", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{ebiz_userRefId}}", + }, + { + "disabled": true, + "name": "subRefId", + "value": "{{tn_subRefId}}", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_8__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("response schema validation", function () { + insomnia.expect(insomnia.response.json().data.userRefId).to.be.a("string", "userRefId"); + insomnia.expect(insomnia.response.json().data.accountRefId).to.be.a("string", "accountRefId"); + insomnia.expect(insomnia.response.json().data.activationDevices).to.be.a("array", "activationDevices"); + + insomnia.expect(insomnia.response.json().data.activationDevices.length).to.eq(0, "activationDevices array length should be 0"); + +}); + +", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "without devices - v1/device-activations by userRefId subrefId", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{ebiz_userRefId}}", + }, + { + "disabled": false, + "name": "subRefId", + "value": "{{provision_id}}", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v1/device-activations", + }, + { + "_id": "__REQ_9__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 400", function () { + insomnia.expect(insomnia.response.code).to.eq(400); +}); + +insomnia.test("response schema validation", function () { + insomnia.expect(insomnia.response.json().errors[0].reason).to.eq("userRefId is required"); + + + +}); + +", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "without devices - v1/device-activations by subrefId", + "parameters": [ + { + "disabled": true, + "name": "userRefId", + "value": "{{ebiz_userRefId}}", + }, + { + "disabled": false, + "name": "subRefId", + "value": "{{provision_id}}", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v1/device-activations", + }, + { + "_id": "__REQ_10__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("response schema validation", function () { + + insomnia.expect(insomnia.response.json().data.length).to.eq(0, "data array length should be 0"); + +}); + +", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "without devices - v2/device-activations by userRefId subrefId", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{ebiz_userRefId}}", + }, + { + "disabled": false, + "name": "subRefId", + "value": "{{provision_id}}", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_11__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("response schema validation", function () { + + insomnia.expect(insomnia.response.json().data.length).to.eq(0, "data array length should be 0"); + +}); + +", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "without devices - v2/device-activations by subrefId", + "parameters": [ + { + "disabled": true, + "name": "userRefId", + "value": "{{ebiz_userRefId}}", + }, + { + "disabled": false, + "name": "subRefId", + "value": "{{provision_id}}", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_12__", + "_type": "request", + "afterResponseScript": "var responseJson = insomnia.response.json() +insomnia.globals.set("ebiz_device_id_mobile",responseJson.device_id);", + "authentication": { + "disabled": false, + "prefix": "", + "token": "{{access_token}}", + "type": "bearer", + }, + "body": { + "mimeType": "text/plain", + "text": "{ + "device_name": "EinsteinPhone", + "device_type": "phone", + "device_os": "iOS", + "device_os_version": "5.0.1", + "app_install_status": "install", + "device_model": "Samsung GT-S5830L", + "device_brand_name": "Samsung", + "locale": "en-US", + "device_hardware_id": "2b22062f-ac5d-4855-8b67-87f271bebaee", + "device_number": "2b22062f-ac5d-4855-8b67-87f271bebaee", + "app_version": "7.7.0.0", + "app_install_date": "2022-06-23T00:00:00", + "eula_accept_date": "2022-10-23T00:00:00", + "device_memory": "300 MB", + "oobe_data": { + "sub_status": "Trial-Active", + "culture": "EN-US", + "aff_id": "0", + "plan": "Trial", + "pkg_id": "443", + "lcid": "1033", + "sku": "0-7323-103590", + "pkg_name": "McAfee® LiveSafe™", + "exp_date": "2023-10-23T00:00:00", + "email": "{{_['email_MTP_1_device']}}", + "mobilenumber": "8888765498", + "provision_id": "{{_['provision_id']}}", + "account_id": "{{_['acct_id_MTP_1_device']}}", + "product_key": "AC5D6E9C-F6CD-4A84-A7E3-EB3F24A3DB24", + "Global_Reference_Id": "{{_['grid_MTP_1_device']}}", + "productprovisionstate": "provision_complete" + }, + "preinstall_data": { + "Mylocation": "off", + "user_test": "ab test Einstein" + } +}", + }, + "description": "", + "headers": [ + { + "name": "X-McAfee-Agent", + "value": "M1A", + }, + { + "name": "X-McAfee-Agent-OS", + "value": "Android", + }, + { + "name": "Authorization", + "value": "Bearer {{access_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + { + "name": "Cookie", + "value": "HPrst=loc=&rm=iq5nNK-ISQc78yUmSkAv9A2; ADRUM_BT=R:0|i:2118875|g:1f966472-35cd-4c1b-9a09-4b9a565beb261495|e:1391|s:f|n:mcafee-test_2835d011-e415-4bd4-bf96-d6820720dcdf", + }, + ], + "method": "POST", + "name": "Add Devcie-EBIZ-M1A-Mobile", + "parameters": [], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{einstein_url}}/apps/v1/devices", + }, + { + "_id": "__REQ_13__", + "_type": "request", + "afterResponseScript": "var responseJson = insomnia.response.json() +insomnia.globals.set("ebiz_device_id_pc",responseJson.device_id);", + "authentication": { + "disabled": false, + "prefix": "", + "token": "{{access_token}}", + "type": "bearer", + }, + "body": { + "mimeType": "text/plain", + "text": "{ + "device_name": "DESKTOP-QP1NA0T", + "device_type": "pc", + "device_os": "WINDOWS", + "device_os_version": "10.0.22621", + "app_install_status": "install", + "device_model": "VMware7,1", + "device_brand_name": "VMware, Inc.", + "locale": "en-US", + "device_hardware_id": "2b22062f-ac5d-4855-8b67-87f271bebaee", + "device_number": "2b22062f-ac5d-4855-8b67-87f271bebaee", + "product_market_name": "16.0 R111", + "app_install_date": "2022-06-23T00:00:00", + "eula_accept_date": "2022-10-23T00:00:00", + "device_memory": "300 MB", + "oobe_data": { + "sub_status": "Trial-Active", + "culture": "EN-US", + "aff_id": "0", + "plan": "Trial", + "pkg_id": "443", + "lcid": "1033", + "sku": "0-7323-103590", + "pkg_name": "McAfee® LiveSafe™", + "exp_date": "2023-10-23T00:00:00", + "email": "{{_['email_MTP_1_device']}}", + "mobilenumber": "8888765498", + "provision_id": "{{_['provision_id']}}", + "account_id": "{{_['acct_id_MTP_1_device']}}", + "product_key": "AC5D6E9C-F6CD-4A84-A7E3-EB3F24A3DB24", + "Global_Reference_Id": "{{_['grid_MTP_1_device']}}", + "productprovisionstate": "provision_complete" + }, + "preinstall_data": { + "Mylocation": "off", + "user_test": "ab test Einstein" + } +}", + }, + "description": "", + "headers": [ + { + "name": "X-McAfee-Agent", + "value": "WPS", + }, + { + "name": "X-McAfee-Agent-OS", + "value": "Windows", + }, + { + "name": "Authorization", + "value": "Bearer {{access_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + { + "name": "Cookie", + "value": "HPrst=loc=&rm=iq5nNK-ISQc78yUmSkAv9A2; ADRUM_BT=R:0|i:2118875|g:1f966472-35cd-4c1b-9a09-4b9a565beb261495|e:1391|s:f|n:mcafee-test_2835d011-e415-4bd4-bf96-d6820720dcdf", + }, + ], + "method": "POST", + "name": "Add Devcie-EBIZ-WPS-windows", + "parameters": [], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{einstein_url}}/apps/v1/devices", + }, + { + "_id": "__REQ_14__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 201", function () { + insomnia.expect(insomnia.response.code).to.eq(201); + const Request = JSON.parse(insomnia.request.body.raw); + // insomnia.environment.set("userRefId_tn", Request.userRefId); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "deviceRefId": "{{ebiz_device_id_mobile}}", + "subRefId": "{{provision_id}}", + "userRefId": "{{globalReferenceId}}", + "activationTime": {{activationTime}}, + "activationStatus": "ACTIVATED" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "success-ebiz-M1A-device", + "parameters": [], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v1/device-activations", + }, + { + "_id": "__REQ_15__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 201", function () { + insomnia.expect(insomnia.response.code).to.eq(201); + const Request = JSON.parse(insomnia.request.body.raw); + // insomnia.environment.set("userRefId_tn", Request.userRefId); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "deviceRefId": "{{ebiz_device_id_pc}}", + "subRefId": "{{provision_id}}", + "userRefId": "{{globalReferenceId}}", + "activationTime": {{activationTime}}, + "activationStatus": "ACTIVATED" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "success-ebiz-windows-device", + "parameters": [], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v1/device-activations", + }, + { + "_id": "__GRP_3__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "", + "environment": {}, + "name": "TN Account & Device - M1A and WPS Devices - V2", + "parentId": "__GRP_1__", + "preRequestScript": "", + }, + { + "_id": "__GRP_4__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "", + "environment": {}, + "name": "create-tn-subscripiton-device-activate", + "parentId": "__GRP_3__", + "preRequestScript": "", + }, + { + "_id": "__REQ_16__", + "_type": "request", + "afterResponseScript": "insomnia.environment.set("created_user_ref_id", insomnia.response.json().data.userRefID) +insomnia.environment.set("globalRefID", insomnia.response.json().data.globalRefID)", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "firstName": "{% faker 'randomFirstName' %}", + "middleName": "Robert", + "lastName": "{% faker 'randomLastName' %}", + "accountName": "John", + "emailAddress": "{% faker 'randomEmail' %}", + "phoneNumber": "+7098764322", + "userOptins": [ + 1 + ], + "countryCode": "{% faker 'randomCountryCode' %}", + "gender": "male", + "password": "mypas@!#1sword", + "passwordType": "AutoCreated", + "accountType": "PERSONAL" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "Create Account", + "parameters": [], + "parentId": "__GRP_4__", + "preRequestScript": "", + "url": "{{_['account-func']}}/v1/register", + }, + { + "_id": "__REQ_17__", + "_type": "request", + "afterResponseScript": " +insomnia.test("Status code is 201", function () { + insomnia.response.to.have.status(201); + insomnia.globals.set("orderRefIdcreate", insomnia.response.json().data.orderRefId); + console.log("orderRefIdcreate generated is " + insomnia.globals.get("orderRefIdcreate")); +}); + + + +var bodydata = JSON.parse(insomnia.request.body.raw) + +console.log(bodydata.channelRefId) + +insomnia.globals.set("channelRefIdcreate", bodydata.channelRefId); + +insomnia.test("Verify Response Json - Basic", function () { + var jsonResData = insomnia.response.json(); + var bodydata = JSON.parse(insomnia.request.body.raw) + insomnia.globals.set("postBodyData", bodydata); + insomnia.expect(jsonResData.data.cultureCode).to.eq(bodydata.cultureCode); + insomnia.expect(jsonResData.data.cultureCode).to.be.a("string"); + insomnia.expect(jsonResData.data.orderStatus).to.eq("INITIATED"); + insomnia.expect(jsonResData.data.orderStatus).to.be.a("string"); + insomnia.expect(jsonResData.data.orderItems.count()).to.eq(bodydata.orderItems.count()); + insomnia.expect(jsonResData.data.orderItems[0].planCode).to.eq(bodydata.orderItems[0].planCode); + insomnia.expect(jsonResData.data.orderItems[0].planCode).to.be.a("string"); + insomnia.expect(jsonResData.data.orderItems[0].planClientCode).to.eq("666_1YEAR_BASE_PAID_AR"); + insomnia.expect(jsonResData.data.orderItems[0].planClientCode).to.be.a("string"); +}); + +insomnia.test("Response Schema Validation", function () { + insomnia.expect(insomnia.response.json().data.orderRefId).to.be.a("string", "orderRefId"); + insomnia.expect(insomnia.response.json().data.orderCode).to.be.a("string", "orderCode"); + insomnia.expect(insomnia.response.json().data.transactionSource).to.be.a("string", "transactionSource"); + insomnia.expect(insomnia.response.json().data.cultureCode).to.be.a("string", "cultureCode"); + insomnia.expect(insomnia.response.json().data.orderStatus).to.be.a("string", "orderStatus"); + insomnia.expect(insomnia.response.json().data.orderItems).to.be.a("array", "orderItems"); + insomnia.expect(insomnia.response.json().data.orderItems[0].id).to.be.a("string", "id"); + insomnia.expect(insomnia.response.json().data.orderItems[0].planCode).to.be.a("string", "planCode"); + insomnia.expect(insomnia.response.json().data.orderItems[0].planClientCode).to.be.a("string", "planClientCode"); + +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "userRefId": "{{_['created_user_ref_id']}}", + "channelRefId": "{{_['channelRefId']}}", + "countryCode": "US", + "currencyCode": "{{_['currencyCode']}}", + "cultureCode": "{{_['cultureCode']}}", + "walletId": "{{_['walletId']}}", + "promoCode": "{{_['promoCode']}}", + "taxRefId": "{{_['taxRefId']}}", + "orderItems": [ + { + "action": "CREATE", + "planCode": "{{_['planCode']}}", + "subRefId": "", + "offerId": "{{_['offerId']}}", + "qty": 1, + "msrp": 110, + "tax": 9.25, + "taxRefId": "{{_['orderItemstaxRefId']}}", + "discount": 20, + "netPayment": 100, + "currencyCode": "{{_['currencyCode']}}", + "autoRenew": true, + "cultureCode": "{{_['cultureCode']}}", + "daysToExtend": 100, + "instrumentCategory": "{{_['instrumentCategory']}}", + "instrumentKey": "{{_['instrumentKey']}}" + } + ], + "taxCountryCode": "US", + "vatRate": 0.0925, + "vatNumber": "P&G-851223_B24", + "msrp": 110, + "discount": 20, + "netPayment": 100, + "tax": 9.25 +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "Create Order", + "parameters": [], + "parentId": "__GRP_4__", + "preRequestScript": "", + "url": "{{_['order-orch']}}/v2/orders", + }, + { + "_id": "__REQ_18__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.response.to.have.status(200); +}); + +insomnia.environment.set("tn_subRefId", insomnia.response.json().data.subscriptions[0].id); +insomnia.environment.set("tn_userRefId", insomnia.response.json().data.userRefId); + + +", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "orderStatus": "FULFILLED", + "paymentRefId": "cfc51df9-f0b6-4aee-9fbd-5922f3ca548c", + "autoRenew": false +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PUT", + "name": "Create Subscription", + "parameters": [], + "parentId": "__GRP_4__", + "preRequestScript": "", + "url": "{{_['order-orch']}}/v2/orders/{{_['orderRefIdcreate']}}", + }, + { + "_id": "__REQ_19__", + "_type": "request", + "afterResponseScript": "insomnia.test("response is 201", function() +{ + insomnia.response.to.have.status(201); +}); +var jsonData = insomnia.response.json(); +// insomnia.test("response has id", function() +// { +// insomnia.expect(jsonData.data).to.haveOwnProperty("id"); +// insomnia.expect(jsonData.data.id).to.not.equal(null); +// }); +insomnia.environment.set("tn_mobile_deviceRefId",jsonData.data.deviceRefId); + +var reqestData = JSON.parse(insomnia.request.body); +insomnia.environment.set("device_name",reqestData.name); +insomnia.environment.set("device_type",reqestData.type); +insomnia.environment.set("device_platform",reqestData.platform); +insomnia.environment.set("device_platformVersion",reqestData.platformVersion); +insomnia.environment.set("device_osLocale",reqestData.osLocale); +insomnia.environment.set("device_manufacturerModel",reqestData.manufacturerModel); +insomnia.environment.set("device_manufacturerName",reqestData.manufacturerName);", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "name": "{% faker 'randomUserName' %}", + "type": "MOBILE", + "platform": "IOS", + "platformVersion": "IPadOS 15.3.1", + "osLocale": "{% faker 'randomCountryCode' %}", + "manufacturerModel": "Apple A10", + "manufacturerName": "Apple", + "platformUniqueId": "{% faker 'guid' %}", + "installedTime": {{installedTime}} +}", + }, + "description": "", + "headers": [ + { + "name": "X-Corelation-Id", + "value": "{% faker 'guid' %}", + }, + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "Device Installation - Mobile - IOS", + "parameters": [], + "parentId": "__GRP_4__", + "preRequestScript": "var d1= new Date(Date.now()); installedTime=Math.floor(d1.getTime()); +insomnia.environment.set("installedTime",installedTime); +var platformUniqueId = insomnia.variables.replaceIn("{{$guid}}"); +insomnia.environment.set("platformUniqueId",platformUniqueId); +var deviceName = insomnia.variables.replaceIn("{{$randomUserName}}"); +insomnia.environment.set("deviceName",deviceName); + +var Countrucode = insomnia.variables.replaceIn("{{$randomCountryCode}}"); +insomnia.environment.set("Countrucode", Countrucode); +const Array_1 = ["Tablet","PC","Mobile"]; +var qty1 = _.random(0, 2); +//insomnia.variables.set("qty", qty1); +console.log("qty"+qty1); +console.log("array_1"+Array_1[qty1]); +if(Array_1[qty1]==="Tablet") +{ + insomnia.environment.set("type","Tablet") + const Array_2 = ["IOS","Android"]; + var qty2 = _.random(0, 1); + console.log("qty"+qty2); + console.log("array_2"+Array_2[qty2]); + if(Array_2[qty2]==="IOS") + { + console.log("IOS"); + insomnia.environment.set("platform", "IOS"); + insomnia.environment.set("platformVersion", "IPadOS 15.3.1"); + insomnia.environment.set("manufacturerModel", "Apple A10"); + insomnia.environment.set("manufacturerName", "Apple"); + } + else + { + console.log("Android"); + insomnia.environment.set("platform", "Android"); + insomnia.environment.set("platformVersion", "android- 3.1.225.0"); + insomnia.environment.set("manufacturerModel", "Samsung GT-S5830L"); + insomnia.environment.set("manufacturerName", "Samsung"); + } + +} +else if(Array_1[qty1]==="PC") +{ + console.log("++++++++++++++++") + insomnia.environment.set("type","PC") + insomnia.environment.set("platform", "Windows"); + insomnia.environment.set("platformVersion", "Windows- 3.1.225.0"); + insomnia.environment.set("manufacturerModel", "Windows GT-S5830L"); + insomnia.environment.set("manufacturerName", "Windows"); +} +else +{ + console.log("---------------------------") + insomnia.environment.set("type","Mobile") + const Array_3 = ["IOS","Android"]; + var qty3 = _.random(0, 1); + console.log("qty"+qty3); + console.log("array_3"+Array_3[qty3]); + if(Array_3[qty3]==="IOS") + { + console.log("IOS"); + insomnia.environment.set("platform", "IOS"); + insomnia.environment.set("platformVersion", "IPadOS 15.3.1"); + insomnia.environment.set("manufacturerModel", "Apple A10"); + insomnia.environment.set("manufacturerName", "Apple"); + } + else + { + console.log("Android"); + insomnia.environment.set("platform", "Android"); + insomnia.environment.set("platformVersion", "android- 3.1.225.0"); + insomnia.environment.set("manufacturerModel", "Samsung GT-S5830L"); + insomnia.environment.set("manufacturerName", "Samsung"); + } +} + + +", + "url": "{{_['device-func']}}/devices", + }, + { + "_id": "__REQ_20__", + "_type": "request", + "afterResponseScript": "insomnia.test("response is 201", function() +{ + insomnia.response.to.have.status(201); +}); +var jsonData = insomnia.response.json(); +// insomnia.test("response has id", function() +// { +// insomnia.expect(jsonData.data).to.haveOwnProperty("id"); +// insomnia.expect(jsonData.data.id).to.not.equal(null); +// }); +insomnia.environment.set("tn_pc_deviceRefId",jsonData.data.deviceRefId); + +var reqestData = JSON.parse(insomnia.request.body); +insomnia.environment.set("device_name",reqestData.name); +insomnia.environment.set("device_type",reqestData.type); +insomnia.environment.set("device_platform",reqestData.platform); +insomnia.environment.set("device_platformVersion",reqestData.platformVersion); +insomnia.environment.set("device_osLocale",reqestData.osLocale); +insomnia.environment.set("device_manufacturerModel",reqestData.manufacturerModel); +insomnia.environment.set("device_manufacturerName",reqestData.manufacturerName);", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "name": "{% faker 'randomUserName' %}", + "type": "PC", + "platform": "WINDOWS", + "platformVersion": "Windows- 3.1.225.0", + "osLocale": "{% faker 'randomCountryCode' %}", + "manufacturerModel": "Windows GT-S5830L", + "manufacturerName": "Windows", + "platformUniqueId": "{% faker 'guid' %}", + "installedTime": {{_['installedTime']}} +}", + }, + "description": "", + "headers": [ + { + "name": "X-Corelation-Id", + "value": "{% faker 'guid' %}", + }, + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "Device Installation - Windows", + "parameters": [], + "parentId": "__GRP_4__", + "preRequestScript": "var d1= new Date(Date.now()); installedTime=Math.floor(d1.getTime()); +insomnia.environment.set("installedTime",installedTime); +var platformUniqueId = insomnia.variables.replaceIn("{{$guid}}"); +insomnia.environment.set("platformUniqueId",platformUniqueId); +var deviceName = insomnia.variables.replaceIn("{{$randomUserName}}"); +insomnia.environment.set("deviceName",deviceName); + +var Countrucode = insomnia.variables.replaceIn("{{$randomCountryCode}}"); +insomnia.environment.set("Countrucode", Countrucode); +const Array_1 = ["Tablet","PC","Mobile"]; +var qty1 = _.random(0, 2); +//insomnia.variables.set("qty", qty1); +console.log("qty"+qty1); +console.log("array_1"+Array_1[qty1]); +if(Array_1[qty1]==="Tablet") +{ + insomnia.environment.set("type","Tablet") + const Array_2 = ["IOS","Android"]; + var qty2 = _.random(0, 1); + console.log("qty"+qty2); + console.log("array_2"+Array_2[qty2]); + if(Array_2[qty2]==="IOS") + { + console.log("IOS"); + insomnia.environment.set("platform", "IOS"); + insomnia.environment.set("platformVersion", "IPadOS 15.3.1"); + insomnia.environment.set("manufacturerModel", "Apple A10"); + insomnia.environment.set("manufacturerName", "Apple"); + } + else + { + console.log("Android"); + insomnia.environment.set("platform", "Android"); + insomnia.environment.set("platformVersion", "android- 3.1.225.0"); + insomnia.environment.set("manufacturerModel", "Samsung GT-S5830L"); + insomnia.environment.set("manufacturerName", "Samsung"); + } + +} +else if(Array_1[qty1]==="PC") +{ + console.log("++++++++++++++++") + insomnia.environment.set("type","PC") + insomnia.environment.set("platform", "Windows"); + insomnia.environment.set("platformVersion", "Windows- 3.1.225.0"); + insomnia.environment.set("manufacturerModel", "Windows GT-S5830L"); + insomnia.environment.set("manufacturerName", "Windows"); +} +else +{ + console.log("---------------------------") + insomnia.environment.set("type","Mobile") + const Array_3 = ["IOS","Android"]; + var qty3 = _.random(0, 1); + console.log("qty"+qty3); + console.log("array_3"+Array_3[qty3]); + if(Array_3[qty3]==="IOS") + { + console.log("IOS"); + insomnia.environment.set("platform", "IOS"); + insomnia.environment.set("platformVersion", "IPadOS 15.3.1"); + insomnia.environment.set("manufacturerModel", "Apple A10"); + insomnia.environment.set("manufacturerName", "Apple"); + } + else + { + console.log("Android"); + insomnia.environment.set("platform", "Android"); + insomnia.environment.set("platformVersion", "android- 3.1.225.0"); + insomnia.environment.set("manufacturerModel", "Samsung GT-S5830L"); + insomnia.environment.set("manufacturerName", "Samsung"); + } +} + + +", + "url": "{{_['device-func']}}/devices", + }, + { + "_id": "__REQ_21__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 201", function () { + insomnia.expect(insomnia.response.code).to.eq(201); + const Request = JSON.parse(insomnia.request.body.raw); + // insomnia.environment.set("userRefId_tn", Request.userRefId); +}); + +insomnia.test("Response should include activationRefId", function () { + const responseData = insomnia.response.json(); + insomnia.expect(responseData.data.activationRefId).to.be.a("string", "activationRefId"); + insomnia.environment.set("tn_mobile_activationRefId", responseData.data.activationRefId); + insomnia.expect(responseData.data.activationRefId).to.not.include("ez_", "activationRefId"); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "deviceRefId": "{{tn_mobile_deviceRefId}}", + "subRefId": "{{tn_subRefId}}", + "userRefId": "{{tn_userRefId}}", + "activationTime": {{epoch}}, + "activationStatus": "ACTIVATED" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "success-tn-M1A-device", + "parameters": [], + "parentId": "__GRP_4__", + "preRequestScript": "var epoch = (new Date).getTime(); +postman.setEnvironmentVariable("epoch", epoch);", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_22__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + + +const schema = { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "subRefid": { + "type": "string" + }, + "accountRefId": { + "type": "string" + }, + "users": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "role": { + "type": "string" + }, + "deviceActivations": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "deviceRefId": { + "type": "string" + }, + "activationRefId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "platform": { + "type": "string" + }, + "platformVersion": { + "type": "string" + }, + "osLocale": { + "type": "string" + }, + "manufacturerModel": { + "type": "string" + }, + "manufacturerName": { + "type": "string" + }, + "platformUniqueId": { + "type": "string" + }, + "activationStatus": { + "type": "string" + }, + "deviceFirstSeenTime": { + "type": "integer" + }, + "deviceLastSeenTime": { + "type": "integer" + }, + "activationTime": { + "type": "integer" + }, + "deactivationTime": { + "type": "integer" + }, + "deviceActivationFirstSeenTime": { + "type": "integer" + }, + "deviceActivationLastSeenTime": { + "type": "integer" + }, + "uninstalledTime": { + "type": "integer" + }, + "installedTime": { + "type": "integer" + } + }, + "required": [ + "deviceRefId", + "activationRefId", + "name", + "type", + "platform", + "platformVersion", + "osLocale", + "manufacturerModel", + "manufacturerName", + "platformUniqueId", + "activationStatus", + "deviceFirstSeenTime", + "deviceLastSeenTime", + "activationTime", + "deactivationTime", + "deviceActivationFirstSeenTime", + "deviceActivationLastSeenTime", + "uninstalledTime", + "installedTime" + ] + } + ] + } + }, + "required": [ + "id", + "role", + "deviceActivations" + ] + } + ] + } + }, + "required": [ + "subRefId", + "accountRefId", + "users" + ] + } + ] + } + }, + "required": [ + "data" + ] +} + +insomnia.test("Validate schema", () => { + insomnia.response.to.have.jsonSchema(schema); +}); + +insomnia.test("mobile device - last seen time should be updated",function(){ + var counter=0 + var jsonResData = insomnia.response.json(); + insomnia.environment.set("tn_mobile_subRefId", jsonResData.data[0].subRefId); + for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_mobile_activationRefId")){ + counter++ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("MOBILE"); + insomnia.environment.set("tn_mobile_deviceActivationFirstSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_mobile_deviceActivationLastSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + } + insomnia.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, "only mobile device should be returned in response") + +}) + +", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "success-tn-userrefId", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{tn_userRefId}}", + }, + ], + "parentId": "__GRP_4__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_23__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + + +const schema = { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "subRefid": { + "type": "string" + }, + "accountRefId": { + "type": "string" + }, + "users": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "role": { + "type": "string" + }, + "deviceActivations": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "deviceRefId": { + "type": "string" + }, + "activationRefId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "platform": { + "type": "string" + }, + "platformVersion": { + "type": "string" + }, + "osLocale": { + "type": "string" + }, + "manufacturerModel": { + "type": "string" + }, + "manufacturerName": { + "type": "string" + }, + "platformUniqueId": { + "type": "string" + }, + "activationStatus": { + "type": "string" + }, + "deviceFirstSeenTime": { + "type": "integer" + }, + "deviceLastSeenTime": { + "type": "integer" + }, + "activationTime": { + "type": "integer" + }, + "deactivationTime": { + "type": "integer" + }, + "deviceActivationFirstSeenTime": { + "type": "integer" + }, + "deviceActivationLastSeenTime": { + "type": "integer" + }, + "uninstalledTime": { + "type": "integer" + }, + "installedTime": { + "type": "integer" + } + }, + "required": [ + "deviceRefId", + "activationRefId", + "name", + "type", + "platform", + "platformVersion", + "osLocale", + "manufacturerModel", + "manufacturerName", + "platformUniqueId", + "activationStatus", + "deviceFirstSeenTime", + "deviceLastSeenTime", + "activationTime", + "deactivationTime", + "deviceActivationFirstSeenTime", + "deviceActivationLastSeenTime", + "uninstalledTime", + "installedTime" + ] + } + ] + } + }, + "required": [ + "id", + "role", + "deviceActivations" + ] + } + ] + } + }, + "required": [ + "subRefId", + "accountRefId", + "users" + ] + } + ] + } + }, + "required": [ + "data" + ] +} + +insomnia.test("Validate schema", () => { + insomnia.response.to.have.jsonSchema(schema); +}); + +insomnia.test("json response should have all the details",function(){ + const responseData = insomnia.response.json(); + + console.log(responseData) + + insomnia.expect(insomnia.environment.get("tn_userRefId")).to.eq(responseData.data[0].users[0].id); + insomnia.expect(responseData.data[0].subRefId).to.eq(insomnia.environment.get("tn_subRefId")); + + +}) + +insomnia.test("mobile device - last seen time should be updated",function(){ + var counter=0 + var jsonResData = insomnia.response.json(); + insomnia.environment.set("tn_mobile_subRefId", jsonResData.data[0].subRefId); + for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_mobile_activationRefId")){ + counter++ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("MOBILE"); + insomnia.environment.set("tn_mobile_deviceActivationFirstSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_mobile_deviceActivationLastSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + } + insomnia.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, "only mobile device should be returned in response") + +}) + +", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "success with tn-userRefID-subRefID", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{tn_userRefId}}", + }, + { + "disabled": false, + "name": "subRefId", + "value": "{{tn_subRefId}}", + }, + ], + "parentId": "__GRP_4__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_24__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 201", function () { + insomnia.expect(insomnia.response.code).to.eq(201); + const Request = JSON.parse(insomnia.request.body.raw); + // insomnia.environment.set("userRefId_tn", Request.userRefId); +}); + +insomnia.test("Response should include activationRefId", function () { + const responseData = insomnia.response.json(); + insomnia.expect(responseData.data.activationRefId).to.be.a("string", "activationRefId"); + insomnia.environment.set("tn_pc_activationRefId", responseData.data.activationRefId); + insomnia.expect(responseData.data.activationRefId).to.not.include("ez_", "activationRefId"); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "deviceRefId": "{{tn_pc_deviceRefId}}", + "subRefId": "{{tn_subRefId}}", + "userRefId": "{{tn_userRefId}}", + "activationTime": {{epoch}}, + "activationStatus": "ACTIVATED" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "success-tn-windows-device", + "parameters": [], + "parentId": "__GRP_4__", + "preRequestScript": "var epoch = (new Date).getTime(); +postman.setEnvironmentVariable("epoch", epoch);", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_25__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + + +const schema = { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "subRefid": { + "type": "string" + }, + "accountRefId": { + "type": "string" + }, + "users": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "role": { + "type": "string" + }, + "deviceActivations": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "deviceRefId": { + "type": "string" + }, + "activationRefId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "platform": { + "type": "string" + }, + "platformVersion": { + "type": "string" + }, + "osLocale": { + "type": "string" + }, + "manufacturerModel": { + "type": "string" + }, + "manufacturerName": { + "type": "string" + }, + "platformUniqueId": { + "type": "string" + }, + "activationStatus": { + "type": "string" + }, + "deviceFirstSeenTime": { + "type": "integer" + }, + "deviceLastSeenTime": { + "type": "integer" + }, + "activationTime": { + "type": "integer" + }, + "deactivationTime": { + "type": "integer" + }, + "deviceActivationFirstSeenTime": { + "type": "integer" + }, + "deviceActivationLastSeenTime": { + "type": "integer" + }, + "uninstalledTime": { + "type": "integer" + }, + "installedTime": { + "type": "integer" + } + }, + "required": [ + "deviceRefId", + "activationRefId", + "name", + "type", + "platform", + "platformVersion", + "osLocale", + "manufacturerModel", + "manufacturerName", + "platformUniqueId", + "activationStatus", + "deviceFirstSeenTime", + "deviceLastSeenTime", + "activationTime", + "deactivationTime", + "deviceActivationFirstSeenTime", + "deviceActivationLastSeenTime", + "uninstalledTime", + "installedTime" + ] + } + ] + } + }, + "required": [ + "id", + "role", + "deviceActivations" + ] + } + ] + } + }, + "required": [ + "subRefId", + "accountRefId", + "users" + ] + } + ] + } + }, + "required": [ + "data" + ] +} + +insomnia.test("Validate schema", () => { + insomnia.response.to.have.jsonSchema(schema); +}); + +insomnia.test("pc device - last seen time should be updated",function(){ + var counter=0 + var jsonResData = insomnia.response.json(); + insomnia.environment.set("tn_pc_subRefId", jsonResData.data[0].subRefId); + for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_pc_activationRefId")){ + counter++ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("PC"); + insomnia.environment.set("tn_pc_deviceActivationFirstSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_pc_deviceActivationLastSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_mobile_activationRefId")){ + counter++ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("MOBILE"); + insomnia.environment.set("tn_mobile_deviceActivationFirstSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_mobile_deviceActivationLastSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + } + insomnia.expect(counter).eq(2, "pc and mobile both should be returned in response"); + +}) + +", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "success-tn-userrefId", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{tn_userRefId}}", + }, + ], + "parentId": "__GRP_4__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_26__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + + +const schema = { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "subRefid": { + "type": "string" + }, + "accountRefId": { + "type": "string" + }, + "users": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "role": { + "type": "string" + }, + "deviceActivations": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "deviceRefId": { + "type": "string" + }, + "activationRefId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "platform": { + "type": "string" + }, + "platformVersion": { + "type": "string" + }, + "osLocale": { + "type": "string" + }, + "manufacturerModel": { + "type": "string" + }, + "manufacturerName": { + "type": "string" + }, + "platformUniqueId": { + "type": "string" + }, + "activationStatus": { + "type": "string" + }, + "deviceFirstSeenTime": { + "type": "integer" + }, + "deviceLastSeenTime": { + "type": "integer" + }, + "activationTime": { + "type": "integer" + }, + "deactivationTime": { + "type": "integer" + }, + "deviceActivationFirstSeenTime": { + "type": "integer" + }, + "deviceActivationLastSeenTime": { + "type": "integer" + }, + "uninstalledTime": { + "type": "integer" + }, + "installedTime": { + "type": "integer" + } + }, + "required": [ + "deviceRefId", + "activationRefId", + "name", + "type", + "platform", + "platformVersion", + "osLocale", + "manufacturerModel", + "manufacturerName", + "platformUniqueId", + "activationStatus", + "deviceFirstSeenTime", + "deviceLastSeenTime", + "activationTime", + "deactivationTime", + "deviceActivationFirstSeenTime", + "deviceActivationLastSeenTime", + "uninstalledTime", + "installedTime" + ] + } + ] + } + }, + "required": [ + "id", + "role", + "deviceActivations" + ] + } + ] + } + }, + "required": [ + "subRefId", + "accountRefId", + "users" + ] + } + ] + } + }, + "required": [ + "data" + ] +} + +insomnia.test("Validate schema", () => { + insomnia.response.to.have.jsonSchema(schema); +}); + +insomnia.test("json response should have all the details",function(){ + const responseData = insomnia.response.json(); + + console.log(responseData) + + insomnia.expect(insomnia.environment.get("tn_userRefId")).to.eq(responseData.data[0].users[0].id); + insomnia.expect(responseData.data[0].subRefId).to.eq(insomnia.environment.get("tn_subRefId")); + + +}) + +insomnia.test("pc device - last seen time should be updated",function(){ + var counter = 0; + var jsonResData = insomnia.response.json(); + insomnia.environment.set("tn_pc_subRefId", jsonResData.data[0].subRefId); + for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_pc_activationRefId")){ + counter++ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("PC"); + insomnia.environment.set("tn_pc_deviceActivationFirstSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_pc_deviceActivationLastSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_mobile_activationRefId")){ + counter++ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("MOBILE"); + insomnia.environment.set("tn_mobile_deviceActivationFirstSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_mobile_deviceActivationLastSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + } + insomnia.expect(counter).eq(2, "pc and mobile both should be returned in response"); + + +}) + +", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "success with tn-userRefID-subRefID", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{tn_userRefId}}", + }, + { + "disabled": false, + "name": "subRefId", + "value": "{{tn_subRefId}}", + }, + ], + "parentId": "__GRP_4__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__GRP_5__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "", + "environment": {}, + "name": "patch-device-activations", + "parentId": "__GRP_3__", + "preRequestScript": "", + }, + { + "_id": "__REQ_27__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("Response should include activationRefId", function () { + const responseData = insomnia.response.json(); + insomnia.expect(responseData.data.activationRefId).to.eq(insomnia.environment.get("tn_mobile_activationRefId"), "activationRefId"); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "deviceRefId": "{{tn_mobile_deviceRefId}}", + "userRefId": "{{tn_userRefId}}", + "globalRefId": "{{globalRefID}}", + "subRefId": "{{tn_subRefId}}", + "deviceActivationLastSeenTime": {{epoch}} +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PATCH", + "name": "M1A - success", + "parameters": [], + "parentId": "__GRP_5__", + "preRequestScript": "var epoch = (new Date).getTime(); +postman.setEnvironmentVariable("epoch", epoch); +console.log(insomnia.environment.get("epoch"));", + "url": "{{_['device-orch']}}/v2/device-activations/{{_['tn_mobile_activationRefId']}}", + }, + { + "_id": "__REQ_28__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("mobile device - last seen time should be updated",function(){ + var jsonResData = insomnia.response.json(); + + for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_mobile_activationRefId")){ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("MOBILE"); + insomnia.environment.set("tn_mobile_deviceActivationFirstSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_mobile_deviceActivationLastSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + } + +}) + +insomnia.test("deviceActivationLastSeenTime should not match", function () { + insomnia.expect(insomnia.environment.get("tn_mobile_deviceActivationLastSeenTime")).to.eq(parseInt(insomnia.environment.get("epoch"))) + });", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "activation status", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{tn_userRefId}}", + }, + ], + "parentId": "__GRP_5__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_29__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("Response should include activationRefId", function () { + const responseData = insomnia.response.json(); + insomnia.expect(responseData.data.activationRefId).to.eq(insomnia.environment.get("tn_pc_activationRefId"), "activationRefId"); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "deviceRefId": "{{tn_pc_deviceRefId}}", + "userRefId": "{{tn_userRefId}}", + "globalRefId": "{{globalRefID}}", + "subRefId": "{{tn_subRefId}}", + "deviceActivationLastSeenTime": {{epoch}} +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PATCH", + "name": "WPS - success", + "parameters": [], + "parentId": "__GRP_5__", + "preRequestScript": "var epoch = (new Date).getTime(); +postman.setEnvironmentVariable("epoch", epoch); +// console.log(insomnia.environment.get("epoch"));", + "url": "{{_['device-orch']}}/v2/device-activations/{{_['tn_pc_activationRefId']}}", + }, + { + "_id": "__REQ_30__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("pc device - last seen time should be updated",function(){ + var jsonResData = insomnia.response.json(); + + for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_pc_activationRefId")){ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("PC"); + insomnia.environment.set("tn_pc_deviceActivationFirstSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_pc_deviceActivationLastSeenTime", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + } + +}) + +insomnia.test("deviceActivationLastSeenTime should not match", function () { + insomnia.expect(insomnia.environment.get("tn_pc_deviceActivationLastSeenTime")).to.eq(parseInt(insomnia.environment.get("epoch"))) + });", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "activation status", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{tn_userRefId}}", + }, + ], + "parentId": "__GRP_5__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_31__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("Response should include activationRefId", function () { + const responseData = insomnia.response.json(); + insomnia.expect(responseData.data.activationRefId).to.eq(insomnia.environment.get("tn_pc_activationRefId"), "activationRefId"); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "userRefId": "{{tn_userRefId}}", + "globalRefId": "{{globalRefID}}", + "subRefId": "{{tn_subRefId}}", + "deviceActivationLastSeenTime": {{epoch}} +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PATCH", + "name": "deviceRefId is not mandatory", + "parameters": [], + "parentId": "__GRP_5__", + "preRequestScript": "var epoch = (new Date).getTime(); +postman.setEnvironmentVariable("epoch", epoch); +// console.log(insomnia.environment.get("epoch"));", + "url": "{{_['device-orch']}}/v2/device-activations/{{_['tn_pc_activationRefId']}}", + }, + { + "_id": "__GRP_6__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "", + "environment": {}, + "name": "patch-uninstall - Update test case subRefId ad mandatory", + "parentId": "__GRP_3__", + "preRequestScript": "", + }, + { + "_id": "__GRP_7__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "", + "environment": {}, + "name": "M1A", + "parentId": "__GRP_6__", + "preRequestScript": "", + }, + { + "_id": "__REQ_32__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("Response should include activationRefId", function () { + const responseData = insomnia.response.json(); + insomnia.expect(responseData.data.activationRefId).to.eq(insomnia.environment.get("tn_mobile_activationRefId"), "activationRefId"); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "uninstalled": true, + "deviceRefId": "{{tn_mobile_deviceRefId}}", + "lastSeenTime": {{epoch}}, + "uninstallTime": {{epoch}}, + "subRefId": "{{tn_subRefId}}" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PATCH", + "name": "unistall mobile device - with lastSeenTime & uninstallTime", + "parameters": [], + "parentId": "__GRP_7__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations/{{_['tn_mobile_activationRefId']}}", + }, + { + "_id": "__REQ_33__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +var jsonResData = insomnia.response.json(); + +insomnia.test("wps device should be returned in response since mobile is removed",function(){ + var counter=0 + + for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_pc_activationRefId")){ + counter++ + + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("PC"); + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].activationStatus).to.eq("ACTIVATED"); + insomnia.environment.set("tn_pc_after_uninstall_firstSeen_25", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_pc_after_uninstall_lastSeen_25", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + } + insomnia.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, "Only PC device should be returned"); + +})", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "after mobile uninstallation", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{tn_userRefId}}", + }, + ], + "parentId": "__GRP_7__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_34__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +var jsonResData = insomnia.response.json(); + +insomnia.test("pc & mobile device should be returned in response",function(){ + var counter = 0 + + for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_mobile_activationRefId")){ + counter++ + + console.log(jsonResData.data[0].users[0].deviceActivations[i].activationRefId) + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].activationStatus).to.eq("ACTIVATED"); + insomnia.environment.set("tn_mobile_after_uninstalled_firstSeen_25", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_mobile_after_uninstalled_lastSeen_25", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + console.log(jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime) + } + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_pc_activationRefId")){ + counter++ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("PC"); + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].activationStatus).to.eq("ACTIVATED"); + insomnia.environment.set("tn_pc_after_uninstall_firstSeen_25", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_pc_after_uninstall_lastSeen_25", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + } + + insomnia.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, "PC & Mobile device should be returned"); + +}) + +insomnia.test("uninstalledTime should be returned in response", function () { + for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_mobile_activationRefId")){ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].uninstalledTime).to.be.a("number"); + + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].uninstalledTime).to.eq(parseInt(insomnia.environment.get("epoch"))); + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].deviceLastSeenTime).to.eq(parseInt(insomnia.environment.get("epoch"))); + + + } + } +}); + +insomnia.test("deviceActivationFirstSeenTime should match before and after patch", function () { + insomnia.expect(insomnia.environment.get("tn_mobile_after_uninstalled_firstSeen_25")).to.eq(insomnia.environment.get("tn_mobile_deviceActivationFirstSeenTime")) +});", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "after mobile uninstallation include=uninstalled", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{tn_userRefId}}", + }, + { + "disabled": false, + "name": "include", + "value": "uninstalled", + }, + ], + "parentId": "__GRP_7__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_35__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("Response should include activationRefId", function () { + const responseData = insomnia.response.json(); + insomnia.expect(responseData.data.activationRefId).to.eq(insomnia.environment.get("tn_mobile_activationRefId"), "activationRefId"); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "uninstalled": true, + "deviceRefId": "{{tn_mobile_deviceRefId}}", + "subRefId": "{{tn_subRefId}}" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PATCH", + "name": "uninstall mobile device - without lastSeenTime & uninstallTime", + "parameters": [], + "parentId": "__GRP_7__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations/{{_['tn_mobile_activationRefId']}}", + }, + { + "_id": "__REQ_36__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +var jsonResData = insomnia.response.json(); + +insomnia.test("wps device should be returned in response since mobile is removed",function(){ + var counter = 0 + for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_pc_activationRefId")){ + counter++ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("PC"); + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].activationStatus).to.eq("ACTIVATED"); + insomnia.environment.set("tn_pc_after_uninstall_firstSeen_25", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_pc_after_uninstall_lastSeen_25", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + } + insomnia.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, "Only PC device should be returned"); + +})", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "after mobile uninstallation", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{tn_userRefId}}", + }, + ], + "parentId": "__GRP_7__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_37__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("Response should include activationRefId", function () { + const responseData = insomnia.response.json(); + insomnia.expect(responseData.data.activationRefId).to.eq(insomnia.environment.get("tn_mobile_activationRefId"), "activationRefId"); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "uninstalled": true, + "deviceRefId": "{{tn_mobile_deviceRefId}}", + "lastSeenTime": {{epochAfter72}}, + "uninstallTime": {{epoch}}, + "subRefId": "{{tn_subRefId}}" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PATCH", + "name": "unistall mobile device - future lastSeen", + "parameters": [], + "parentId": "__GRP_7__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations/{{_['tn_mobile_activationRefId']}}", + }, + { + "_id": "__REQ_38__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("Response should include activationRefId", function () { + const responseData = insomnia.response.json(); + insomnia.expect(responseData.data.activationRefId).to.eq(insomnia.environment.get("tn_mobile_activationRefId"), "activationRefId"); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "uninstalled": true, + "deviceRefId": "{{tn_mobile_deviceRefId}}", + "lastSeenTime": {{epoch}}, + "uninstallTime": {{epochAfter72}}, + "subRefId": "{{tn_subRefId}}" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PATCH", + "name": "unistall mobile device - future uninstallTime", + "parameters": [], + "parentId": "__GRP_7__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations/{{_['tn_mobile_activationRefId']}}", + }, + { + "_id": "__REQ_39__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +var jsonResData = insomnia.response.json(); + +insomnia.test("wps device should be returned in response since mobile is removed",function(){ + var counter = 0 + for (var i=0; i < jsonResData.data[0].users[0].deviceActivations.length; i++){ + if (jsonResData.data[0].users[0].deviceActivations[i].activationRefId == insomnia.environment.get("tn_pc_activationRefId")){ + counter++ + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].type).to.eq("PC"); + insomnia.expect(jsonResData.data[0].users[0].deviceActivations[i].activationStatus).to.eq("ACTIVATED"); + insomnia.environment.set("tn_pc_after_uninstall_firstSeen_25", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationFirstSeenTime); + insomnia.environment.set("tn_pc_after_uninstall_lastSeen_25", jsonResData.data[0].users[0].deviceActivations[i].deviceActivationLastSeenTime); + } + } + insomnia.expect(jsonResData.data[0].users[0].deviceActivations.length).to.eq(counter, "Only PC device should be returned"); + +})", + "authentication": {}, + "body": {}, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + ], + "method": "GET", + "name": "after mobile uninstallation", + "parameters": [ + { + "disabled": false, + "name": "userRefId", + "value": "{{tn_userRefId}}", + }, + ], + "parentId": "__GRP_7__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations", + }, + { + "_id": "__REQ_40__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.expect(insomnia.response.code).to.eq(200); +}); + +insomnia.test("Response should include activationRefId", function () { + const responseData = insomnia.response.json(); + insomnia.expect(responseData.data.activationRefId).to.eq(insomnia.environment.get("tn_mobile_activationRefId"), "activationRefId"); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "uninstalled": true, + "deviceRefId": "{{tn_mobile_deviceRefId}}", + "lastSeenTime": {{epochAfter72}}, + "uninstallTime": {{epochAfter72}}, + "subRefId": "{{tn_subRefId}}" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PATCH", + "name": "unistall mobile device - future uninstallTime and lastSeen", + "parameters": [], + "parentId": "__GRP_7__", + "preRequestScript": "", + "url": "{{_['device-orch']}}/v2/device-activations/{{_['tn_mobile_activationRefId']}}", + }, + { + "_id": "__REQ_41__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 400", function () { + insomnia.expect(insomnia.response.code).to.eq(400); +}); + +insomnia.test("BAD_REQUEST", function () { + const responseData = insomnia.response.json(); + insomnia.expect(responseData.errors[0].reason).to.eq("deviceRefId is mandatory when uninstalled is true"); +});", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "uninstalled": true, + "lastSeenTime": {{epoch}}, + "uninstallTime": {{epoch}}, + "subRefId": "{{tn_subRefId}}" +}", + }, + "description": "", + "headers": [ + { + "name": "Authorization", + "value": "{{pse_auth_token}}", + }, + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PATCH", + "name": "unistall mobile device - deviceRefId missing", + "parameters": [], + "parentId": "__GRP_7__", + "preRequestScript": "var epoch = (new Date).getTime(); +postman.setEnvironmentVariable("epoch", epoch); +var epochAfter72 = epoch + (72*60*60*1000) +postman.setEnvironmentVariable("epochAfter72", epochAfter72) + +var epochPrev72 = epoch - (72*60*60*1000) +postman.setEnvironmentVariable("epochPrev72", epochPrev72) + +", + "url": "{{_['device-orch']}}/v2/device-activations/{{_['tn_mobile_activationRefId']}}", + }, + { + "_id": "__WORKSPACE_ID__", + "_type": "workspace", + "name": "REST API basics: CRUD, test & variable", + "parentId": null, + "scope": "collection", + }, + { + "_id": "__GRP_1__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "# 🚀 Get started here + +This template guides you through CRUD operations (GET, POST, PUT, DELETE), variables, and tests. + +## 🔖 **How to use this template** + +#### **Step 1: Send requests** + +RESTful APIs allow you to perform CRUD operations using the POST, GET, PUT, and DELETE HTTP methods. + +This collection contains each of these [request](https://learning.postman.com/docs/sending-requests/requests/) types. Open each request and click "Send" to see what happens. + +#### **Step 2: View responses** + +Observe the response tab for status code (200 OK), response time, and size. + +#### **Step 3: Send new Body data** + +Update or add new data in "Body" in the POST request. Typically, Body data is also used in PUT request. + +\`\`\` +{ + "name": "Add your name in the body" +} + + \`\`\` + +#### **Step 4: Update the variable** + +Variables enable you to store and reuse values in Postman. We have created a [variable](https://learning.postman.com/docs/sending-requests/variables/) called \`base_url\` with the sample request [https://postman-api-learner.glitch.me](https://postman-api-learner.glitch.me). Replace it with your API endpoint to customize this collection. + +#### **Step 5: Add tests in the "Scripts" tab** + +Adding tests to your requests can help you confirm that your API is working as expected. You can write test scripts in JavaScript and view the output in the "Test Results" tab. + + + +## 💪 Pro tips + +- Use folders to group related requests and organize the collection. + +- Add more [scripts](https://learning.postman.com/docs/writing-scripts/intro-to-scripts/) to verify if the API works as expected and execute workflows. + + +## 💡Related templates + +[API testing basics](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=e9a37a28-055b-49cd-8c7e-97494a21eb54&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719) +[API documentation](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=e9c28f47-1253-44af-a2f3-20dce4da1f18&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719) +[Authorization methods](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=31a9a6ed-4cdf-4ced-984c-d12c9aec1c27&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719)", + "environment": { + "base_url": "https://postman-rest-api-learner.glitch.me/", + "id": "1", + }, + "name": "REST API basics: CRUD, test & variable", + "parentId": "__WORKSPACE_ID__", + "preRequestScript": "", + "variable": { + "base_url": "https://postman-rest-api-learner.glitch.me/", + "id": "1", + }, + }, + { + "_id": "__REQ_1__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.response.to.have.status(200); +});", + "authentication": {}, + "body": {}, + "description": "This is a GET request and it is used to "get" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have \`id=1\`). + +A successful GET response will have a \`200 OK\` status, and should include some kind of response body - for example, HTML web content or JSON data.", + "headers": [], + "method": "GET", + "name": "Get data", + "parameters": [ + { + "disabled": false, + "name": "id", + "value": "1", + }, + ], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__REQ_2__", + "_type": "request", + "afterResponseScript": "insomnia.test("Successful POST request", function () { + insomnia.expect(insomnia.response.code).to.be.oneOf([200, 201]); +}); +", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "name": "Add your name in the body" +}", + }, + "description": "This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response. + +A successful POST request typically returns a \`200 OK\` or \`201 Created\` response code.", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "Post data", + "parameters": [], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__REQ_3__", + "_type": "request", + "afterResponseScript": "insomnia.test("Successful PUT request", function () { + insomnia.expect(insomnia.response.code).to.be.oneOf([200, 201, 204]); +}); +", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "name": "Add your name in the body" +}", + }, + "description": "This is a PUT request and it is used to overwrite an existing piece of data. For instance, after you create an entity with a POST request, you may want to modify that later. You can do that using a PUT request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`). + +A successful PUT request typically returns a \`200 OK\`, \`201 Created\`, or \`204 No Content\` response code.", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PUT", + "name": "Update data", + "parameters": [ + { + "disabled": false, + "name": "id", + "value": "1", + }, + ], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__REQ_4__", + "_type": "request", + "afterResponseScript": "insomnia.test("Successful DELETE request", function () { + insomnia.expect(insomnia.response.code).to.be.oneOf([200, 202, 204]); +}); +", + "authentication": {}, + "body": {}, + "description": "This is a DELETE request, and it is used to delete data that was previously created via a POST request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`). + +A successful DELETE request typically returns a \`200 OK\`, \`202 Accepted\`, or \`204 No Content\` response code.", + "headers": [], + "method": "DELETE", + "name": "Delete data", + "parameters": [ + { + "disabled": false, + "name": "id", + "value": "1", + }, + ], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__WORKSPACE_ID__", + "_type": "workspace", + "name": "GetSubscriberIdAPI", + "parentId": null, + "scope": "collection", + }, + { + "_id": "__GRP_1__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": { + "disabled": false, + "password": "haha", + "type": "basic", + "username": "yaowei", + }, + "description": "", + "environment": { + "asd": "qwer", + "asfd": "qtrsda", + }, + "name": "GetSubscriberIdAPI", + "parentId": "__WORKSPACE_ID__", + "preRequestScript": "", + "variable": { + "asd": "qwer", + "asfd": "qtrsda", + }, + }, + { + "_id": "__GRP_2__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": { + "disabled": false, + "password": "weqew", + "type": "basic", + "username": "adsfasdf", + }, + "description": "", + "environment": {}, + "name": "Setup", + "parentId": "__GRP_1__", + "preRequestScript": "", + }, + { + "_id": "__REQ_1__", + "_type": "request", + "afterResponseScript": "try +{ + if (insomnia.response.code === 200) + { + let response = insomnia.response.json(); + + insomnia.test("Response code is 200", function(){ + insomnia.response.to.have.status(200); + }); + + var token = response.access_token; + insomnia.globals.set("BearerToken", "Bearer " + token); + insomnia.environment.set("BearerToken", "Bearer " + token); + } + else + { + insomnia.test("Response code is not 200", function(){ + insomnia.response.to.have.status(200); + }); + } +} +catch (error) +{ + tests["Tests script failed due to exception; " + "Error Message - " + error] = (true === false); +}", + "authentication": { + "disabled": false, + "password": "pass", + "type": "basic", + "username": "yaowei", + }, + "body": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "disabled": false, + "name": "grant_type", + "value": "password", + }, + { + "disabled": false, + "name": "username", + "value": "{{_['Auth-Name']}}", + }, + { + "disabled": false, + "name": "password", + "value": "{{_['Auth-Value']}}", + }, + ], + }, + "description": "", + "headers": [ + { + "name": "content-type", + "value": "application/x-www-form-urlencoded", + }, + { + "name": "Authorization", + "value": "Basic {{_['Auth-Header']}}", + }, + ], + "method": "POST", + "name": "BearerToken", + "parameters": [ + { + "disabled": false, + "name": "param1", + "value": "paramVal1", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "{{AuthUri}}", + }, + { + "_id": "__WORKSPACE_ID__", + "_type": "workspace", + "name": "RESTful API Basics #blueprint", + "parentId": null, + "scope": "collection", + }, + { + "_id": "__GRP_1__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "# 🚀 Get started here + +This collection guides you through CRUD operations (GET, POST, PUT, DELETE), variables, and tests. + +## 🔖 **How to use this collection** + +#### **Step 1: Send requests** + +RESTful APIs allow you to perform CRUD operations using the POST, GET, PUT, and DELETE HTTP methods. + +This collection contains each of these request types. Open each request and click "Send" to see what happens. + +#### **Step 2: View responses** + +Observe the response tab for status code (200 OK), response time, and size. + +#### **Step 3: Send new Body data** + +Update or add new data in "Body" in the POST request. Typically, Body data is also used in PUT and PATCH requests. + +\`\`\` +{ + "name": "Add your name in the body" +} + +\`\`\` + +#### **Step 4: Update the variable** + +Variables enable you to store and reuse values in Postman. We have created a variable called \`base_url\` with the sample request [https://postman-api-learner.glitch.me](https://postman-api-learner.glitch.me). Replace it with your API endpoint to customize this collection. + +#### **Step 5: Add tests in the "Tests" tab** + +Tests help you confirm that your API is working as expected. You can write test scripts in JavaScript and view the output in the "Test Results" tab. + + + +## 💪 Pro tips + +- Use folders to group related requests and organize the collection. +- Add more scripts in "Tests" to verify if the API works as expected and execute flows. + + +## ℹ️ Resources + +[Building requests](https://learning.postman.com/docs/sending-requests/requests/) +[Authorizing requests](https://learning.postman.com/docs/sending-requests/authorization/) +[Using variables](https://learning.postman.com/docs/sending-requests/variables/) +[Managing environments](https://learning.postman.com/docs/sending-requests/managing-environments/) +[Writing scripts](https://learning.postman.com/docs/writing-scripts/intro-to-scripts/)", + "environment": { + "base_url": "https://postman-rest-api-learner.glitch.me/", + "id": "1", + }, + "name": "RESTful API Basics #blueprint", + "parentId": "__WORKSPACE_ID__", + "preRequestScript": "", + "variable": { + "base_url": "https://postman-rest-api-learner.glitch.me/", + "id": "1", + }, + }, + { + "_id": "__REQ_1__", + "_type": "request", + "afterResponseScript": "insomnia.test("Status code is 200", function () { + insomnia.response.to.have.status(200); +});", + "authentication": {}, + "body": {}, + "description": "This is a GET request and it is used to "get" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have \`id=1\`). + +A successful GET response will have a \`200 OK\` status, and should include some kind of response body - for example, HTML web content or JSON data.", + "headers": [], + "method": "GET", + "name": "Get data", + "parameters": [ + { + "disabled": false, + "name": "id", + "value": "1", + }, + ], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__REQ_2__", + "_type": "request", + "afterResponseScript": "insomnia.test("Successful POST request", function () { + insomnia.expect(insomnia.response.code).to.be.oneOf([200, 201]); +}); +", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "name": "Add your name in the body" +}", + }, + "description": "This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response. + +A successful POST request typically returns a \`200 OK\` or \`201 Created\` response code.", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "Post data", + "parameters": [], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__REQ_3__", + "_type": "request", + "afterResponseScript": "insomnia.test("Successful PUT request", function () { + insomnia.expect(insomnia.response.code).to.be.oneOf([200, 201, 204]); +}); +", + "authentication": {}, + "body": { + "mimeType": "application/json", + "text": "{ + "name": "Add your name in the body" +}", + }, + "description": "This is a PUT request and it is used to overwrite an existing piece of data. For instance, after you create an entity with a POST request, you may want to modify that later. You can do that using a PUT request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`). + +A successful PUT request typically returns a \`200 OK\`, \`201 Created\`, or \`204 No Content\` response code.", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PUT", + "name": "Update data", + "parameters": [ + { + "disabled": false, + "name": "id", + "value": "1", + }, + ], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__REQ_4__", + "_type": "request", + "afterResponseScript": "insomnia.test("Successful DELETE request", function () { + insomnia.expect(insomnia.response.code).to.be.oneOf([200, 202, 204]); +}); +", + "authentication": {}, + "body": {}, + "description": "This is a DELETE request, and it is used to delete data that was previously created via a POST request. You typically identify the entity being updated by including an identifier in the URL (eg. \`id=1\`). + +A successful DELETE request typically returns a \`200 OK\`, \`202 Accepted\`, or \`204 No Content\` response code.", + "headers": [], + "method": "DELETE", + "name": "Delete data", + "parameters": [ + { + "disabled": false, + "name": "id", + "value": "1", + }, + ], + "parentId": "__GRP_1__", + "preRequestScript": "", + "url": "{{base_url}}/info", + }, + { + "_id": "__WORKSPACE_ID__", + "_type": "workspace", + "name": "API Documentation #reference", + "parentId": null, + "scope": "collection", + }, + { + "_id": "__GRP_1__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": { + "addTo": "header", + "disabled": false, + "key": "X-API-Key", + "type": "apikey", + "value": "{{token}}", + }, + "description": "This template contains a boilerplate for documentation that you can quickly customize and reuse. + +### How to use this template: + +- Replace the content given brackets (()) with your API's details. +- Tips are formatted in \`codespan\` - feel free to read and remove them. + + +--- + +\`Start with a brief overview of what your API offers.\` + +The ((product name)) provides many API products, tools, and resources that enable you to ((add product value here)). + +\`You can also list the APIs you offer, link to the relevant pages, or do both in this section.\` + +## **Getting started guide** + +\`List the steps or points required to start using your APIs. Make sure to cover everything required to reach success with your API as quickly as possible.\` + +To start using the ((add APIs here)), you need to - + +\`The points given below are from The Postman API's documentation. You can reference it to write your own getting started guide.\` + +- You must use a valid API Key to send requests to the API endpoints. You can get your API key from Postman's [integrations dashboard](https://go.postman.co/settings/me/api-keys). +- The API has [rate and usage limits](https://learning.postman.com/docs/developer/postman-api/postman-api-rate-limits/). +- The API only responds to HTTPS-secured communications. Any requests sent via HTTP return an HTTP 301 redirect to the corresponding HTTPS resources. +- The API returns request responses in JSON format. When an API request returns an error, it is sent in the JSON response as an error key. + + +## Authentication + +\`Add details on the authorization keys/tokens required, steps that cover how to get them, and the relevant error codes.\` + +The ((product name)) API uses ((add your API's authorization type)) for authentication. + +\`The details given below are from the Postman API's documentation. You can reference it to write your own authentication section.\` + +Postman uses API keys for authentication. You can generate a Postman API key in the [API keys](https://postman.postman.co/settings/me/api-keys) section of your Postman account settings. + +You must include an API key in each request to the Postman API with the X-Api-Key request header. + +### Authentication error response + +If an API key is missing, malformed, or invalid, you will receive an HTTP 401 Unauthorized response code. + +## Rate and usage limits + +\`Use this section to cover your APIs' terms of use. Include API limits, constraints, and relevant error codes, so consumers understand the permitted API usage and practices.\` + +\`The example given below is from The Postman API's documentation. Use it as a reference to write your APIs' terms of use.\` + +API access rate limits apply at a per-API key basis in unit time. The limit is 300 requests per minute. Also, depending on your plan, you may have usage limits. If you exceed either limit, your request will return an HTTP 429 Too Many Requests status code. + +Each API response returns the following set of headers to help you identify your use status: + +| Header | Description | +| --- | --- | +| \`X-RateLimit-Limit\` | The maximum number of requests that the consumer is permitted to make per minute. | +| \`X-RateLimit-Remaining\` | The number of requests remaining in the current rate limit window. | +| \`X-RateLimit-Reset\` | The time at which the current rate limit window resets in UTC epoch seconds. | + +### 503 response + +An HTTP \`503\` response from our servers indicates there is an unexpected spike in API access traffic. The server is usually operational within the next five minutes. If the outage persists or you receive any other form of an HTTP \`5XX\` error, [contact support](https://support.postman.com/hc/en-us/requests/new/). + +### **Need some help?** + +\`Add links that customers can refer to whenever they need help.\` + +In case you have questions, go through our tutorials ((link to your video or help documentation here)). Or visit our FAQ page ((link to the relevant page)). + +Or you can check out our community forum, there’s a good chance our community has an answer for you. Visit our developer forum ((link to developer forum)) to review topics, ask questions, and learn from others. + +\`You can also document or add links to libraries, code examples, and other resources needed to make a request.\`", + "environment": { + "baseUrl": "https://farming-simulator.pstmn.io", + }, + "name": "API Documentation #reference", + "parentId": "__WORKSPACE_ID__", + "preRequestScript": "", + "variable": { + "baseUrl": "https://farming-simulator.pstmn.io", + }, + }, + { + "_id": "__GRP_2__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "The \`/me\` endpoints let you manage information about the authenticated user.", + "environment": {}, + "name": "User", + "parentId": "__GRP_1__", + "preRequestScript": "", + }, + { + "_id": "__REQ_1__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": {}, + "description": "Gets information about the authenticated user.", + "headers": [], + "method": "GET", + "name": "Get authenticated user", + "parameters": [ + { + "disabled": false, + "name": "foo", + "value": "bar", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "https://api.getpostman.com/me", + }, + { + "_id": "__GRP_3__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "The \`/collections\` endpoints let you manage your [collections](https://learning.postman.com/docs/sending-requests/intro-to-collections/).", + "environment": {}, + "name": "Collections", + "parentId": "__GRP_1__", + "preRequestScript": "", + }, + { + "_id": "__REQ_2__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": { + "mimeType": "text/plain", + "text": "{ + "collection": { + "info": { + "name": "{{collectionName}}", + "schema": "{{collectionSchemaUrl}}" + }, + "item": [ + { + "request": {} + } + ] + } +}", + }, + "description": "Creates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html). Include a \`collection\` object in the request body that contains the following required properties: + +* \`info\` — An **object** that contains the following properties: + * \`name\` — A **string** value that contains the collection's name. + * \`schema\` — A **string** that contains a URL to the collection's schema. For example, the \`https://schema.getpostman.com/collection/v1\` URL. +* \`item\` — An **object** that contains the HTTP request and response information. + * \`request\` — An **object** that contains the collection's request information. For a complete list of values, refer to the \`definitions.request\` entry in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json). If you pass an empty object for this value, the system defaults to an untitled GET request. + +**Note:** + +* For a complete list of available property values for this endpoint, use the following references available in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json): + * \`info\` object — Use the \`definitions.info\` entry. + * \`item\` object — Use the \`definitions.items\` entry. +* For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json).", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "Create a collection", + "parameters": [ + { + "disabled": true, + "name": "workspace", + "value": "{{workspaceId}}", + }, + ], + "parentId": "__GRP_3__", + "preRequestScript": "", + "url": "https://api.getpostman.com/collections", + }, + { + "_id": "__REQ_3__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": {}, + "description": "Gets information about a collection. For a complete list of this endpoint's possible values, use the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json).", + "headers": [], + "method": "GET", + "name": "Get a collection", + "parameters": [ + { + "disabled": true, + "name": "access_key", + "value": "{{accessKey}}", + }, + ], + "parentId": "__GRP_3__", + "preRequestScript": "", + "url": "https://api.getpostman.com/collections/{{collectionId}}", + }, + { + "_id": "__REQ_4__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": {}, + "description": "Deletes a collection.", + "headers": [], + "method": "DELETE", + "name": "Delete a collection", + "parameters": [], + "parentId": "__GRP_3__", + "preRequestScript": "", + "url": "https://api.getpostman.com/collections/{{collectionId}}", + }, + { + "_id": "__REQ_5__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": { + "mimeType": "text/plain", + "text": "{ + "collection": { + "info": { + "name": "{{collectionName}}", + "schema": "{{collectionSchemaUrl}}" + }, + "item": [ + { + "request": {} + } + ] + } +}", + }, + "description": "Updates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html). Include a \`collection\` object in the request body that contains the following required properties: + +- \`info\` — An **object** that contains the following properties: + - \`name\` — A **string** value that contains the collection's name. + - \`schema\` — A **string** that contains a URL to the collection's schema. For example, the \`https://schema.getpostman.com/collection/v1\` URL. +- \`item\` — An **object** that contains the HTTP request and response information. + - \`request\` — An **object** that contains the collection's request information. For a complete list of values, refer to the \`definitions.request\` entry in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json). If you pass an empty object for this value, the system defaults to an untitled GET request. + +**Note:** + +- For a complete list of available property values for this endpoint, use the following references available in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json): + - \`info\` object — Use the \`definitions.info\` entry. + - \`item\` object — Use the \`definitions.items\` entry. +- For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json). + + +### Important + +Use caution when using this endpoint. The system will replace the existing collection with the values passed in the request body.", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PUT", + "name": "Update a collection", + "parameters": [], + "parentId": "__GRP_3__", + "preRequestScript": "", + "url": "https://api.getpostman.com/collections/{{collectionId}}", + }, + { + "_id": "__REQ_6__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": {}, + "description": "Gets all of your [collections](https://www.getpostman.com/docs/collections). The response includes all of your subscribed collections.", + "headers": [], + "method": "GET", + "name": "Get all collections", + "parameters": [ + { + "disabled": true, + "name": "workspace", + "value": "{{workspaceId}}", + }, + ], + "parentId": "__GRP_3__", + "preRequestScript": "", + "url": "https://api.getpostman.com/collections", + }, + { + "_id": "__WORKSPACE_ID__", + "_type": "workspace", + "name": "API Documentation #reference", + "parentId": null, + "scope": "collection", + }, + { + "_id": "__GRP_1__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": { + "addTo": "header", + "disabled": false, + "key": "X-API-Key", + "type": "apikey", + "value": "{{token}}", + }, + "description": "This template contains a boilerplate for documentation that you can quickly customize and reuse. + +### How to use this template: + +- Replace the content given brackets (()) with your API's details. +- Tips are formatted in \`codespan\` - feel free to read and remove them. + + +--- + +\`Start with a brief overview of what your API offers.\` + +The ((product name)) provides many API products, tools, and resources that enable you to ((add product value here)). + +\`You can also list the APIs you offer, link to the relevant pages, or do both in this section.\` + +## **Getting started guide** + +\`List the steps or points required to start using your APIs. Make sure to cover everything required to reach success with your API as quickly as possible.\` + +To start using the ((add APIs here)), you need to - + +\`The points given below are from The Postman API's documentation. You can reference it to write your own getting started guide.\` + +- You must use a valid API Key to send requests to the API endpoints. You can get your API key from Postman's [integrations dashboard](https://go.postman.co/settings/me/api-keys). +- The API has [rate and usage limits](https://learning.postman.com/docs/developer/postman-api/postman-api-rate-limits/). +- The API only responds to HTTPS-secured communications. Any requests sent via HTTP return an HTTP 301 redirect to the corresponding HTTPS resources. +- The API returns request responses in JSON format. When an API request returns an error, it is sent in the JSON response as an error key. + + +## Authentication + +\`Add details on the authorization keys/tokens required, steps that cover how to get them, and the relevant error codes.\` + +The ((product name)) API uses ((add your API's authorization type)) for authentication. + +\`The details given below are from the Postman API's documentation. You can reference it to write your own authentication section.\` + +Postman uses API keys for authentication. You can generate a Postman API key in the [API keys](https://postman.postman.co/settings/me/api-keys) section of your Postman account settings. + +You must include an API key in each request to the Postman API with the X-Api-Key request header. + +### Authentication error response + +If an API key is missing, malformed, or invalid, you will receive an HTTP 401 Unauthorized response code. + +## Rate and usage limits + +\`Use this section to cover your APIs' terms of use. Include API limits, constraints, and relevant error codes, so consumers understand the permitted API usage and practices.\` + +\`The example given below is from The Postman API's documentation. Use it as a reference to write your APIs' terms of use.\` + +API access rate limits apply at a per-API key basis in unit time. The limit is 300 requests per minute. Also, depending on your plan, you may have usage limits. If you exceed either limit, your request will return an HTTP 429 Too Many Requests status code. + +Each API response returns the following set of headers to help you identify your use status: + +| Header | Description | +| --- | --- | +| \`X-RateLimit-Limit\` | The maximum number of requests that the consumer is permitted to make per minute. | +| \`X-RateLimit-Remaining\` | The number of requests remaining in the current rate limit window. | +| \`X-RateLimit-Reset\` | The time at which the current rate limit window resets in UTC epoch seconds. | + +### 503 response + +An HTTP \`503\` response from our servers indicates there is an unexpected spike in API access traffic. The server is usually operational within the next five minutes. If the outage persists or you receive any other form of an HTTP \`5XX\` error, [contact support](https://support.postman.com/hc/en-us/requests/new/). + +### **Need some help?** + +\`Add links that customers can refer to whenever they need help.\` + +In case you have questions, go through our tutorials ((link to your video or help documentation here)). Or visit our FAQ page ((link to the relevant page)). + +Or you can check out our community forum, there’s a good chance our community has an answer for you. Visit our developer forum ((link to developer forum)) to review topics, ask questions, and learn from others. + +\`You can also document or add links to libraries, code examples, and other resources needed to make a request.\`", + "environment": { + "baseUrl": "https://farming-simulator.pstmn.io", + "haha": "", + }, + "name": "API Documentation #reference", + "parentId": "__WORKSPACE_ID__", + "preRequestScript": "", + "variable": { + "baseUrl": "https://farming-simulator.pstmn.io", + "haha": "", + }, + }, + { + "_id": "__GRP_2__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "The \`/me\` endpoints let you manage information about the authenticated user.", + "environment": {}, + "name": "User", + "parentId": "__GRP_1__", + "preRequestScript": "", + }, + { + "_id": "__REQ_1__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": {}, + "description": "Gets information about the authenticated user.", + "headers": [], + "method": "GET", + "name": "Get authenticated user", + "parameters": [ + { + "disabled": false, + "name": "foo", + "value": "bar", + }, + ], + "parentId": "__GRP_2__", + "preRequestScript": "", + "url": "https://api.getpostman.com/me", + }, + { + "_id": "__GRP_3__", + "_type": "request_group", + "afterResponseScript": "", + "authentication": {}, + "description": "The \`/collections\` endpoints let you manage your [collections](https://learning.postman.com/docs/sending-requests/intro-to-collections/).", + "environment": {}, + "name": "Collections", + "parentId": "__GRP_1__", + "preRequestScript": "", + }, + { + "_id": "__REQ_2__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": { + "mimeType": "text/plain", + "text": "{ + "collection": { + "info": { + "name": "{{collectionName}}", + "schema": "{{collectionSchemaUrl}}" + }, + "item": [ + { + "request": {} + } + ] + } +}", + }, + "description": "Creates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html). Include a \`collection\` object in the request body that contains the following required properties: + +* \`info\` — An **object** that contains the following properties: + * \`name\` — A **string** value that contains the collection's name. + * \`schema\` — A **string** that contains a URL to the collection's schema. For example, the \`https://schema.getpostman.com/collection/v1\` URL. +* \`item\` — An **object** that contains the HTTP request and response information. + * \`request\` — An **object** that contains the collection's request information. For a complete list of values, refer to the \`definitions.request\` entry in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json). If you pass an empty object for this value, the system defaults to an untitled GET request. + +**Note:** + +* For a complete list of available property values for this endpoint, use the following references available in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json): + * \`info\` object — Use the \`definitions.info\` entry. + * \`item\` object — Use the \`definitions.items\` entry. +* For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json).", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "POST", + "name": "Create a collection", + "parameters": [ + { + "disabled": true, + "name": "workspace", + "value": "{{workspaceId}}", + }, + ], + "parentId": "__GRP_3__", + "preRequestScript": "", + "url": "https://api.getpostman.com/collections", + }, + { + "_id": "__REQ_3__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": {}, + "description": "Gets information about a collection. For a complete list of this endpoint's possible values, use the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json).", + "headers": [], + "method": "GET", + "name": "Get a collection", + "parameters": [ + { + "disabled": true, + "name": "access_key", + "value": "{{accessKey}}", + }, + ], + "parentId": "__GRP_3__", + "preRequestScript": "", + "url": "https://api.getpostman.com/collections/{{collectionId}}", + }, + { + "_id": "__REQ_4__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": {}, + "description": "Deletes a collection.", + "headers": [], + "method": "DELETE", + "name": "Delete a collection", + "parameters": [], + "parentId": "__GRP_3__", + "preRequestScript": "", + "url": "https://api.getpostman.com/collections/{{collectionId}}", + }, + { + "_id": "__REQ_5__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": { + "mimeType": "text/plain", + "text": "{ + "collection": { + "info": { + "name": "{{collectionName}}", + "schema": "{{collectionSchemaUrl}}" + }, + "item": [ + { + "request": {} + } + ] + } +}", + }, + "description": "Updates a collection using the [Postman Collection v2 schema format](https://schema.postman.com/json/collection/v2.1.0/docs/index.html). Include a \`collection\` object in the request body that contains the following required properties: + +- \`info\` — An **object** that contains the following properties: + - \`name\` — A **string** value that contains the collection's name. + - \`schema\` — A **string** that contains a URL to the collection's schema. For example, the \`https://schema.getpostman.com/collection/v1\` URL. +- \`item\` — An **object** that contains the HTTP request and response information. + - \`request\` — An **object** that contains the collection's request information. For a complete list of values, refer to the \`definitions.request\` entry in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json). If you pass an empty object for this value, the system defaults to an untitled GET request. + +**Note:** + +- For a complete list of available property values for this endpoint, use the following references available in the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json): + - \`info\` object — Use the \`definitions.info\` entry. + - \`item\` object — Use the \`definitions.items\` entry. +- For all other possible values, refer to the [collection.json schema file](https://schema.postman.com/json/collection/v2.1.0/collection.json). + + +### Important + +Use caution when using this endpoint. The system will replace the existing collection with the values passed in the request body.", + "headers": [ + { + "name": "Content-Type", + "value": "application/json", + }, + ], + "method": "PUT", + "name": "Update a collection", + "parameters": [], + "parentId": "__GRP_3__", + "preRequestScript": "", + "url": "https://api.getpostman.com/collections/{{collectionId}}", + }, + { + "_id": "__REQ_6__", + "_type": "request", + "afterResponseScript": "", + "authentication": {}, + "body": {}, + "description": "Gets all of your [collections](https://www.getpostman.com/docs/collections). The response includes all of your subscribed collections.", + "headers": [], + "method": "GET", + "name": "Get all collections", + "parameters": [ + { + "disabled": true, + "name": "workspace", + "value": "{{workspaceId}}", + }, + ], + "parentId": "__GRP_3__", + "preRequestScript": "", + "url": "https://api.getpostman.com/collections", + }, + { + "_id": "__ENV_1__", + "_type": "environment", + "data": { + "accessKey": "agfd", + "collectionId": "", + "collectionName": "asdf", + "collectionSchemaUrl": "", + "token": "qwer", + "workspaceId": "we", + }, + "name": "Project2Env1", + "parentId": "__BASE_ENVIRONMENT_ID__", + }, + { + "_id": "__ENV_1__", + "_type": "environment", + "data": { + "haha": "", + }, + "name": "GlobalSubEnv2", + "parentId": "__BASE_ENVIRONMENT_ID__", + }, + { + "_id": "__ENV_1__", + "_type": "environment", + "data": { + "accessKey": "asdf", + "collectionId": "wer", + "collectionName": "wqeasd", + "collectionSchemaUrl": "", + "token": "", + "workspaceId": "", + }, + "name": "Project2Env2", + "parentId": "__BASE_ENVIRONMENT_ID__", + }, + { + "_id": "__ENV_1__", + "_type": "environment", + "data": { + "lala": "sadfasd", + }, + "name": "GlobalSubEnv3", + "parentId": "__BASE_ENVIRONMENT_ID__", + }, + { + "_id": "__ENV_1__", + "_type": "environment", + "data": { + "collectionId": "afd", + "collectionName": "asdf", + "collectionSchemaUrl": "", + "token": "sfgd", + }, + "name": "GlobalSubEnv4", + "parentId": "__BASE_ENVIRONMENT_ID__", + }, + { + "_id": "__ENV_1__", + "_type": "environment", + "data": { + "accessKey": "", + "collectionId": "", + "collectionName": "", + "collectionSchemaUrl": "", + "token": "", + "workspaceId": "", + }, + "name": "GlobalSubEnv1", + "parentId": "__BASE_ENVIRONMENT_ID__", + }, + ], + }, + "type": { + "description": "Importer for Postman data dump", + "id": "postman-data-dump", + "name": "Postman Data Dump", + }, +} +`; diff --git a/packages/insomnia/src/utils/try-interpolate.ts b/packages/insomnia/src/utils/try-interpolate.ts index 8f809ce43b..2cbd31676b 100644 --- a/packages/insomnia/src/utils/try-interpolate.ts +++ b/packages/insomnia/src/utils/try-interpolate.ts @@ -2,7 +2,6 @@ import { getRenderContext, render } from '../common/render'; import type { GrpcRequest } from '../models/grpc-request'; import type { Request } from '../models/request'; import type { WebSocketRequest } from '../models/websocket-request'; -import { RenderError } from '../templating/render-error'; import { showModal } from '../ui/components/modals'; import { RequestRenderErrorModal } from '../ui/components/modals/request-render-error-modal'; @@ -12,7 +11,7 @@ export const tryToInterpolateRequestOrShowRenderErrorModal = async ({ request, e const renderContext = await getRenderContext({ request, environment: environmentId, purpose: 'send' }); return await render(payload, renderContext); } catch (error) { - if (error instanceof RenderError) { + if (error.type === 'render') { showModal(RequestRenderErrorModal, { request, error }); return; } diff --git a/packages/insomnia/vite.config.ts b/packages/insomnia/vite.config.ts index dcca885433..fc3a736dc5 100644 --- a/packages/insomnia/vite.config.ts +++ b/packages/insomnia/vite.config.ts @@ -60,7 +60,6 @@ export default defineConfig(({ mode }) => { react(), ], worker: { - format: 'es', plugins: () => [ electronNodeRequire({ modules: ['fs'],