{"info":{"_postman_id":"ffcbee81-a0f0-488e-9d4b-7544548069cd","name":"SmooveTests","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"description":"<html><head></head><body></body></html>","owner":"17099183","collectionId":"ffcbee81-a0f0-488e-9d4b-7544548069cd","publishedId":"UVeKq5VE","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"5c666f","highlight":"44c7f4"},"publishDate":"2022-02-10T10:19:40.000Z"},"item":[{"name":"ViplusRest","item":[{"name":"Account","item":[{"name":"Get contact fields","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"System fields array item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.key).to.be.a(\"string\");\r\n    pm.expect(list.label).to.be.a(\"string\");\r\n    pm.expect(list.type).to.be.a(\"string\");\r\n    pm.expect(list.options).to.be.null;\r\n    pm.expect(list.custom).to.be.false;\r\n    pm.expect(list.groupId).to.be.null;\r\n    pm.expect(list.groupName).to.be.null;\r\n    pm.expect(list.poisition).to.be.null;\r\n});\r\n\r\npm.test(\"Custom fields array item has all required properties\",function(){\r\n    let list = jsonResponse[14];\r\n    pm.expect(list.key).to.be.a(\"string\");\r\n    pm.expect(list.label).to.be.a(\"string\");\r\n    pm.expect(list.type).to.be.a(\"string\");\r\n    pm.expect(list.custom).to.be.true;\r\n    pm.expect(list.groupId).to.be.a(\"number\");\r\n    pm.expect(list.groupName).to.be.a(\"string\");\r\n    pm.expect(list.poisition).to.be.a(\"number\");\r\n});"]}}],"id":"dfba5810-ad22-4498-9802-aa8f893e27ea","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"url":"https://{{restApiUrl}}/v1/Account/ContactFields","urlObject":{"protocol":"https","path":["v1","Account","ContactFields"],"host":["{{restApiUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"dfba5810-ad22-4498-9802-aa8f893e27ea"}],"id":"e27278ec-1d03-4427-93f3-2947b49cf77e","_postman_id":"e27278ec-1d03-4427-93f3-2947b49cf77e","description":""},{"name":"AsyncContacts","item":[{"name":"Asynchronously creates or updates a Contact","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(202);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.Uuid).not.null;\r\n    pm.expect(list.Timestamp).not.null;\r\n});"]}}],"id":"5646f84c-70b0-4db6-aa3d-70857391fcf1","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"address\": \"Wellfield Road\",\r\n  \"lastName\": \"hill\",\r\n  \"company\": \"My Company\",\r\n  \"firstName\": \"jhon\",\r\n  \"position\": \"CEO\",\r\n  \"email\": \"jhon@domain.com\",\r\n  \"dateOfBirth\": \"2022-01-16T10:13:14.928476Z\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/async/contacts?updateIfExists=false&restoreIfDeleted=false&restoreIfUnsubscribed=false&overrideNullableValue=false","urlObject":{"protocol":"https","path":["v1","async","contacts"],"host":["{{restApiUrl}}"],"query":[{"key":"updateIfExists","value":"false"},{"key":"restoreIfDeleted","value":"false"},{"key":"restoreIfUnsubscribed","value":"false"},{"key":"overrideNullableValue","value":"false"}],"variable":[]}},"response":[],"_postman_id":"5646f84c-70b0-4db6-aa3d-70857391fcf1"},{"name":"Asynchronously updates a Contact","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(202);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.Uuid).not.null;\r\n    pm.expect(list.Timestamp).not.null;\r\n});"]}}],"id":"c6d71415-f4ce-4982-9608-2eb574bdac12","request":{"method":"PUT","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"address\": \"Wellfield Road\",\r\n  \"lastName\": \"hill\",\r\n  \"company\": \"My Company\",\r\n  \"firstName\": \"jhon\",\r\n  \"position\": \"CEO\",\r\n  \"email\": \"jhon@domain.com\",\r\n  \"dateOfBirth\": \"2022-01-16T12:48:12.7218981Z\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/async/contacts/roy%40smoove.io?by=Email&restoreIfDeleted=false&restoreIfUnsubscribed=false&overrideNullableValue=false","urlObject":{"protocol":"https","path":["v1","async","contacts","roy%40smoove.io"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"Email"},{"key":"restoreIfDeleted","value":"false"},{"key":"restoreIfUnsubscribed","value":"false"},{"key":"overrideNullableValue","value":"false"}],"variable":[]}},"response":[],"_postman_id":"c6d71415-f4ce-4982-9608-2eb574bdac12"},{"name":"Gets the status of a previous Asynchronous Create or Update operation","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Check Asynchronous Operation Status Response\",function(){\r\n    let payload = jsonResponse;\r\n    pm.expect(Number(payload.uuid)).to.be.a(\"number\");\r\n    pm.expect(payload.status).to.eql(\"Succeeded\");\r\n    pm.expect(payload.scheduledAt).to.be.a(\"number\");\r\n    pm.expect(payload.startedAt).to.be.a(\"number\");\r\n    pm.expect(payload.completedAt).to.be.a(\"number\");\r\n});"]}}],"id":"8be8ac5c-1e63-4aaa-98d4-b4dd1ebe720e","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"url":"https://{{restApiUrl}}/v1/async/contacts/{{restApiUUID}}/status","urlObject":{"protocol":"https","path":["v1","async","contacts","{{restApiUUID}}","status"],"host":["{{restApiUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8be8ac5c-1e63-4aaa-98d4-b4dd1ebe720e"},{"name":"Asynchronous bulk contacts import","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(202);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(typeof list.Uuid).not.null;\r\n    pm.expect(list.Uuid > 0);\r\n    pm.expect(typeof list.Timestamp).not.null;\r\n});"]}}],"id":"089fb54c-71b4-4655-960c-d967343de06f","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"contacts\": [\r\n    {\r\n  \"lastName\": \"רועי\",\r\n  \"firstName\": \"בדיקות\",\r\n  \"email\": \"roy@smoove.io\",\r\n  \"cellPhone\": \"0524748027\"\r\n}\r\n  ],\r\n  \"lists_ToSubscribe\": [\r\n    {{apiRestlists_ToSubscribe}}\r\n  ]\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/async/contacts/import?overrideNullableValue=false","urlObject":{"protocol":"https","path":["v1","async","contacts","import"],"host":["{{restApiUrl}}"],"query":[{"key":"overrideNullableValue","value":"false"}],"variable":[]}},"response":[],"_postman_id":"089fb54c-71b4-4655-960c-d967343de06f"}],"id":"b0eabd5b-14c1-4de1-b7a4-fd7f36c4313d","_postman_id":"b0eabd5b-14c1-4de1-b7a4-fd7f36c4313d","description":""},{"name":"Campaigns","item":[{"name":"Create an email campaign","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Email item has all required properties\",function(){\r\n    pm.expect(jsonResponse).to.be.an('object');\r\n    pm.expect(jsonResponse).to.have.property('trackLinks');\r\n    pm.expect(jsonResponse.trackLinks).to.be.a('boolean');\r\n\r\n    pm.expect(jsonResponse).to.have.property('customUnsubscribeMode');\r\n    pm.expect(jsonResponse.customUnsubscribeMode).to.be.a('string');\r\n\r\n    pm.expect(jsonResponse).to.have.property('subject');\r\n    pm.expect(jsonResponse.subject).to.be.a('string').and.to.have.lengthOf.at.least(1);\r\n\r\n    pm.expect(jsonResponse).to.have.property('id');\r\n    pm.expect(jsonResponse.id).to.be.a('number');\r\n    pm.expect(jsonResponse.id).to.be.at.least(0, \"'id' field should be a non-negative integer\");\r\n});\r\n\r\n\r\n"]}}],"id":"34d5c26e-8afe-4afc-92ab-d99f2bb6cada","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"trackLinks\": true,\r\n  \"body\": \"Coupon: <u><pre>%COUPON%</pre></u>\",\r\n  \"customData\": [\r\n    {\r\n      \"key\": \"%COUPON%\",\r\n      \"value\": \"ABC3\"\r\n    }\r\n  ],\r\n  \"subject\": \"[[First Name]], Just for you: %30 off Coupon\",\r\n  \"customUnsubscribeMode\": \"None\",\r\n  \"toMembersByEmail\": [\r\n    \"jhon@domain.com\"\r\n  ]\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Campaigns?sendNow=false","urlObject":{"protocol":"https","path":["v1","Campaigns"],"host":["{{restApiUrl}}"],"query":[{"key":"sendNow","value":"false"}],"variable":[]}},"response":[],"_postman_id":"34d5c26e-8afe-4afc-92ab-d99f2bb6cada"},{"name":"Send an email campaign","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Email item has all required properties\",function(){\r\n    pm.expect(jsonResponse).to.equal(\"OkSent\");    \r\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","exec":["const url = 'https://' + pm.environment.get('restApiUrl') +'/v1/Campaigns?sendNow=false';\r\n\r\nconst echoPostRequest = {\r\n  url: url,\r\n  method: 'POST',  \r\n  header: {\r\n      'Content-Type': 'application/json',\r\n      apikey: pm.environment.get(\"restApiKeyForAutomationTests\")\r\n  },\r\n  body: {\r\n    mode: 'application/json',\r\n    raw: JSON.stringify(\r\n        {\r\n           \"trackLinks\": true,\r\n            \"body\": \"Send From Postman\",\r\n            \"customData\": [\r\n    {\r\n      \"key\": \"%COUPON%\",\r\n      \"value\": \"ABC3\"\r\n    }\r\n  ],\r\n  \"subject\": \"Send From Postman\",\r\n  \"customUnsubscribeMode\": \"None\",\r\n  \"toMembersByEmail\": [\r\n    \"noreply@smoove.io\"\r\n      ]\r\n        })}\r\n};\r\n\r\npm.sendRequest(echoPostRequest, function(err, response){\r\n    if(err || response.code != 200)\r\n        console.error(err);\r\n    else{\r\n        var responseJson = response.json();\r\n        pm.environment.set(\"restApiSendAnEmailCampaign\", responseJson.id);\r\n    }\r\n});"]}}],"id":"ffb447e3-c5d2-4588-acf5-343b5d21c74f","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Campaigns/{{restApiSendAnEmailCampaign}}/Send?by=CampaignId","urlObject":{"protocol":"https","path":["v1","Campaigns","{{restApiSendAnEmailCampaign}}","Send"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"CampaignId"}],"variable":[]}},"response":[],"_postman_id":"ffb447e3-c5d2-4588-acf5-343b5d21c74f"},{"name":"Get an email campaign's aggregated report","event":[{"listen":"test","script":{"type":"text/javascript","exec":["\r\nlet jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.abused).to.not.undefined;\r\n    pm.expect(list.abused).to.eql(0);\r\n    pm.expect(list.bounced).to.eql(0);\r\n    pm.expect(list.clicked).to.eql(0);\r\n    pm.expect(list.howManyWasBouncedHard).to.eql(0);\r\n    pm.expect(list.howManyWasBouncedSoft).to.eql(0);\r\n    pm.expect(list.howManyWasSent).to.eql(1);\r\n    pm.expect(list.howManyWasWatched).to.greaterThan(-1);\r\n    pm.expect(list.linksClicked).to.eql(0);\r\n    pm.expect(list.resubcribed).to.eql(0);\r\n    pm.expect(new Date(list.sentDate)).to.be.a(\"date\");\r\n    pm.expect(list.unsubcribed).to.eql(0);\r\n});"]}}],"id":"adee8ff8-9b6d-4c91-8aa4-5feb6471b169","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"url":"https://{{restApiUrl}}/v1/Campaigns/{{restApiEmailCampaign}}/Statistics?by=CampaignId","urlObject":{"protocol":"https","path":["v1","Campaigns","{{restApiEmailCampaign}}","Statistics"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"CampaignId"}],"variable":[]}},"response":[],"_postman_id":"adee8ff8-9b6d-4c91-8aa4-5feb6471b169"},{"name":"Get email campaign's responses","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response content type is application/json\", function () {\r\n    pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");\r\n});\r\n\r\npm.test(\"Validate the response schema for each item in the list array\", function () {\r\n    const responseData = pm.response.json();\r\n    pm.expect(responseData).to.be.an('array');\r\n});\r\n\r\n"]}}],"id":"c3c73a94-5237-425d-889d-71bd34b83bd2","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"url":"https://{{restApiUrl}}/v1/Campaigns/{{restApiEmailCampaign}}/Recipients?by=CampaignId&page=1&itemsPerPage=100","urlObject":{"protocol":"https","path":["v1","Campaigns","{{restApiEmailCampaign}}","Recipients"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"CampaignId"},{"key":"page","value":"1"},{"key":"itemsPerPage","value":"100"}],"variable":[]}},"response":[],"_postman_id":"c3c73a94-5237-425d-889d-71bd34b83bd2"},{"name":"Delete an email campaign","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"The Campaign is deleted\",function(){\r\n    pm.expect(jsonResponse).to.eql(\"Deleted\");\r\n});"]}}],"id":"953a6ede-ec7f-47c9-a9f5-2fdea70644f8","request":{"method":"DELETE","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"url":"https://{{restApiUrl}}/v1/Campaigns/{{restApiSendAnEmailCampaign}}?by=CampaignId","urlObject":{"protocol":"https","path":["v1","Campaigns","{{restApiSendAnEmailCampaign}}"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"CampaignId"}],"variable":[]}},"response":[],"_postman_id":"953a6ede-ec7f-47c9-a9f5-2fdea70644f8"},{"name":"Get all custom email campaigns templates","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.code == 200 ? pm.response.json() : [{id: 999, name: \"dummy\"}];\r\nlet responseCodes = [200];\r\n\r\nif(pm.environment.name === \"Smoove-DEV\"){\r\n    responseCodes.push(500);\r\n}\r\n\r\npm.test(\"Status code is OK\", function () {            \r\n    pm.expect(pm.response.code).to.be.oneOf(responseCodes);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){    \r\n    let template = jsonResponse;\r\n    pm.expect(template.id).not.null;\r\n    pm.expect(template.name).to.not.null;\r\n});"]}}],"id":"e7e2634b-11ba-4698-99b7-98b3b395f6fb","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"url":"https://{{restApiUrl}}/v1/Campaigns_Templates?fields=id%2Cname","urlObject":{"protocol":"https","path":["v1","Campaigns_Templates"],"host":["{{restApiUrl}}"],"query":[{"key":"fields","value":"id%2Cname"}],"variable":[]}},"response":[],"_postman_id":"e7e2634b-11ba-4698-99b7-98b3b395f6fb"}],"id":"68f896d8-342b-4b99-a9cd-c2e99608460f","_postman_id":"68f896d8-342b-4b99-a9cd-c2e99608460f","description":""},{"name":"Communication","item":[{"name":"Create a communication","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.id).is.above(0);\r\n    pm.expect(list.contact).to.eql(\"roy@smoove.io\");\r\n    pm.expect(list.communicator).to.include(\"@\");\r\n    pm.expect(list.initiator).to.be.a(\"string\");\r\n    pm.expect(list.date).to.match(/^\\d{2}\\/\\d{2}\\/\\d{4}$/);\r\n    pm.expect(list.time).to.match(/^\\d{2}:\\d{2}$/);\r\n    pm.expect(list.type).to.be.a(\"string\");\r\n    pm.expect(list.content).to.be.a(\"string\");\r\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","exec":["const url = 'https://' + pm.environment.get('restApiUrl') + '/v1/Contacts/' + pm.environment.get('contactIdDetails') + '/Resubscribe?by=ContactId';\r\n\r\nconst echoPostRequest = {\r\n  url: url,\r\n  method: 'POST',  \r\n  header: {\r\n      'Content-Type': 'application/json',\r\n      apikey: pm.environment.get(\"restApiKeyForAutomationTests\")\r\n  },\r\n};\r\n\r\npm.sendRequest(echoPostRequest, function(err, response){\r\n    if(err || response.code != 200)\r\n        console.error(err);\r\n});"]}}],"id":"0a5e0479-a235-4067-b987-48c890e0ce15","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"type\": \"Meeting\",\r\n  \"contact\": \"roy@smoove.io\",\r\n  \"time\": \"13:00\",\r\n  \"initiator\": \"You\",\r\n  \"content\": \"Smoove Postman\",\r\n  \"date\": \"16/01/2022\",\r\n  \"communicator\": {{restApiCommunicatorAddress}}\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Communications?by=Email","urlObject":{"protocol":"https","path":["v1","Communications"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"Email"}],"variable":[]}},"response":[],"_postman_id":"0a5e0479-a235-4067-b987-48c890e0ce15"}],"id":"e3b5ce2d-9054-4fc4-903b-ac487054f0a0","_postman_id":"e3b5ce2d-9054-4fc4-903b-ac487054f0a0","description":""},{"name":"Contacts","item":[{"name":"Active contacts","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\n// The account is shared with other collections whose contacts have a different joinSource,\n// so verify the newest contact created by this collection rather than the newest overall.\nconst viplusRestEmail = /^[A-Za-z0-9]{8}@smoove\\.smoove\\.postman\\.test$/;\nconst privateIp = /^(10\\.|192\\.168\\.|172\\.(1[6-9]|2\\d|3[01])\\.)/;\nconst ipv4 = /^\\d{1,3}(\\.\\d{1,3}){3}$/;\nconst pageSize = 100;\nconst maxPages = 5;\n\nfunction getPage(page) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest({\n            url: \"https://\" + pm.environment.get(\"restApiUrl\") + \"/v1/Contacts?page=\" + page + \"&itemsPerPage=\" + pageSize + \"&sort=-id&includeCustomFields=false&includeLinkedLists=false\",\n            method: \"GET\",\n            header: { apikey: pm.environment.get(\"restApiKeyForAutomationTests\") }\n        }, function (err, res) { if (err) reject(err); else resolve(res.json()); });\n    });\n}\n\nlet contact;\nlet contacts = pm.response.json();\nfor (let page = 1; page <= maxPages; page++) {\n    if (page > 1) {\n        contacts = await getPage(page);\n    }\n    contact = contacts.find(c => viplusRestEmail.test(c.email));\n    if (contact || contacts.length < pageSize) {\n        break;\n    }\n}\n\npm.test(\"Newest ViplusRest contact has all required properties\", function () {\n    pm.expect(contact, \"no ViplusRest contact in the newest \" + maxPages * pageSize + \" contacts\").to.exist;\n    pm.expect(contact.id).to.be.a(\"number\");\n    pm.expect(contact.externalId).to.eql(\"\");\n    pm.expect(contact.email).to.include(\"@\");\n    pm.expect(Number(contact.phone)).to.be.a(\"number\");\n    pm.expect(Number(contact.cellPhone)).to.be.a(\"number\");\n    pm.expect(contact.firstName).to.be.a(\"string\");\n    pm.expect(contact.lastName).to.be.a(\"string\");\n    pm.expect(new Date(contact.dateOfBirth)).to.be.a(\"date\");\n    pm.expect(contact.ipSignup, \"ipSignup\").to.match(ipv4);\n    pm.expect(contact.ipSignup, \"ipSignup should be public\").to.not.match(privateIp);\n    pm.expect(contact.joinSource).to.eql(\"API\");\n});"]}}],"id":"ebf9c986-0d1b-475e-b196-a560481b0d36","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts?page=1&itemsPerPage=100&sort=-id&includeCustomFields=false&includeLinkedLists=false","urlObject":{"protocol":"https","path":["v1","Contacts"],"host":["{{restApiUrl}}"],"query":[{"key":"page","value":"1"},{"key":"itemsPerPage","value":"100"},{"key":"sort","value":"-id"},{"key":"includeCustomFields","value":"false"},{"key":"includeLinkedLists","value":"false"}],"variable":[]}},"response":[],"_postman_id":"ebf9c986-0d1b-475e-b196-a560481b0d36"},{"name":"Create or update a contact","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.externalId).to.eql(\"\");\r\n    pm.expect(list.email).to.include(\"@\");\r\n    pm.expect(Number(list.phone)).to.be.a(\"number\");\r\n    pm.expect(Number(list.cellPhone)).to.be.a(\"number\");\r\n    pm.expect(list.firstName).to.be.a(\"string\");\r\n    pm.expect(list.lastName).to.be.a(\"string\");\r\n    pm.expect(new Date(list.dateOfBirth)).to.be.a(\"date\");\r\n    pm.expect(list.address === null || typeof list.address === 'string').to.be.true;\r\n    pm.expect(list.city === null || typeof list.city === 'string').to.be.true;\r\n    pm.expect(list.customFields).to.be.an(\"object\");\r\n    pm.expect(Object.keys(list.customFields).length).to.greaterThan(0);\r\n    pm.expect(list.customFields.i2).to.eql(\"i2\");\r\n    pm.expect(list.customFields.i4).to.eql(\"True\");\r\n});\r\n"]}}],"id":"0f944a40-d505-4c02-9301-c1874c2c0251","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"lastName\": \"בדיקות\",\r\n  \"firstName\": \"בדיקות\",\r\n  \"email\": \"{{RandomEmail}}\",\r\n  \"phone\": \"{{RandomPhone}}\",\r\n  \"cellPhone\": \"{{RandomCellPhone}}\",\r\n  \"dateOfBirth\": \"{{RandomDate}}\",\r\n  \"customFields\":{\r\n    \"i2\": \"i2\",\r\n    \"i3\": null,\r\n    \"i4\": true\r\n  }\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts?updateIfExists=true&restoreIfDeleted=true&restoreIfUnsubscribed=true&overrideNullableValue=false","urlObject":{"protocol":"https","path":["v1","Contacts"],"host":["{{restApiUrl}}"],"query":[{"key":"updateIfExists","value":"true"},{"key":"restoreIfDeleted","value":"true"},{"key":"restoreIfUnsubscribed","value":"true"},{"key":"overrideNullableValue","value":"false"}],"variable":[]}},"response":[],"_postman_id":"0f944a40-d505-4c02-9301-c1874c2c0251"},{"name":"Create or update a contact without custom fields","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.externalId).to.eql(\"\");\r\n    pm.expect(list.email).to.include(\"@\");\r\n    pm.expect(Number(list.phone)).to.be.a(\"number\");\r\n    pm.expect(Number(list.cellPhone)).to.be.a(\"number\");\r\n    pm.expect(list.firstName).to.be.a(\"string\");\r\n    pm.expect(list.lastName).to.be.a(\"string\");\r\n    pm.expect(new Date(list.dateOfBirth)).to.be.a(\"date\");\r\n    pm.expect(list.address === null || typeof list.address === 'string').to.be.true;\r\n    pm.expect(list.city === null || typeof list.city === 'string').to.be.true;\r\n});\r\n"]}}],"id":"7be53ea2-df07-4af7-8235-178f38eba02a","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"lastName\": \"בדיקות\",\r\n  \"firstName\": \"בדיקות\",\r\n  \"email\": \"{{RandomEmail}}\",\r\n  \"phone\": \"{{RandomPhone}}\",\r\n  \"cellPhone\": \"{{RandomCellPhone}}\",\r\n  \"dateOfBirth\": \"{{RandomDate}}\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts?updateIfExists=true&restoreIfDeleted=true&restoreIfUnsubscribed=true&overrideNullableValue=false","urlObject":{"protocol":"https","path":["v1","Contacts"],"host":["{{restApiUrl}}"],"query":[{"key":"updateIfExists","value":"true"},{"key":"restoreIfDeleted","value":"true"},{"key":"restoreIfUnsubscribed","value":"true"},{"key":"overrideNullableValue","value":"false"}],"variable":[]}},"response":[],"_postman_id":"7be53ea2-df07-4af7-8235-178f38eba02a"},{"name":"Create or update a contact with custom fields options","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.externalId).to.eql(\"\");\r\n    pm.expect(list.email).to.include(\"@\");\r\n    pm.expect(Number(list.phone)).to.be.a(\"number\");\r\n    pm.expect(Number(list.cellPhone)).to.be.a(\"number\");\r\n    pm.expect(list.firstName).to.be.a(\"string\");\r\n    pm.expect(list.lastName).to.be.a(\"string\");\r\n    pm.expect(new Date(list.dateOfBirth)).to.be.a(\"date\");\r\n    pm.expect(list.address === null || typeof list.address === 'string').to.be.true;\r\n    pm.expect(list.city === null || typeof list.city === 'string').to.be.true;\r\n    pm.expect(list.customFields).to.be.an(\"object\");\r\n    pm.expect(Object.keys(list.customFields).length).to.greaterThan(0);\r\n    pm.expect(list.customFields.i2).to.contain(\"i2,\");\r\n});\r\n"]}}],"id":"e43e7865-ea0f-4a79-bfdc-b19e62f48d6a","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"lastName\": \"בדיקות\",\r\n  \"firstName\": \"בדיקות\",\r\n  \"email\": \"YfjWwhiL@smoove.smoove.postman.test\",\r\n  \"phone\": \"{{RandomPhone}}\",\r\n  \"cellPhone\": \"6702315826\",\r\n  \"dateOfBirth\": \"{{RandomDate}}\",\r\n  \"customFields\":{\r\n    \"i2\": \"i2\"\r\n  },\r\n  \"options\": {\r\n    \"customFields\":[\r\n        {\r\n            \"id\": \"i2\",\r\n            \"mode\": \"append\"\r\n        }\r\n    ]\r\n  }\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts?updateIfExists=true&restoreIfDeleted=true&restoreIfUnsubscribed=true&overrideNullableValue=false","urlObject":{"protocol":"https","path":["v1","Contacts"],"host":["{{restApiUrl}}"],"query":[{"key":"updateIfExists","value":"true"},{"key":"restoreIfDeleted","value":"true"},{"key":"restoreIfUnsubscribed","value":"true"},{"key":"overrideNullableValue","value":"false"}],"variable":[]}},"response":[],"_postman_id":"e43e7865-ea0f-4a79-bfdc-b19e62f48d6a"},{"name":"Bulk contacts import","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"List array item has all required properties for \", function () {\n    pm.expect(pm.response.text(), \"response body\").to.be.a(\"string\").and.not.empty;\n    const list = pm.response.json();\n    pm.expect(list.status).to.eql(\"Finished\");\n    pm.expect(list.importReport.invalids).to.eql(0);\n    pm.expect(list.importReport.updated).to.eql(0);\n    pm.expect(list.importReport.inserted).to.be.above(0);\n    pm.expect(list.importReport.quotaExceeded).to.eql(0);\n    pm.expect(list.importReport.blacklisted).to.eql(0);\n    pm.expect(list.importReport.totalOperations).to.be.above(0);\n    pm.expect(list.importReport.reportUrl).not.null;\n});"]}}],"id":"d3a6be1d-03b9-4ebe-b4c9-14db7f2392d5","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"contacts\": [\r\n    {\r\n        \"email\": \"{{RandomEmail}}\",\r\n        \"firstName\": \"רועי\",\r\n        \"lastName\": \"בדיקות\"\r\n}\r\n  ],\r\n  \"lists_ToSubscribe\": [\r\n    {{GetSpecificList}}\r\n  ]\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts_BulkImport?overrideNullableValue=false&updateOnlyExistingContacts=false","urlObject":{"protocol":"https","path":["v1","Contacts_BulkImport"],"host":["{{restApiUrl}}"],"query":[{"key":"overrideNullableValue","value":"false"},{"key":"updateOnlyExistingContacts","value":"false"}],"variable":[]}},"response":[],"_postman_id":"d3a6be1d-03b9-4ebe-b4c9-14db7f2392d5"},{"name":"Bulk contacts import - international number","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"List array item has all required properties\", function () {\n    pm.expect(pm.response.text(), \"response body\").to.be.a(\"string\").and.not.empty;\n    const list = pm.response.json();\n    pm.expect(list.status).to.eql(\"Finished\");\n    pm.expect(list.importReport.invalids).to.eql(0);\n    pm.expect(list.importReport.updated).to.be.above(0);\n    pm.expect(list.importReport.inserted).to.eql(0);\n    pm.expect(list.importReport.quotaExceeded).to.eql(0);\n    pm.expect(list.importReport.blacklisted).to.eql(0);\n    pm.expect(list.importReport.totalOperations).to.be.above(0);\n    pm.expect(list.importReport.reportUrl).not.null;\n});"]}}],"id":"c7b083a7-8b83-4e9b-b3e7-11592dc493f5","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"contacts\": [\r\n    {\r\n  \"lastName\": \"4רועי\",\r\n  \"firstName\": \"בדיקות\",\r\n  \"cellPhone\": \"9725126272\"\r\n}\r\n  ],\r\n  \"lists_ToSubscribe\": [\r\n    {{GetSpecificList}}\r\n  ]\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts_BulkImport?overrideNullableValue=false","urlObject":{"protocol":"https","path":["v1","Contacts_BulkImport"],"host":["{{restApiUrl}}"],"query":[{"key":"overrideNullableValue","value":"false"}],"variable":[]}},"response":[],"_postman_id":"c7b083a7-8b83-4e9b-b3e7-11592dc493f5"},{"name":"Get contact's details","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.email).to.include(\"@\");\r\n    pm.expect(Number(list.cellPhone)).to.be.a(\"number\");\r\n    pm.expect(list.firstName).to.be.a(\"string\");\r\n    pm.expect(list.lastName).to.be.a(\"string\");\r\n    pm.expect(new Date(list.dateOfBirth)).to.be.a(\"date\");\r\n    pm.expect([\"API\",\"ByHand\"].indexOf(list.joinSource)).to.be.greaterThan(-1);\r\n});"]}}],"id":"288972b6-2b27-469c-94aa-591441ab793e","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"},{"key":"id","value":"{{contactIdDetails}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts/{{contactIdDetails}}?by=ContactId&includeCustomFields=false&includeLinkedLists=false","urlObject":{"protocol":"https","path":["v1","Contacts","{{contactIdDetails}}"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"ContactId"},{"key":"includeCustomFields","value":"false"},{"key":"includeLinkedLists","value":"false"}],"variable":[]}},"response":[],"_postman_id":"288972b6-2b27-469c-94aa-591441ab793e"},{"name":"Update contact","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.email).to.include(\"@smoove\");\r\n    pm.expect(Number(list.cellPhone)).to.be.a(\"number\");\r\n    pm.expect(list.firstName).to.be.a(\"string\");\r\n    pm.expect(list.lastName).to.be.a(\"string\");\r\n    pm.expect(new Date(list.dateOfBirth)).to.be.a(\"date\");\r\n});"]}}],"id":"28874e54-6d1a-4a3b-a69c-c7e37460ebf8","request":{"method":"PUT","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n    \"firstName\": \"Smoove\",\r\n    \"lastName\": \"Postman\" ,\r\n    \"email\": \"{{RandomEmail}}\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts/{{contactIdDetails}}?by=ContactId&restoreIfDeleted=true&restoreIfUnsubscribed=true&overrideNullableValue=false","urlObject":{"protocol":"https","path":["v1","Contacts","{{contactIdDetails}}"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"ContactId"},{"key":"restoreIfDeleted","value":"true"},{"key":"restoreIfUnsubscribed","value":"true"},{"key":"overrideNullableValue","value":"false"}],"variable":[]}},"response":[],"_postman_id":"28874e54-6d1a-4a3b-a69c-c7e37460ebf8"},{"name":"Check if a contact exists","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(jsonResponse).to.eql(true);\r\n});"]}}],"id":"f056f02c-8ad1-4a30-bd80-b371bee95a8b","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"},{"key":"id","value":"{{contactIdDetails}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts/{{contactIdDetails}}/Exists?by=ContactId","urlObject":{"protocol":"https","path":["v1","Contacts","{{contactIdDetails}}","Exists"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"ContactId"}],"variable":[]}},"response":[],"_postman_id":"f056f02c-8ad1-4a30-bd80-b371bee95a8b"},{"name":"Unsubscribe a contact","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\nlet contactIdDetails = pm.environment.get('contactIdDetails');\r\n\r\npm.test(\"Status code is 200 or 400 if the contacts is already blacklisted\", function () {\r\n    pm.expect(pm.response.code).to.oneOf([200,400]);\r\n    if(pm.response.code == 400){\r\n        pm.expect(pm.response.status).to.equal('Bad Request');\r\n    }\r\n});\r\n\r\npm.test(\"The contact was inserted or already blacklisted\", function(){\r\n    console.log(jsonResponse);\r\n    if(pm.response.code == 400){\r\n        pm.expect(jsonResponse.message ?? jsonResponse).to.oneOf([\r\n            \"The requested active contact '[\" + contactIdDetails + \"]' by 'ContactId' already blacklisted\"\r\n            ,\"contact '[\" + contactIdDetails + \"]' unsubscription error 'ErrFailed'\"\r\n            ]\r\n        );\r\n    }\r\n    else if(pm.response.code == 200){\r\n        pm.expect(jsonResponse).to.equal(\"OkInserted\");\r\n    }\r\n});\r\n\r\n"]}}],"id":"e9fabbdf-1ab3-47a8-9044-e9264c5cdf76","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"},{"key":"id","value":"{{contactIdDetails}}"}],"body":{"mode":"raw","raw":"{\r\n  \"reason\": \"To much mails\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts/{{contactIdDetails}}/Unsubscribe?by=ContactId","urlObject":{"protocol":"https","path":["v1","Contacts","{{contactIdDetails}}","Unsubscribe"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"ContactId"}],"variable":[]}},"response":[],"_postman_id":"e9fabbdf-1ab3-47a8-9044-e9264c5cdf76"},{"name":"Resubscribe a contact","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"The contact was resubscribed\",function(){\r\n    pm.expect(jsonResponse).to.eql(true);\r\n});"]}}],"id":"b04117e1-7196-45d0-8b66-e733f3babafb","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"},{"key":"id","value":"{{contactIdDetails}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts/{{contactIdDetails}}/Resubscribe?by=ContactId","urlObject":{"protocol":"https","path":["v1","Contacts","{{contactIdDetails}}","Resubscribe"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"ContactId"}],"variable":[]}},"response":[],"_postman_id":"b04117e1-7196-45d0-8b66-e733f3babafb"},{"name":"Unsubscribed contacts info","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.email).to.include(\"@\");\r\n    pm.expect(Number(list.cellPhone)).to.be.a(\"number\");\r\n    pm.expect(list.firstName).to.be.a(\"string\");\r\n    pm.expect(list.lastName).to.be.a(\"string\");\r\n    pm.expect(new Date(list.dateOfBirth)).to.be.a(\"date\");\r\n});"]}}],"id":"c8c5f65e-79e3-4f31-b5af-990641cd17b2","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts_Unsubscribers?fields=id%2Cexternalid%2Cemail%2Ccellphone%2Cfirstname%2Clastname%2CtimestampSignup%2ClastChanged%2CtimestampUnsubscribed%2CunsubscribeReasonType%2CunsubscribeReasonComment&page=1&itemsPerPage=100&sort=-timestampUnsubscribed&includeCustomFields=false&includeLinkedLists=false","urlObject":{"protocol":"https","path":["v1","Contacts_Unsubscribers"],"host":["{{restApiUrl}}"],"query":[{"key":"fields","value":"id%2Cexternalid%2Cemail%2Ccellphone%2Cfirstname%2Clastname%2CtimestampSignup%2ClastChanged%2CtimestampUnsubscribed%2CunsubscribeReasonType%2CunsubscribeReasonComment"},{"key":"page","value":"1"},{"key":"itemsPerPage","value":"100"},{"key":"sort","value":"-timestampUnsubscribed"},{"key":"includeCustomFields","value":"false"},{"key":"includeLinkedLists","value":"false"}],"variable":[]}},"response":[],"_postman_id":"c8c5f65e-79e3-4f31-b5af-990641cd17b2"},{"name":"Gets the blacklisted contacts","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.email).to.include(\"@\");\r\n    pm.expect(Number(list.cellPhone)).to.be.a(\"number\");\r\n    pm.expect(list.firstName).to.be.a(\"string\");\r\n    pm.expect(list.lastName).to.be.a(\"string\");\r\n    pm.expect(new Date(list.dateOfBirth)).to.be.a(\"date\");\r\n});"]}}],"id":"adedbb11-741d-4ee2-909e-2750c060e293","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts_Blacklisted?fields=id%2Cemail%2Ccellphone%2Cfirstname%2Clastname%2CtimestampSignup%2CtimestampUnsubscribed%2CunsubscribeReasonType%2CunsubscribeReasonComment%2ClastChanged","urlObject":{"protocol":"https","path":["v1","Contacts_Blacklisted"],"host":["{{restApiUrl}}"],"query":[{"key":"fields","value":"id%2Cemail%2Ccellphone%2Cfirstname%2Clastname%2CtimestampSignup%2CtimestampUnsubscribed%2CunsubscribeReasonType%2CunsubscribeReasonComment%2ClastChanged"}],"variable":[]}},"response":[],"_postman_id":"adedbb11-741d-4ee2-909e-2750c060e293"},{"name":"Get bulk contacts statuses","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\n// Contacts/status returns Deleted rows too; newest-by-id is often a deleted\n// Smoove.Api contact. Assert on any Active @smoove contact in this page.\nconst list = pm.response.json().find(c => c.status === \"Active\" && typeof c.email === \"string\" && c.email.includes(\"@smoove\"));\n\npm.test(\"List array item has all required properties\", function () {\n    pm.expect(list, \"no Active @smoove contact in the newest page of statuses\").to.exist;\n    pm.expect(list.id).to.be.a(\"number\");\n    pm.expect(list.email).to.include(\"@smoove\");\n    pm.expect(Number(list.cellPhone)).to.be.a(\"number\");\n    pm.expect(list.status).to.eql(\"Active\");\n});"]}}],"id":"2b4d7d85-ec1a-4610-90d0-940be25981d0","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"lastName\": \"1רועי\",\r\n  \"firstName\": \"בדיקות\",\r\n  \"email\": \"roy@smooveio\",\r\n  \"cellPhone\": \"0524748027\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Contacts/status?page=1&itemsPerPage=100&sort=-id","urlObject":{"protocol":"https","path":["v1","Contacts","status"],"host":["{{restApiUrl}}"],"query":[{"key":"page","value":"1"},{"key":"itemsPerPage","value":"100"},{"key":"sort","value":"-id"}],"variable":[]}},"response":[],"_postman_id":"2b4d7d85-ec1a-4610-90d0-940be25981d0"},{"name":"Get contact's status","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.email).to.include(\"@\");\r\n    pm.expect(Number(list.cellPhone)).to.be.a(\"number\");\r\n    pm.expect(list.status).to.eql(\"Active\");\r\n});"]}}],"id":"f7fbe637-5d77-476f-a205-a96fb1f21d05","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"},{"key":"id","value":"{{contactIDDetails}}"}],"url":"https://{{restApiUrl}}/v1/Contacts/status/{{contactIdDetails}}?by=ContactId","urlObject":{"protocol":"https","path":["v1","Contacts","status","{{contactIdDetails}}"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"ContactId"}],"variable":[]}},"response":[],"_postman_id":"f7fbe637-5d77-476f-a205-a96fb1f21d05"}],"id":"95889b7f-99cc-4361-a2f0-f2f4d4134960","_postman_id":"95889b7f-99cc-4361-a2f0-f2f4d4134960","description":""},{"name":"LandingPages","item":[{"name":"Get a list of landing pages","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.formId).to.be.a(\"number\");\r\n    pm.expect(list.formTitle).not.null;\r\n    pm.expect(list.formType).to.be.a(\"string\");\r\n});"]}}],"id":"a15f81a6-62ef-4a84-be2a-79b26b28f8e6","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"url":"https://{{restApiUrl}}/v1/LandingPages?type=LandingPage","urlObject":{"protocol":"https","path":["v1","LandingPages"],"host":["{{restApiUrl}}"],"query":[{"key":"type","value":"LandingPage"}],"variable":[]}},"response":[],"_postman_id":"a15f81a6-62ef-4a84-be2a-79b26b28f8e6"},{"name":"Get a specific landing page","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.formId).to.be.a(\"number\");\r\n    pm.expect(list.formTitle).not.null;\r\n    pm.expect(list.formType).to.be.a(\"string\");\r\n});"]}}],"id":"105efdd0-7155-4ec4-8973-232a8bf51b3a","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"url":"https://{{restApiUrl}}/v1/LandingPages/{{GetSpecificLP}}","urlObject":{"protocol":"https","path":["v1","LandingPages","{{GetSpecificLP}}"],"host":["{{restApiUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"105efdd0-7155-4ec4-8973-232a8bf51b3a"},{"name":"Get landing pages subscriber","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(new Date(list.timeStamp)).to.be.a(\"date\");\r\n    pm.expect(list.contactId).to.be.a(\"number\");\r\n    pm.expect(list.contact.id).to.be.a(\"number\");\r\n    pm.expect(list.contact.email).to.include(\"@\");\r\n    pm.expect(Number(list.cellPhone)).to.be.a(\"number\");\r\n    pm.expect(list.contact.firstName).to.be.a(\"string\");\r\n    pm.expect(list.contact.firstName).to.be.a(\"string\");\r\n    pm.expect(new Date(list.contact.timeStamp)).to.be.a(\"date\");\r\n});\r\n"]}}],"id":"19f7db5c-c27e-42b6-a7a9-04705d70d728","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"url":"https://{{restApiUrl}}/v1/LandingPages/{{GetSpecificLP}}/Recipients?fields=id%2Cexternalid%2Cemail%2Ccellphone%2Cfirstname%2Clastname%2CtimestampSignup&page=1&itemsPerPage=100&includeCustomFields=false&includeLinkedLists=false","urlObject":{"protocol":"https","path":["v1","LandingPages","{{GetSpecificLP}}","Recipients"],"host":["{{restApiUrl}}"],"query":[{"key":"fields","value":"id%2Cexternalid%2Cemail%2Ccellphone%2Cfirstname%2Clastname%2CtimestampSignup"},{"key":"page","value":"1"},{"key":"itemsPerPage","value":"100"},{"key":"includeCustomFields","value":"false"},{"key":"includeLinkedLists","value":"false"}],"variable":[]}},"response":[],"_postman_id":"19f7db5c-c27e-42b6-a7a9-04705d70d728"}],"id":"77a398e5-c2ab-47bd-a86c-0db2608baf9e","_postman_id":"77a398e5-c2ab-47bd-a86c-0db2608baf9e","description":""},{"name":"Lists","item":[{"name":"Get all lists","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.publicName).to.be.a(\"string\");\r\n    pm.expect(list.publicDescription).to.be.a(\"string\");\r\n    pm.expect(list.permissions.isPublic).to.be.a(\"boolean\");\r\n    pm.expect(list.permissions.allowsUsersToSubscribe).to.be.a(\"boolean\");\r\n    pm.expect(list.permissions.allowsUsersToUnsubscribe).to.be.a(\"boolean\");\r\n    pm.expect(list.permissions.isPortal).to.be.a(\"boolean\");\r\n    pm.expect(list.contactsCount).to.eql(0);\r\n});"]}}],"id":"198723ce-8055-4569-affc-b99521d1aaaa","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"url":"https://{{restApiUrl}}/v1/Lists","urlObject":{"protocol":"https","path":["v1","Lists"],"host":["{{restApiUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"198723ce-8055-4569-affc-b99521d1aaaa"},{"name":"Create a new list","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\nlet name =  \"My subscribers list\";\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.name).to.be.a(\"string\");\r\n    pm.expect(list.publicName).to.be.a(\"string\");\r\n    pm.expect(list.description).to.be.a(\"string\");\r\n    pm.expect(list.publicDescription).to.be.a(\"string\");\r\n    pm.expect(list.permissions.isPublic).to.be.true;\r\n    pm.expect(list.permissions.allowsUsersToSubscribe).to.be.true;\r\n    pm.expect(list.permissions.allowsUsersToUnsubscribe).to.be.true;\r\n    pm.expect(list.permissions.isPortal).to.be.false;\r\n    pm.expect(list.contactsCount).to.eql(0);\r\n});"]}}],"id":"55bd6cc0-1b33-4ca8-ae34-ef2db4e19ce1","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"description\": \"This list is a list for new subscribers\",\r\n  \"name\": \"My subscribers list\",\r\n  \"publicDescription\": \"Public name - This list is a list for new subscribers\",\r\n  \"permissions\": {\r\n    \"isPublic\": true,\r\n    \"allowsUsersToSubscribe\": true,\r\n    \"allowsUsersToUnsubscribe\": true,\r\n    \"isPortal\": false\r\n  },\r\n  \"publicName\": \"My subscribers public name list\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Lists","urlObject":{"protocol":"https","path":["v1","Lists"],"host":["{{restApiUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"55bd6cc0-1b33-4ca8-ae34-ef2db4e19ce1"},{"name":"Get a specific list","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.name).to.be.a(\"string\");\r\n    pm.expect(list.publicName).to.be.a(\"string\");\r\n    pm.expect(list.description).to.be.a(\"string\");\r\n    pm.expect(list.publicDescription).to.eql(\"\");\r\n    pm.expect(list.permissions.isPublic).to.be.false;\r\n    pm.expect(list.permissions.allowsUsersToSubscribe).to.be.false;\r\n    pm.expect(list.permissions.allowsUsersToUnsubscribe).to.be.false;\r\n    pm.expect(list.permissions.isPortal).to.be.false;\r\n    pm.expect(list.contactsCount).to.be.a(\"number\");\r\n});"]}}],"id":"e1564058-83c4-4ecb-87b4-6ee4dd95009e","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Lists/{{GetSpecificList}}","urlObject":{"protocol":"https","path":["v1","Lists","{{GetSpecificList}}"],"host":["{{restApiUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e1564058-83c4-4ecb-87b4-6ee4dd95009e"},{"name":"Get contacts details by list","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.externalId).to.eql(\"\");\r\n    pm.expect(list.email).to.include(\"@\");\r\n    pm.expect(Number(list.cellPhone)).to.be.a(\"number\");\r\n    pm.expect(list.firstName).to.be.a(\"string\");\r\n    pm.expect(list.lastName).to.be.a(\"string\");\r\n    pm.expect(new Date(list.timestampSignup)).to.be.a(\"date\");\r\n});"]}}],"id":"f256ab74-9aa9-4928-b205-71a2ca85d205","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Lists/{{GetSpecificList}}/Contacts?fields=id%2Cexternalid%2Cemail%2Ccellphone%2Cfirstname%2Clastname%2CtimestampSignup&page=1&itemsPerPage=100&sort=-id&includeCustomFields=false&includeLinkedLists=false&includeListAssociationTime=false","urlObject":{"protocol":"https","path":["v1","Lists","{{GetSpecificList}}","Contacts"],"host":["{{restApiUrl}}"],"query":[{"key":"fields","value":"id%2Cexternalid%2Cemail%2Ccellphone%2Cfirstname%2Clastname%2CtimestampSignup"},{"key":"page","value":"1"},{"key":"itemsPerPage","value":"100"},{"key":"sort","value":"-id"},{"key":"includeCustomFields","value":"false"},{"key":"includeLinkedLists","value":"false"},{"key":"includeListAssociationTime","value":"false"}],"variable":[]}},"response":[],"_postman_id":"f256ab74-9aa9-4928-b205-71a2ca85d205"}],"id":"eef29a20-33a4-495c-841c-fd998bf6c4b9","_postman_id":"eef29a20-33a4-495c-841c-fd998bf6c4b9","description":""},{"name":"Messages","item":[{"name":"Create and send an SMS campaign","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.body).to.be.a(\"string\");\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(Number(list.fromNumber)).to.be.a(\"number\");\r\n    pm.expect(list.externalId).to.eql(\"\");\r\n});"]}}],"id":"93cb406a-3966-431e-bc80-898d26e36530","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"toMembersByCell\": [\r\n    \"0500000000\"\r\n  ],\r\n  \"body\": \"Hey\",\r\n  \"fromNumber\": \"0524748027\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Messages?isTts=false&sendNow=false","urlObject":{"protocol":"https","path":["v1","Messages"],"host":["{{restApiUrl}}"],"query":[{"key":"isTts","value":"false"},{"key":"sendNow","value":"false"}],"variable":[]}},"response":[],"_postman_id":"93cb406a-3966-431e-bc80-898d26e36530"},{"name":"Create and send a TTS campaign","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.body).to.be.a(\"string\");\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(Number(list.fromNumber)).to.be.a(\"number\");\r\n    pm.expect(list.externalId).to.eql(\"\");\r\n});"]}}],"id":"a0c5e2e9-5a68-440e-a6fb-7311bdcce15d","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"toMembersByCell\": [\r\n    \"0500000000\"\r\n  ],\r\n  \"body\": \"Hey\",\r\n  \"fromNumber\": \"0524748027\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Messages?isTts=true&sendNow=false","urlObject":{"protocol":"https","path":["v1","Messages"],"host":["{{restApiUrl}}"],"query":[{"key":"isTts","value":"true"},{"key":"sendNow","value":"false"}],"variable":[]}},"response":[],"_postman_id":"a0c5e2e9-5a68-440e-a6fb-7311bdcce15d"},{"name":"Create and send a WhatsApp campaign","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.body).to.be.a(\"string\");\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(Number(list.fromNumber)).to.be.a(\"number\");\r\n    pm.expect(list.externalId).to.eql(\"\");\r\n});"]}}],"id":"8ebabd94-54ae-4eba-ba73-1ffed34628fd","request":{"method":"POST","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"{\r\n  \"toMembersByCell\": [\r\n    \"0510000000\"\r\n  ],\r\n  \"templateId\": {{TemplateIdForWhatsApp}},\r\n  \"templateMessageParams\": [\r\n  ],\r\n  \"fromNumber\": {{WhatsAppVirtualNumber}}\r\n}","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Messages/Whatsapp/Create?sendNow=false","urlObject":{"protocol":"https","path":["v1","Messages","Whatsapp","Create"],"host":["{{restApiUrl}}"],"query":[{"key":"sendNow","value":"false"}],"variable":[]}},"response":[],"_postman_id":"8ebabd94-54ae-4eba-ba73-1ffed34628fd"},{"name":"Get SMS campaign responses per contact","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.campaignId).to.be.a(\"number\");\r\n    pm.expect(list.externalId).to.eql(\"\");\r\n    pm.expect(Number(list.contactPhone)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.sendDate)).to.be.a(\"date\");\r\n    pm.expect(list.contactId).to.be.a(\"number\");\r\n    pm.expect(list.status).not.null;\r\n    pm.expect(new Date(list.responseDate)).to.be.a(\"date\");\r\n});"]}}],"id":"9d142a2e-84d5-4f35-a653-0915224bf28f","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Messages/{{GetSpecificSMS}}/Recipients?by=MessageId&page=1&itemsPerPage=500","urlObject":{"protocol":"https","path":["v1","Messages","{{GetSpecificSMS}}","Recipients"],"host":["{{restApiUrl}}"],"query":[{"key":"by","value":"MessageId"},{"key":"page","value":"1"},{"key":"itemsPerPage","value":"500"}],"variable":[]}},"response":[],"_postman_id":"9d142a2e-84d5-4f35-a653-0915224bf28f"},{"name":"Get WhatsApp templates","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.id).to.be.a(\"number\");\r\n    pm.expect(list.referenceId).to.be.a(\"number\");\r\n    pm.expect(list.name).to.be.a(\"string\");\r\n    pm.expect(list.category).to.be.a(\"string\");\r\n    pm.expect(list.language).to.be.a(\"string\");\r\n});"]}}],"id":"e7d7f416-3172-4b99-891f-00490ac61f1d","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Messages/Whatsapp/Templates?page=1&itemsPerPage=100","urlObject":{"protocol":"https","path":["v1","Messages","Whatsapp","Templates"],"host":["{{restApiUrl}}"],"query":[{"key":"page","value":"1"},{"key":"itemsPerPage","value":"100"}],"variable":[]}},"response":[],"_postman_id":"e7d7f416-3172-4b99-891f-00490ac61f1d"},{"name":"Get WhatsApp message Statistics","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"List array item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.sent).to.be.a(\"number\");\r\n    pm.expect(list.received).to.be.a(\"number\");\r\n    pm.expect(list.read).to.be.a(\"number\");\r\n    pm.expect(list.failed).to.be.a(\"number\");\r\n    pm.expect(list.unknown).to.be.a(\"number\");\r\n});\r\n"]}}],"id":"f70e08a8-f784-4fc0-b95d-0704ef711cd9","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Messages/Whatsapp/{{WhatsAppMessageId}}/Statistics","urlObject":{"protocol":"https","path":["v1","Messages","Whatsapp","{{WhatsAppMessageId}}","Statistics"],"host":["{{restApiUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f70e08a8-f784-4fc0-b95d-0704ef711cd9"}],"id":"8941ff61-e029-4c79-bae2-98a7b4d1a059","_postman_id":"8941ff61-e029-4c79-bae2-98a7b4d1a059","description":""},{"name":"etc","item":[{"name":"Free account - up to 100 API calls","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.text();\r\nlet apiCallsLimit = \"You have reached the api calls limit. For more api calls, please upgrade your account.\";\r\n\r\n\r\npm.test(\"Status code is 402\", function () {\r\n    pm.response.to.have.status(402);\r\n});\r\n\r\npm.test(\"the account reach the api calls limit\",function(){\r\n    pm.expect(jsonResponse).to.eql(apiCallsLimit);\r\n});"]}}],"id":"472d699e-f927-4e09-9765-40e1fb71fc48","request":{"method":"GET","header":[{"key":"apikey","value":"{{FreeAccountAPIKeyLimit}}"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"https://{{restApiUrl}}/v1/Account/ContactFields","urlObject":{"protocol":"https","path":["v1","Account","ContactFields"],"host":["{{restApiUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"472d699e-f927-4e09-9765-40e1fb71fc48"},{"name":"Regular account - more than 100 API calls","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"System fields array item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.key).to.be.a(\"string\");\r\n    pm.expect(list.label).to.be.a(\"string\");\r\n    pm.expect(list.type).to.be.a(\"string\");\r\n    pm.expect(list.groupId).to.be.null;\r\n    pm.expect(list.options).to.be.null;\r\n    pm.expect(list.custom).to.be.false;\r\n    pm.expect(list.groupName).to.be.null;\r\n    pm.expect(list.poisition).to.be.null;\r\n});"]}}],"id":"ea7e7ea7-9c48-465b-b675-4f67fed719cf","request":{"method":"GET","header":[{"key":"apikey","value":"{{restApiKeyForAutomationTests}}"}],"url":"https://{{restApiUrl}}/v1/Account/ContactFields","urlObject":{"protocol":"https","path":["v1","Account","ContactFields"],"host":["{{restApiUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"ea7e7ea7-9c48-465b-b675-4f67fed719cf"}],"id":"6582511f-06e0-4e9c-8128-dbca8967db73","_postman_id":"6582511f-06e0-4e9c-8128-dbca8967db73","description":""}],"id":"8b2b45b4-3b95-48f6-89fc-135472fd21d9","event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":["// generate a random email address\nfunction generateRandomString(length) {\n    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n    let result = '';\n    for (let i = 0; i < length; i++) {\n        result += characters.charAt(Math.floor(Math.random() * characters.length));\n    }\n    return result;\n}\n// Change 8 to your desired length\nconst randomName = generateRandomString(8);\nconst randomEmail = `${randomName}@smoove.smoove.postman.test`;\npm.environment.set(\"RandomEmail\", randomEmail);\n\n// generate a random phone number with a specified number of digits\nconst randomPhone = Math.floor(1000000000 + Math.random() * 10000000000);\n// Set the random mobile number as an environment variable\npm.environment.set('RandomPhone', randomPhone.toString());\n\n// generate a random cell phone numer with a specified number of digits\nconst randomCellphone = Math.floor(1000000000 + Math.random() * 10000000000);\n// Set the random mobile number as an environment variable\npm.environment.set('RandomCellPhone', randomCellphone.toString());\n\n// generate a random date between a specific range\nconst startDate = new Date('2000-01-01');\nconst endDate = new Date('2021-12-31');\nconst randomDate = new Date(startDate.getTime() + Math.random() * (endDate.getTime() - startDate.getTime()));\nconst formattedRandomDate = randomDate.toISOString().split('T')[0];\npm.environment.set('RandomDate', formattedRandomDate);"]}}],"_postman_id":"8b2b45b4-3b95-48f6-89fc-135472fd21d9","description":""},{"name":"ViplusApi","item":[{"name":"AuthTest_GET","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});"]}}],"id":"0d4a741f-b3f1-42eb-b0a6-c4591c090409","request":{"method":"GET","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/AuthTest_GET"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <AuthTest_GET xmlns=\"http://api.viplus.com/\"/>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"0d4a741f-b3f1-42eb-b0a6-c4591c090409"},{"name":"AuthTest","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"AuthTestResponse\"][\"AuthTestResult\"][\"DataBag\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"AuthTest details is OK\", function() {\r\n    pm.expect(jsonBody[\"ApiKey\"]).not.equal(0);\r\n    pm.expect(jsonBody[\"ApiKey\"]).not.null;\r\n});"]}}],"id":"8282189a-65cf-4f5b-99d0-3050c2bdae7e","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/AuthTest"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <AuthTest xmlns=\"http://api.viplus.com/\"/>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8282189a-65cf-4f5b-99d0-3050c2bdae7e"},{"name":"OMembers_Import","event":[{"listen":"test","script":{"type":"text/javascript","exec":["const jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OMembers_ImportResponse\"][\"OMembers_ImportResult\"];\r\nlet randomEmail = pm.environment.get(\"RandomEmail\");\r\nconst requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {    \r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OMembers_Import details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"ActionOnExists\"]).to.equal(\"Merge\");\r\n    pm.expect(jsonBody[\"Email\"]).to.equal(randomEmail);\r\n    pm.expect(jsonBody[\"FirstName\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"FirstName\"]).to.be.a(\"string\");\r\n    pm.expect(Number(jsonBody[\"Cellphone\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"VipLists\"])).to.be.a(\"number\");\r\n});"]}}],"id":"b6a1c58f-b77b-4a7b-aa45-743a38ac2ed5","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OMembers_Import"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OMembers_Import xmlns=\"http://api.viplus.com/\">\n      <member>\n        <ActionOnExists>Merge</ActionOnExists>\n        <ActionOnRestore>Ignore</ActionOnRestore>\n        <SendMailToAdmin>true</SendMailToAdmin>\n        <Email>{{RandomEmail}}</Email>\n        <ReceiveMail>true</ReceiveMail>\n        <ReceiveSms>true</ReceiveSms>\n        <SendFirstResponder>true</SendFirstResponder>\n        <FirstName>{{RandomFirstName}}</FirstName>\n        <LastName>{{RandomLastName}}</LastName>\n        <Cellphone>{{RandomCellphone}}</Cellphone>\n        <VipLists>{{GetSpecificListForSOAPTests}}</VipLists>\n      </member>\n    </OMembers_Import>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"b6a1c58f-b77b-4a7b-aa45-743a38ac2ed5"},{"name":"RMembers_Import","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"RMembers_ImportResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"RMembers_Import details is OK\", function() {\r\n    pm.expect(jsonBody[\"RMembers_ImportResult\"]).to.equal(\"ErrNotValid\");\r\n});"]}}],"id":"88739b1d-9d8d-42ff-b550-5ba55eb61238","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/RMembers_Import"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <RMembers_Import xmlns=\"http://api.viplus.com/\">\n      <RMembers_ImportResult>91795780</RMembers_ImportResult>\n    </RMembers_Import>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"88739b1d-9d8d-42ff-b550-5ba55eb61238"},{"name":"OMembers_ImportBulk","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OMembers_ImportBulkResponse\"][\"OMembers_ImportBulkResult\"][\"VipMember\"];\r\nlet randomEmail = pm.environment.get(\"RandomEmail\");\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OMembers_ImportBulk details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.equal(\"OkInserted\");\r\n    pm.expect(jsonBody[\"ActionOnExists\"]).to.equal(\"Insert\");\r\n    pm.expect(jsonBody[\"Email\"]).to.equal(randomEmail);\r\n    pm.expect(jsonBody[\"FirstName\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"FirstName\"]).to.be.a(\"string\");\r\n    pm.expect(Number(jsonBody[\"Cellphone\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"VipLists\"])).to.be.a(\"number\");\r\n});"]}}],"id":"60a60235-95b7-434f-8a71-4378e9d125c8","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OMembers_ImportBulk"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OMembers_ImportBulk xmlns=\"http://api.viplus.com/\">\n      <members>\n        <VipMember>\n            <ActionOnExists>Insert</ActionOnExists>\n            <ActionOnRestore>Ignore</ActionOnRestore>\n            <SendMailToAdmin>true</SendMailToAdmin>\n            <Email>{{RandomEmail}}</Email>\n            <ReceiveMail>true</ReceiveMail>\n            <ReceiveSms>true</ReceiveSms>\n            <SendFirstResponder>true</SendFirstResponder>\n            <FirstName>{{RandomFirstName}}</FirstName>\n            <LastName>{{RandomLastName}}</LastName>\n            <Cellphone>{{RandomCellphone}}</Cellphone>\n            <VipLists>{{GetSpecificListForSOAPTests}}</VipLists>\n        </VipMember>\n        <VipMember>\n            <ActionOnExists>Merge</ActionOnExists>\n            <ActionOnRestore>Ignore</ActionOnRestore>\n            <SendMailToAdmin>true</SendMailToAdmin>\n            <Email>{{RandomEmail}}</Email>\n            <ReceiveMail>true</ReceiveMail>\n            <ReceiveSms>true</ReceiveSms>\n            <SendFirstResponder>true</SendFirstResponder>\n            <FirstName>{{randomFirstName}}</FirstName>\n            <LastName>{{RandomLastName}}</LastName>\n            <VipLists>{{GetSpecificListForSOAPTests}}</VipLists>\n        </VipMember>\n      </members>\n    </OMembers_ImportBulk>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"60a60235-95b7-434f-8a71-4378e9d125c8"},{"name":"OLists_GetLists","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OLists_GetListsResponse\"][\"OLists_GetListsResult\"][\"VipList\"][0];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OLists_GetLists details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"Name\"]).not.null;\r\n    pm.expect(jsonBody[\"Description\"]).not.null;\r\n});"]}}],"id":"f53e5c13-b28d-4f91-afa1-51e8c7cc6c09","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OLists_GetLists"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OLists_GetLists xmlns=\"http://api.viplus.com/\">\n    </OLists_GetLists>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f53e5c13-b28d-4f91-afa1-51e8c7cc6c09"},{"name":"JLists_GetLists","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"JLists_GetListsResponse\"][\"JLists_GetListsResult\"][\"VipList\"][0];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"JLists_GetLists details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"Name\"]).not.null;\r\n    pm.expect(jsonBody[\"Description\"]).not.null;\r\n});"]}}],"id":"75259d58-2ab2-4da8-8945-b15d45e1cdcd","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/JLists_GetLists"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <JLists_GetLists xmlns=\"http://api.viplus.com/\">\n    </JLists_GetLists>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"75259d58-2ab2-4da8-8945-b15d45e1cdcd"},{"name":"RLists_CreateList","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"RLists_CreateListResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"RLists_CreateList details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"RLists_CreateListResult\"])).to.be.a(\"number\");\r\n});"]}}],"id":"ca4af41d-7bb9-4263-8f0a-bd425272077e","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/RLists_CreateList"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <RLists_CreateList xmlns=\"http://api.viplus.com/\">\n      <name>{{RandomList}}</name>\n    </RLists_CreateList>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"ca4af41d-7bb9-4263-8f0a-bd425272077e"},{"name":"OMembers_UpdateBulk","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OMembers_UpdateBulkResponse\"][\"OMembers_UpdateBulkResult\"][\"VipMember\"];\r\nlet randomEmail = pm.environment.get(\"RandomEmail\");\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OMembers_UpdateBulk details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"RLists_CreateListResult\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.equal(\"OkUpdated\");\r\n    pm.expect(jsonBody[\"ActionOnExists\"]).to.equal(\"Insert\");\r\n    pm.expect(jsonBody[\"Email\"]).to.equal(randomEmail);\r\n    pm.expect(jsonBody[\"FirstName\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"LastName\"]).to.be.a(\"string\");\r\n    pm.expect(Number(jsonBody[\"Cellphone\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"VipLists\"])).to.be.a(\"number\");\r\n});"]}}],"id":"43745bd1-42a7-456d-92bd-1b35487ce84c","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OMembers_UpdateBulk"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OMembers_UpdateBulk xmlns=\"http://api.viplus.com/\">\n      <members>\n        <VipMember>\n        <Id>{{OMembers_UpdateBulkID}}</Id>\n        <ActionOnExists>Insert</ActionOnExists>\n        <Email>{{RandomEmail}}</Email>\n        <SendFirstResponder>true</SendFirstResponder>\n        <FirstName>{{RandomFirstName}}</FirstName>\n        <LastName>{{RandomLastName}}</LastName>\n        <Cellphone>{{RandomCellphone}}</Cellphone>\n        <VipLists>{{GetSpecificListForSOAPTests}}</VipLists>\n        </VipMember>\n      </members>\n    </OMembers_UpdateBulk>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"43745bd1-42a7-456d-92bd-1b35487ce84c"},{"name":"OMembers_Update","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OMembers_UpdateResponse\"][\"OMembers_UpdateResult\"];\r\nlet randomEmail = pm.environment.get(\"RandomEmail\");\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OMembers_Update details is OK\", function() {\r\n    pm.expect(jsonBody[\"Id\"]).not.equal(0);\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.equal(\"OkUpdated\");\r\n    pm.expect(jsonBody[\"ActionOnExists\"]).to.equal(\"Insert\");\r\n    pm.expect(jsonBody[\"Email\"]).to.equal(randomEmail);\r\n    pm.expect(jsonBody[\"FirstName\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"LastName\"]).to.be.a(\"string\");\r\n    pm.expect(Number(jsonBody[\"Cellphone\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"VipLists\"])).to.be.a(\"number\");\r\n});"]}}],"id":"7e69e6b4-1db8-4bdd-894b-20e5aa1501e1","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OMembers_Update"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OMembers_Update xmlns=\"http://api.viplus.com/\">\n      <member>\n        <Id>{{OMembers_UpdateBulkID}}</Id>\n        <ActionOnExists>Insert</ActionOnExists>\n        <Email>{{RandomEmail}}</Email>\n        <FirstName>{{RandomFirstName}}</FirstName>\n        <LastName>{{RandomLastName}}</LastName>\n        <Cellphone>{{RandomCellphone}}</Cellphone>\n        <VipLists>{{GetSpecificListForSOAPTests}}</VipLists>\n      </member>\n    </OMembers_Update>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7e69e6b4-1db8-4bdd-894b-20e5aa1501e1"},{"name":"RMembers_Exists","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"RMembers_ExistsResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"RMembers_Exists details is OK\", function() {\r\n    pm.expect(jsonBody[\"RMembers_ExistsResult\"]).to.equal(\"OkExists\");\r\n});"]}}],"id":"f62a1eb8-5d6f-466e-b1a7-b63703af82f4","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/RMembers_Exists"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <RMembers_Exists xmlns=\"http://api.viplus.com/\">\n      <email>130@smoove.postman.test</email>\n    </RMembers_Exists>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f62a1eb8-5d6f-466e-b1a7-b63703af82f4"},{"name":"OMembers_GetBlackList","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OMembers_GetBlackListResponse\"][\"OMembers_GetBlackListResult\"][\"VipMemberBlackList\"];\r\nif(jsonBody.length > 0)\r\n    jsonBody = jsonBody[0];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OMembers_GetBlackList details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"SubscriptionSource\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"JoinSource\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"Email\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"ReceiveMail\"]).not.to.be.null;\r\n    pm.expect(jsonBody[\"Username\"]).not.to.be.null;\r\n    pm.expect(jsonBody[\"Password\"]).not.to.be.null;\r\n    pm.expect(jsonBody[\"FirstName\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"LastName\"]).to.be.a(\"string\");\r\n    pm.expect(new Date(jsonBody[\"Birthdate\"])).to.be.a(\"date\");\r\n    pm.expect(Number(jsonBody[\"Cellphone\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"VipLists\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"Phone\"]).not.to.be.null;\r\n    pm.expect(jsonBody[\"Address\"]).not.to.be.null;\r\n    pm.expect(jsonBody[\"City\"]).not.to.be.null;\r\n    pm.expect(jsonBody[\"Country\"]).not.to.be.null;\r\n    pm.expect(jsonBody[\"Company\"]).not.to.be.null;\r\n    pm.expect(jsonBody[\"Position\"]).not.to.be.null;\r\n    pm.expect(jsonBody[\"BlackListDate\"]).not.to.be.null;\r\n    pm.expect(Number(jsonBody[\"UnsubscribeReasonType\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"UnsubscribeReasonComment\"]).not.to.be.null;\r\n    pm.expect(jsonBody[\"TimestampSignup\"]).not.to.be.null;\r\n});\r\n"]}}],"id":"073b44b6-21a3-44f6-bb02-af76b0308511","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OMembers_GetBlackList"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OMembers_GetBlackList xmlns=\"http://api.viplus.com/\">>\n      <options>\n        <FromBlacklistDate>2022-02-10T09:56:51.450Z</FromBlacklistDate>\n        <ToBlacklistDate>{{currentDate}}</ToBlacklistDate>\n      </options>\n    </OMembers_GetBlackList>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"073b44b6-21a3-44f6-bb02-af76b0308511"},{"name":"OSmsMessage_Create","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OSmsMessage_CreateResponse\"][\"OSmsMessage_CreateResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OSmsMessage_Create details is OK\", function() {\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.equal(\"OkInserted\");\r\n    pm.expect(jsonBody[\"ApiAction\"]).to.equal(\"Insert\");\r\n    pm.expect(jsonBody[\"ApiGuid\"]).to.be.a(\"string\");\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"SmsContent\"]).to.be.a(\"string\");\r\n    pm.expect(parseInt(jsonBody[\"ToMembers\"][\"VipMember\"][\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ToMembers\"][\"VipMember\"][\"ApiResult\"]).to.eql(\"OkUpdated\");\r\n    pm.expect(jsonBody[\"ToMembers\"][\"VipMember\"][\"ActionOnExists\"]).to.eql(\"Merge\");\r\n    pm.expect(jsonBody[\"ToMembers\"][\"VipMember\"][\"Email\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"ToMembers\"][\"VipMember\"][\"FirstName\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"ToMembers\"][\"VipMember\"][\"LastName\"]).to.be.a(\"string\");\r\n    pm.expect(parseInt(jsonBody[\"ToMembers\"][\"VipMember\"][\"ActionOnExists\"])).to.be.a(\"number\");\r\n});"]}}],"id":"7bf8cfb9-9160-42ae-9c0e-9bd292c411e8","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OSmsMessage_Create"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OSmsMessage_Create xmlns=\"http://api.viplus.com/\">\n      <smsMessage>\n        <SmsContent>SOAP Postman</SmsContent>\n        <ToMembers>\n          <VipMember>\n            <Email>816@smoove.postman.test</Email>\n            <FirstName>Elenor259</FirstName>\n            <LastName>Kilback652</LastName>\n            <Cellphone>3172302402</Cellphone>\n          </VipMember>\n        </ToMembers>\n      </smsMessage>\n    </OSmsMessage_Create>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7bf8cfb9-9160-42ae-9c0e-9bd292c411e8"},{"name":"OGetSubscribersCount","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OGetSubscribersCountResponse\"][\"OGetSubscribersCountResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OGetSubscribersCount details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"OGetSubscribersCountResult\"])).to.be.a(\"number\");\r\n});"]}}],"id":"590e88b4-81f0-4e3e-8194-76d3c347dbfb","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OGetSubscribersCount"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OGetSubscribersCount xmlns=\"http://api.viplus.com/\">\n      <formId>{{OGetSubscribersCountFormId}}</formId>\n    </OGetSubscribersCount>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"590e88b4-81f0-4e3e-8194-76d3c347dbfb"},{"name":"OCampaigns_CreateBulk","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_CreateBulkResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OCampaigns_CreateBulk details is OK\", function() {\r\n    pm.expect(jsonBody[\"OCampaigns_CreateBulkResult\"]).to.be.a(\"string\");\r\n});"]}}],"id":"db05e85b-ec92-4a60-9df4-6c0ead7bc44a","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OCampaigns_CreateBulk"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OCampaigns_CreateBulk xmlns=\"http://api.viplus.com/\">\n      <campaigns>\n        <VipCampaign>\n          <ApiAction>Insert</ApiAction>\n          <Subject>SOAP Postman</Subject>\n          <Body>SOAP Postman</Body>\n        <ToMembers>\n          <VipMember>\n            <Email>816@smoove.postman.test</Email>\n            <FirstName>Elenor259</FirstName>\n            <LastName>Kilback652</LastName>\n            <Cellphone>3172302402</Cellphone>\n          </VipMember>\n        </ToMembers>\n        </VipCampaign>\n      </campaigns>\n    </OCampaigns_CreateBulk>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"db05e85b-ec92-4a60-9df4-6c0ead7bc44a"},{"name":"OCampaigns_Update","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_UpdateResponse\"][\"OCampaigns_UpdateResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OCampaigns_Update details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"ExternalId\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.equal(\"ErrFailed\");\r\n    pm.expect(jsonBody[\"ApiAction\"]).to.equal(\"Insert\");\r\n    pm.expect(jsonBody[\"Subject\"]).to.include(\"Update\");\r\n    pm.expect(jsonBody[\"Body\"]).to.include(\"Update\");\r\n});"]}}],"id":"644601f0-a372-4387-b9cf-0c320bab6337","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OCampaigns_Update"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OCampaigns_Update xmlns=\"http://api.viplus.com/\">\n      <campaign>\n        <Id>{{OCampaigns_GetStatisticsCampaignId}}</Id>\n        <ExternalId>{{OCampaigns_GetStatisticsCampaignId}}</ExternalId>\n        <ApiAction>Insert</ApiAction>\n        <Subject>{{RandomSubject}}</Subject>\n        <Body>{{RandomSubject}}</Body>\n      </campaign>\n    </OCampaigns_Update>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"644601f0-a372-4387-b9cf-0c320bab6337"},{"name":"OCampaigns_GetStatistics","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_GetStatisticsResponse\"][\"OCampaigns_GetStatisticsResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OCampaigns_GetStatistics details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"Campaign\"][\"ApiGuid\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"Campaign\"][\"ExternalId\"]).not.null;\r\n    pm.expect(jsonBody[\"Campaign\"][\"ApiAction\"]).to.equal(\"Insert\");\r\n    pm.expect(new Date(jsonBody[\"SentDate\"])).to.be.a(\"date\");\r\n    pm.expect(jsonBody[\"HowManyWasSent\"]).not.null;\r\n    pm.expect(jsonBody[\"Bounced\"]).not.null;\r\n    pm.expect(jsonBody[\"HowManyWasBouncedSoft\"]).not.null;\r\n    pm.expect(jsonBody[\"HowManyWasBouncedHard\"]).not.null;\r\n    pm.expect(jsonBody[\"HowManyWasWatched\"]).not.null;\r\n    pm.expect(jsonBody[\"Clicked\"]).not.null;\r\n    pm.expect(jsonBody[\"LinksClicked\"]).not.null;\r\n    pm.expect(jsonBody[\"Unsubcribed\"]).not.null;\r\n    pm.expect(jsonBody[\"Resubcribed\"]).not.null;\r\n    pm.expect(jsonBody[\"Abused\"]).not.null;\r\n});"]}}],"id":"676e92c5-daae-43c4-adc2-02eb501db869","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OCampaigns_GetStatistics"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OCampaigns_GetStatistics xmlns=\"http://api.viplus.com/\">\n      <campaignId>{{OCampaigns_GetStatisticsCampaignId}}</campaignId>\n    </OCampaigns_GetStatistics>\n  </soap:Body>\n</soap:Envelope>\n","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"676e92c5-daae-43c4-adc2-02eb501db869"},{"name":"OCampaigns_GetCampaignContactsStatistics","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_GetCampaignContactsStatisticsResponse\"][\"OCampaigns_GetCampaignContactsStatisticsResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OCampaigns_GetStatistics details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"StatisticsForSequence\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"Bounced_contactsIds\"]).not.null;\r\n    pm.expect(jsonBody[\"LinkClicked_contactsIds\"]).not.null;\r\n    pm.expect(parseInt(jsonBody[\"Watched_contactsIds\"][\"int\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"Unsubscribed_contactsIds\"]).not.null;\r\n    pm.expect(jsonBody[\"Sequence\"]).to.be.a(\"string\");\r\n});"]}}],"id":"4eac93fe-a846-49ba-b83d-a4df337d0a9e","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OCampaigns_GetCampaignContactsStatistics"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OCampaigns_GetCampaignContactsStatistics xmlns=\"http://api.viplus.com/\">\n      <campaignId>{{OCampaigns_GetStatisticsCampaignId}}</campaignId>\n      <sequence>string</sequence>\n    </OCampaigns_GetCampaignContactsStatistics>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"4eac93fe-a846-49ba-b83d-a4df337d0a9e"},{"name":"RLists_Clear","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"RLists_ClearResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\n// this method works only for siteIds: 20175,19100.\r\npm.test(\"RLists_Clear details is OK\", function() {\r\n    pm.expect(jsonBody[\"RLists_ClearResult\"]).to.equal(\"ErrAccount\");\r\n});"]}}],"id":"9f28b821-2bea-4f4e-a895-178313fd13c0","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/RLists_Clear"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <RLists_Clear xmlns=\"http://api.viplus.com/\">\n        <SiteId>{{RLists_ClearSiteId}}</SiteId>\n        <lists>{{GetSpecificList}}</lists>\n    </RLists_Clear>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9f28b821-2bea-4f4e-a895-178313fd13c0"},{"name":"HasRecaptcha","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"HasRecaptchaResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"HasRecaptcha details is OK\", function() {\r\n    pm.expect(jsonBody[\"HasRecaptchaResult\"]).to.equal(\"true\");\r\n});"]}}],"id":"34195945-bee0-4a12-8152-5e6978a638d2","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/HasRecaptcha"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <HasRecaptcha xmlns=\"http://api.viplus.com/\">\n      <formId>{{HasRecaptchaFormId}}</formId>\n    </HasRecaptcha>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"34195945-bee0-4a12-8152-5e6978a638d2"},{"name":"RMembers_Update","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"RMembers_UpdateResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"RMembers_Update details is OK\", function() {\r\n    pm.expect(jsonBody[\"RMembers_UpdateResult\"]).to.equal(\"ErrNotValid\");\r\n});"]}}],"id":"1b0c88de-36eb-431f-8f9d-cc739f82637d","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/RMembers_Update"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <RMembers_Update xmlns=\"http://api.viplus.com/\">\n      <member>\n        <Id>{{OMembers_UpdateBulkID}}</Id>\n        <ActionOnExists>Insert</ActionOnExists>\n        <Email>116@smoove.postman.test</Email>\n        <FirstName>{{RandomFirstName}}</FirstName>\n        <LastName>{{RandomLastName}}</LastName>\n        <Cellphone>{{RandomCellphone}}</Cellphone>\n      </member>\n    </RMembers_Update>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"1b0c88de-36eb-431f-8f9d-cc739f82637d"},{"name":"IsLgPublished","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"IsLgPublishedResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"IsLgPublished details is OK\", function() {\r\n    pm.expect(jsonBody[\"IsLgPublishedResult\"]).not.null;\r\n    pm.expect(jsonBody[\"IsLgPublishedResult\"]).to.equal(\"true\");\r\n});"]}}],"id":"e0e2ac9b-d477-4322-8d44-dab5ae96a98f","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/IsLgPublished"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <IsLgPublished xmlns=\"http://api.viplus.com/\">\n      <formId>{{OGetSubscribersCountFormId}}</formId>\n    </IsLgPublished>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e0e2ac9b-d477-4322-8d44-dab5ae96a98f"},{"name":"OCampaigns_Create","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_CreateResponse\"][\"OCampaigns_CreateResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OCampaigns_Create details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ApiGuid\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"ExternalId\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.equal(\"OkInserted\");\r\n    pm.expect(jsonBody[\"ApiAction\"]).to.equal(\"Insert\");\r\n    pm.expect(jsonBody[\"Subject\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"Body\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"TrackLinks\"]).not.null;\r\n    pm.expect(jsonBody[\"From\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"ReplyTo\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"SenderMail\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"ToEmails\"]).not.null;\r\n    pm.expect(jsonBody[\"ToMembers\"]).not.null;\r\n    pm.expect(jsonBody[\"ToLists\"]).not.null;\r\n    pm.expect(parseInt(jsonBody[\"ToLists\"][\"VipList\"][\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(new Date(jsonBody[\"SendDate\"])).to.be.a(\"date\");\r\n});"]}}],"id":"286e6a4b-9fc1-42ea-9a96-5625b37f4a52","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OCampaigns_Create"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n<soap:Body>\n<OCampaigns_Create xmlns=\"http://api.viplus.com/\">\n    <campaign>\n        <ApiGuid>bcd2cde9-3368-4562-82d0-df7945c537ce</ApiGuid>\n        <ExternalId>AutomatedCampaign</ExternalId>\n        <ApiAction>Insert</ApiAction>\n        <Subject>SOAP request by ViplusApi Postman</Subject>\n        <Body>Email's body</Body>\n        <From>automationtests@smoove.io</From>\n        <ReplyTo>dev@smoove.io</ReplyTo>\n        <SenderMail>automationtests@smoove.io</SenderMail>\n        <ToLists>\n            <VipList>\n                <Id>{{OCampaigns_CreateListId}}</Id>\n            </VipList>\n        </ToLists>\n        <SendDate>{{currentDate}}</SendDate>\n      </campaign>\n    </OCampaigns_Create>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"286e6a4b-9fc1-42ea-9a96-5625b37f4a52"},{"name":"RCampaign_Create","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"RCampaign_CreateResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"RCampaign_Create details is OK\", function() {\r\n    pm.expect(jsonBody[\"RCampaign_CreateResult\"]).to.equal(\"OkInserted\");\r\n});"]}}],"id":"63a10770-2b6a-4f91-a6c3-6899224443dd","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/RCampaign_Create"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <RCampaign_Create xmlns=\"http://api.viplus.com/\">\n    </RCampaign_Create>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx?apiresult=Null&apiguid=5ec95771-d4fa-4568-825d-dcc15677a7c8&externalid=string&externalunsubsribeurl=string&apiaction=Insert&apiunsubscribemode=None&subject=Subject&body=Email%27s%20body&tracklinks=true&from=automationtests%40smoove.io&replyto=dev%40smoove.io&sendermail=automationtests%40smoove.io&toemails={{RandomEmail}}&senddate=2022-02-10T09%3A56%3A51.452Z","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[{"key":"apiresult","value":"Null"},{"key":"apiguid","value":"4e975e40-230a-438c-880a-4c19335df953"},{"key":"externalid","value":"string"},{"key":"externalunsubsribeurl","value":"string"},{"key":"apiaction","value":"Insert"},{"key":"apiunsubscribemode","value":"None"},{"key":"subject","value":"Subject"},{"key":"body","value":"Email%27s%20body"},{"key":"tracklinks","value":"true"},{"key":"from","value":"automationtests%40smoove.io"},{"key":"replyto","value":"dev%40smoove.io"},{"key":"sendermail","value":"automationtests%40smoove.io"},{"key":"toemails","value":"{{RandomEmail}}"},{"key":"senddate","value":"2022-02-10T09%3A56%3A51.452Z"}],"variable":[]}},"response":[],"_postman_id":"63a10770-2b6a-4f91-a6c3-6899224443dd"},{"name":"OGetFacebookForm","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OGetFacebookFormResponse\"][\"OGetFacebookFormResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OGetFacebookForm details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"SiteId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"FormId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"ToLists\"][\"VipList\"][\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"AccountSenderEmail\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"FormTitle\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"FormTemplateData\"]).to.be.a(\"string\");\r\n});"]}}],"id":"e2208c9b-b9e6-4842-9fe3-e5a4b9a0a924","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OGetFacebookForm"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OGetFacebookForm xmlns=\"http://api.viplus.com/\">\n      <formId>{{OGetSubscribersCountFormId}}</formId>\n    </OGetFacebookForm>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e2208c9b-b9e6-4842-9fe3-e5a4b9a0a924"},{"name":"OGetFacebookFormWithContactEId","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OGetFacebookFormWithContactEIdResponse\"][\"OGetFacebookFormWithContactEIdResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OGetFacebookFormWithContactEId details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"SiteId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"FormId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"ToLists\"][\"VipList\"][\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"AccountSenderEmail\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"FormTitle\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"FormTemplateData\"]).to.be.a(\"string\");\r\n});"]}}],"id":"9659136b-b0e6-4cce-8f9c-2c32d9697459","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OGetFacebookFormWithContactEId"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OGetFacebookFormWithContactEId xmlns=\"http://api.viplus.com/\">\n            <contactEId></contactEId>\n            <formId>{{OGetSubscribersCountFormId}}</formId>\n    </OGetFacebookFormWithContactEId>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9659136b-b0e6-4cce-8f9c-2c32d9697459"},{"name":"OCampaigns_CreateFromTemplate","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_CreateFromTemplateResponse\"][\"OCampaigns_CreateFromTemplateResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OCampaigns_CreateFromTemplate details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ApiGuid\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.eql(\"OkInserted\");\r\n    pm.expect(jsonBody[\"ApiAction\"]).to.eql(\"Merge\");\r\n    pm.expect(jsonBody[\"Body\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"Subject\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"From\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"ReplyTo\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"SenderMail\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"ToEmails\"]).not.null;\r\n    pm.expect(jsonBody[\"ToMembers\"]).not.null;\r\n    pm.expect(jsonBody[\"ToLists\"]).not.null;\r\n});"]}}],"id":"a6be71f8-2a28-438e-824a-3fbed5269a81","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OCampaigns_CreateFromTemplate"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OCampaigns_CreateFromTemplate xmlns=\"http://api.viplus.com/\">\n      <campaign>\n        <ApiGuid>ce5b09c9-30a6-4aec-ad13-4fb7746b9532</ApiGuid>\n        <ApiAction>Merge</ApiAction>\n        <Subject>{{CreateTemplate}}</Subject>\n        <Body>SOAP Postman Body</Body>\n        <From>automationtests@smoove.io</From>\n        <ReplyTo>dev@smoove.io</ReplyTo>\n        <SenderMail>automationtests@smoove.io</SenderMail>automationtests\n      </campaign>\n      <templateName>{{OCampaigns_CreateFromTemplateName}}</templateName>\n      <customData/>\n    </OCampaigns_CreateFromTemplate>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a6be71f8-2a28-438e-824a-3fbed5269a81"},{"name":"XCampaigns_TemplatesList","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"OCampaigns_TemplatesList details are OK\", function() {\r\n    let currentEnvironment = pm.environment.name;\r\n    console.log(\"Current environment: \" + currentEnvironment);\r\n    \r\n    pm.response.to.have.status(200);\r\n    \r\n    if (currentEnvironment === \"Smoove-DEV\") {\r\n    } else if (currentEnvironment === \"Smoove-PROD\") {\r\n        let jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"XCampaigns_TemplatesListResponse\"][\"XCampaigns_TemplatesListResult\"][\"Templates\"][\"Template\"];\r\n        pm.expect(jsonBody[\"Id\"]).not.null;\r\n    }\r\n});"]}}],"id":"16a12594-0c8c-4f7a-800b-5fe0d1010e37","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/XCampaigns_TemplatesList"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <XCampaigns_TemplatesList xmlns=\"http://api.viplus.com/\"/>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"16a12594-0c8c-4f7a-800b-5fe0d1010e37"},{"name":"JCampaigns_TemplatesList","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"OCampaigns_TemplatesList details are OK\", function() {\r\n    let currentEnvironment = pm.environment.name;\r\n    console.log(\"Current environment: \" + currentEnvironment);\r\n    \r\n    pm.response.to.have.status(200);\r\n    \r\n    if (currentEnvironment === \"Smoove-DEV\") {\r\n    } else if (currentEnvironment === \"Smoove-PROD\") {\r\n        let jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"JCampaigns_TemplatesListResponse\"];\r\n        pm.expect(jsonBody[\"JCampaigns_TemplatesListResult\"]).not.null;\r\n    }\r\n});"]}}],"id":"442a24cd-cc93-4a5e-ace8-2c14c12d3490","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/JCampaigns_TemplatesList"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <JCampaigns_TemplatesList xmlns=\"http://api.viplus.com/\"/>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"442a24cd-cc93-4a5e-ace8-2c14c12d3490"},{"name":"OCampaigns_TemplatesList","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"OCampaigns_TemplatesList details are OK\", function() {\r\n    let currentEnvironment = pm.environment.name;\r\n    console.log(\"Current environment: \" + currentEnvironment);\r\n    \r\n    pm.response.to.have.status(200);\r\n    \r\n    if (currentEnvironment === \"Smoove-DEV\") {\r\n    } else if (currentEnvironment === \"Smoove-PROD\") {\r\n        let jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_TemplatesListResponse\"][\"OCampaigns_TemplatesListResult\"][\"VipTemplates\"];\r\n        pm.expect(jsonBody[\"Id\"]).not.null;\r\n    }\r\n});"]}}],"id":"1253fcc6-3a4e-4533-9dda-031c8f00eaa9","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OCampaigns_TemplatesList"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OCampaigns_TemplatesList xmlns=\"http://api.viplus.com/\">\n    </OCampaigns_TemplatesList>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"1253fcc6-3a4e-4533-9dda-031c8f00eaa9"},{"name":"OACampaigns_SetAsWatched","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OACampaigns_SetAsWatchedResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OACampaigns_SetAsWatched details is OK\", function() {\r\n    pm.expect(jsonBody[\"OACampaigns_SetAsWatchedResult\"]).not.null;\r\n    pm.expect(jsonBody[\"OACampaigns_SetAsWatchedResult\"]).to.equal(\"true\");\r\n});"]}}],"id":"67b96f4e-2237-4509-b3e9-b15cf46fd6fd","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OACampaigns_SetAsWatched"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OACampaigns_SetAsWatched xmlns=\"http://api.viplus.com/\">\n      <messageId>{{MessageIdSOAP}}</messageId>\n    </OACampaigns_SetAsWatched>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"67b96f4e-2237-4509-b3e9-b15cf46fd6fd"},{"name":"ActiveCrmMails","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"ActiveCrmMailsResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"ActiveCrmMails details is OK\", function() {\r\n    pm.expect(jsonBody[\"ActiveCrmMailsResult\"]).to.equal(\"true\");\r\n});"]}}],"id":"3018a316-e31d-45c3-83b1-b54c8f436485","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/ActiveCrmMails"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <ActiveCrmMails xmlns=\"http://api.viplus.com/\">\n      <campaigns>\n        <VipCampaign>\n            <ApiResult>Null</ApiResult>\n            <ApiGuid>0af6979e-3cdc-4410-913a-4f0204e724ed</ApiGuid>\n            <ApiAction>Insert</ApiAction>\n            <ApiUnsubscribeMode>None</ApiUnsubscribeMode>\n            <Subject>Subject</Subject>\n            <Body>Email's body</Body>\n            <From>automationtests@smoove.io</From>\n            <ReplyTo>dev@smoove.io</ReplyTo>\n            <SenderMail>automationtests@smoove.io</SenderMail>automationtests\n            <ToEmails><string>{{RandomEmail}}</string></ToEmails>\n            <SendDate>{{currentDate}}</SendDate>\n        </VipCampaign>\n      </campaigns>\n    </ActiveCrmMails>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3018a316-e31d-45c3-83b1-b54c8f436485"},{"name":"OGetFacebookFormWithContactEIdAndRef","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OGetFacebookFormWithContactEIdAndRefResponse\"][\"OGetFacebookFormWithContactEIdAndRefResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OGetFacebookFormWithContactEIdAndRef details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"SiteId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"FormId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"ToLists\"][\"VipList\"][\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"AccountSenderEmail\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"FormTitle\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"FormTemplateData\"]).to.be.a(\"string\");\r\n});"]}}],"id":"1e1789d9-0982-4922-ad4f-b33dca3a711b","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OGetFacebookFormWithContactEIdAndRef"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OGetFacebookFormWithContactEIdAndRef xmlns=\"http://api.viplus.com/\">\n        <contactEId></contactEId>\n        <formId>{{OGetSubscribersCountFormId}}</formId>\n    </OGetFacebookFormWithContactEIdAndRef>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"1e1789d9-0982-4922-ad4f-b33dca3a711b"},{"name":"OGetFacebookFormWithMemberData","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OGetFacebookFormWithMemberDataResponse\"][\"OGetFacebookFormWithMemberDataResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OGetFacebookFormWithMemberData details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"SiteId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"FormId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"ToLists\"][\"VipList\"][\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"AccountSenderEmail\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"FormTitle\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"FormTemplateData\"]).to.be.a(\"string\");\r\n});"]}}],"id":"cc97c3d3-5f36-4b6b-b08a-7cbdf0d880c5","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OGetFacebookFormWithMemberData"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OGetFacebookFormWithMemberData xmlns=\"http://api.viplus.com/\">\n      <formId>{{HasRecaptchaFormId}}</formId>\n      <member>\n        <ActionOnExists>Insert</ActionOnExists>\n      </member>\n    </OGetFacebookFormWithMemberData>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"cc97c3d3-5f36-4b6b-b08a-7cbdf0d880c5"},{"name":"OGetFacebookFormUrlConnections","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OGetFacebookFormUrlConnectionsResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OGetFacebookFormWithMemberData details is OK\", function() {\r\n    pm.expect(jsonBody[\"OGetFacebookFormUrlConnectionsResult\"]).not.null;\r\n});"]}}],"id":"3c3292b5-ac98-4e9d-8a8c-e0878873202d","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OGetFacebookFormUrlConnections"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OGetFacebookFormUrlConnections xmlns=\"http://api.viplus.com/\">\n      <siteId>{{OGetFacebookFormUrlConnectionsSiteId}}</siteId>\n      <formId>{{HasRecaptchaFormId}}</formId>\n    </OGetFacebookFormUrlConnections>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3c3292b5-ac98-4e9d-8a8c-e0878873202d"},{"name":"OACampaigns_GetBody","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OACampaigns_GetBodyResponse\"][\"OACampaigns_GetBodyResult\"];\r\nlet randomEmail = pm.environment.get(\"RandomEmail\");\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OACampaigns_GetBody details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ApiAction\"]).to.eql(\"Insert\");\r\n    pm.expect(jsonBody[\"Subject\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"Body\"]).to.be.a(\"string\");\r\n    pm.expect(new Date(jsonBody[\"SendDate\"])).to.be.a(\"date\");\r\n    pm.expect(jsonBody[\"ContentType\"]).to.be.a(\"string\");\r\n});"]}}],"id":"3fc0272e-335d-4f01-91f4-a3d68843bd26","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OACampaigns_GetBody"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OACampaigns_GetBody xmlns=\"http://api.viplus.com/\">\n        <ApiGuid>13559b6b-072b-43cd-a44b-963a3591e2fc</ApiGuid>\n        <ApiResult>Null</ApiResult>\n        <ApiAction>Insert</ApiAction>\n      <messageId>{{MessageIdSOAP}}</messageId>\n    </OACampaigns_GetBody>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3fc0272e-335d-4f01-91f4-a3d68843bd26"},{"name":"OCampaigns_Delete","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_DeleteResponse\"];\r\nlet randomEmail = pm.environment.get(\"RandomEmail\");\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OCampaigns_Delete details is OK\", function() {\r\n    pm.expect(jsonBody[\"OCampaigns_DeleteResult\"]).to.eql(\"true\")\r\n});"]}}],"id":"04e877bf-825e-49d6-86de-de1db909611b","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OCampaigns_Delete"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OCampaigns_Delete xmlns=\"http://api.viplus.com/\">\n      <campaign>\n        <ExternalId>{{campaignId}}</ExternalId>\n        <ApiAction>Update</ApiAction>\n      </campaign>\n    </OCampaigns_Delete>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"04e877bf-825e-49d6-86de-de1db909611b"},{"name":"OGetFacebookForms","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OGetFacebookFormsResponse\"][\"OGetFacebookFormsResult\"][\"VipFacebook\"][0];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OGetFacebookForms details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"SiteId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"FormId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"ToLists\"][\"VipList\"][\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"AccountSenderEmail\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"FormTitle\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"FormTemplateData\"]).to.be.a(\"string\");\r\n});"]}}],"id":"d8216dab-ec62-4ebd-9d64-5611b44d3967","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OGetFacebookForms"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OGetFacebookForms xmlns=\"http://api.viplus.com/\">\n      <formType>LP</formType>\n    </OGetFacebookForms>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d8216dab-ec62-4ebd-9d64-5611b44d3967"},{"name":"RSSetFacebookPageId","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"RSSetFacebookPageIdResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"RSSetFacebookPageId details is OK\", function() {\r\n    pm.expect(jsonBody[\"RSSetFacebookPageIdResult\"]).to.equal(\"true\");\r\n});"]}}],"id":"56de4d41-8883-4baf-bf37-78e5144fc465","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/RSSetFacebookPageId"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <RSSetFacebookPageId xmlns=\"http://api.viplus.com/\">\n      <pageId>string</pageId>\n    </RSSetFacebookPageId>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{FacebookFormSOAP}}.asmx","urlObject":{"path":["Gates","Ws-{{FacebookFormSOAP}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"56de4d41-8883-4baf-bf37-78e5144fc465"},{"name":"RMembers_Export","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"RMembers_ExportResponse\"][\"RMembers_ExportResult\"][\"VipMember\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"RSSetFacebookPageId details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ActionOnExists\"]).to.equal(\"Insert\");\r\n    pm.expect(jsonBody[\"Email\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"Username\"]).not.null;\r\n    pm.expect(jsonBody[\"Password\"]).not.null;\r\n    pm.expect(jsonBody[\"FirstName\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"LastName\"]).to.be.a(\"string\");\r\n    pm.expect(parseInt(jsonBody[\"Phone\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"Cellphone\"]).not.null;\r\n    pm.expect(jsonBody[\"Address\"]).not.null;\r\n    pm.expect(jsonBody[\"City\"]).not.null;\r\n    pm.expect(jsonBody[\"Country\"]).not.null;\r\n    pm.expect(jsonBody[\"Company\"]).not.null;\r\n    pm.expect(jsonBody[\"Position\"]).not.null;\r\n    pm.expect(jsonBody[\"VipLists\"]).not.null;\r\n    pm.expect(jsonBody[\"Extrainfo\"]).not.null;\r\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","exec":["pm.sendRequest('https://api.ipify.org?format=json', function (err, res) {\r\n    if (err) { \r\n        console.error(err);\r\n    } else {\r\n        const ip = res.json().ip;\r\n        const environmentName = pm.environment.name;\r\n        console.log(`IP: ${ip}, Environment: ${environmentName}`);\r\n\r\n        const jenkinsIps = ['82.81.86.33', '82.81.86.35', '82.81.86.37'];\r\n        pm.environment.set(\"tempApiKey\", pm.environment.get('soapLimitToIpForAutomationTests'));\r\n        if(jenkinsIps.includes(ip) && ['Smoove-DEV','Smoove-PROD'].includes(environmentName)){\r\n            console.log(\"Setting special key \"+ pm.environment.get('soapLimitToIpJenkinsForAutomationTests'));\r\n            pm.environment.set(\"tempApiKey\", pm.environment.get('soapLimitToIpJenkinsForAutomationTests'));\r\n        }\r\n            \r\n    }\r\n});"]}}],"id":"aba6d26d-dc5c-4836-9cd3-e0f6006cc703","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/RMembers_Export"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <RMembers_Export xmlns=\"http://api.viplus.com/\">\n        <VipMember>\n          <ActionOnExists>Merge</ActionOnExists>\n          <Email>112@smoove.postman.test</Email>\n        </VipMember>\n    </RMembers_Export>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{tempApiKey}}.asmx","urlObject":{"path":["Gates","Ws-{{tempApiKey}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"aba6d26d-dc5c-4836-9cd3-e0f6006cc703"},{"name":"OMembers_Export","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OMembers_ExportResponse\"][\"OMembers_ExportResult\"][\"VipMember\"][0];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OMembers_Export details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ActionOnExists\"]).to.equal(\"Insert\");\r\n    pm.expect(jsonBody[\"Email\"]).to.include(\"@\");\r\n    pm.expect(jsonBody[\"Username\"]).not.null;\r\n    pm.expect(jsonBody[\"Password\"]).not.null;\r\n    pm.expect(jsonBody[\"FirstName\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"LastName\"]).to.be.a(\"string\");\r\n    pm.expect(parseInt(jsonBody[\"Phone\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"Cellphone\"]).not.null;\r\n    pm.expect(jsonBody[\"Address\"]).not.null;\r\n    pm.expect(jsonBody[\"City\"]).not.null;\r\n    pm.expect(jsonBody[\"Country\"]).not.null;\r\n    pm.expect(jsonBody[\"Company\"]).not.null;\r\n    pm.expect(jsonBody[\"Position\"]).not.null;\r\n    pm.expect(jsonBody[\"VipLists\"]).not.null;\r\n    pm.expect(jsonBody[\"Extrainfo\"]).not.null;\r\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","exec":["pm.sendRequest('https://api.ipify.org?format=json', function (err, res) {\r\n    if (err) { \r\n        console.error(err);\r\n    } else {\r\n        const ip = res.json().ip;\r\n        const environmentName = pm.environment.name;\r\n        console.log(`IP: ${ip}, Environment: ${environmentName}`);\r\n\r\n        const jenkinsIps = ['82.81.86.33', '82.81.86.35', '82.81.86.37'];\r\n        pm.environment.set(\"tempApiKey\", pm.environment.get('soapLimitToIpForAutomationTests'));\r\n        if(jenkinsIps.includes(ip) && ['Smoove-DEV','Smoove-PROD'].includes(environmentName))\r\n            pm.environment.set(\"tempApiKey\", pm.environment.get('soapLimitToIpJenkinsForAutomationTests'));\r\n    }\r\n});"]}}],"id":"a14014a4-0502-4b1b-b78f-5610670bc41f","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OMembers_Export"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OMembers_Export xmlns=\"http://api.viplus.com/\">\n      <withGroups>true</withGroups>\n      <retrieveCount>100</retrieveCount>\n      <lastContactIdRetrieved>100</lastContactIdRetrieved>\n      <onlyWhenOverlappingInGroups>true</onlyWhenOverlappingInGroups>\n      <listIds/>\n    </OMembers_Export>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{tempApiKey}}.asmx","urlObject":{"path":["Gates","Ws-{{tempApiKey}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a14014a4-0502-4b1b-b78f-5610670bc41f"},{"name":"AtpOP","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"AtpOPResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"AtpOP details is OK\", function() {\r\n    pm.expect(jsonBody[\"AtpOPResult\"]).to.include(\"AtpOP.Contact.NotInBlacklist\");\r\n});"]}}],"id":"d9060ad5-bc63-40e4-a6b4-f696e66e174c","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/AtpOP"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <AtpOP xmlns=\"http://api.viplus.com/\">\n      <opData>{{AtpOP}}</opData>\n    </AtpOP>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d9060ad5-bc63-40e4-a6b4-f696e66e174c"},{"name":"JMembers_Import","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"JMembers_ImportResponse\"][\"JMembers_ImportResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Contact details\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.equal(\"ErrNotValid\");\r\n    pm.expect(jsonBody[\"ActionOnExists\"]).to.equal(\"Insert\");\r\n    pm.expect(jsonBody[\"ReceiveMail\"]).not.null;\r\n    pm.expect(jsonBody[\"ReceiveSms\"]).not.null;\r\n});"]}}],"id":"a43a6d56-b529-4463-81f5-b1151856804b","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml"},{"key":"SOAPAction","value":"http://api.viplus.com/JMembers_Import"}],"body":{"mode":"raw","raw":"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n  <!-- This function doesn't really work, so we just assume it'll get HTTP status code 200 and an 'ApiResult' of 'ErrNotValid' -->\n{\n    \"actionOnExists\": \"Merge\",\n    \"actionOnRestore\": \"Ignore\",\n    \"sendMailToAdmin\": true,\n    \"email\": \"128@smoove.postman.test\",\n    \"receiveMail\":true,\n    \"receiveSms\":true,\n    \"sendFirstResponder\":true\n}\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a43a6d56-b529-4463-81f5-b1151856804b"},{"name":"RSmsMessage_Create","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"RSmsMessage_CreateResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"RSmsMessage_Create details is OK\", function() {\r\n    pm.expect(jsonBody[\"RSmsMessage_CreateResult\"]).to.equal(\"OkSent\");\r\n});"]}}],"id":"b93958f4-f297-4a17-bca2-d3669e37356b","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/RSmsMessage_Create"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <RSmsMessage_Create xmlns=\"http://api.viplus.com/\">\n    </RSmsMessage_Create>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx?content=Smoove Postman tests&from=SmooveAutomation&externalid=automation&tocells=3172302402","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[{"key":"content","value":"Smoove Postman tests"},{"key":"from","value":"SmooveAutomation"},{"key":"externalid","value":"automation"},{"key":"tocells","value":"3172302402"}],"variable":[]}},"response":[],"_postman_id":"b93958f4-f297-4a17-bca2-d3669e37356b"},{"name":"RCampaigns_CreateMail2Friend","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"RCampaigns_CreateMail2FriendResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"RCampaigns_CreateMail2Friend details is OK\", function() {\r\n    pm.expect(jsonBody[\"RCampaigns_CreateMail2FriendResult\"]).to.equal(\"OkQueued\");\r\n});"]}}],"id":"88e00359-c5fd-4370-99ba-d42b7eee262d","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/RCampaigns_CreateMail2Friend"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <RCampaigns_CreateMail2Friend xmlns=\"http://api.viplus.com/\">\n      <messageId>{{MessageIdSOAP}}</messageId>\n      <opData>{{RCampaigns_CreateMail2FriendOpData}}</opData>\n    </RCampaigns_CreateMail2Friend>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"88e00359-c5fd-4370-99ba-d42b7eee262d"},{"name":"CCampaigns_CreateBulk","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nconsole.log(jsonResponse);\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"CCampaigns_CreateBulkResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"CCampaigns_CreateBulk details is OK\", function() {\r\n    pm.expect(jsonBody[\"CCampaigns_CreateBulkResult\"]).to.be.a(\"string\");\r\n});"]}}],"id":"346536ad-1156-4c01-81bc-51391f0104bd","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/CCampaigns_CreateBulk"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <CCampaigns_CreateBulk xmlns=\"http://api.viplus.com/\">\n      <campaigns64>{{CCampaigns_CreateBulkCampaigns64}}</campaigns64>\n    </CCampaigns_CreateBulk>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"346536ad-1156-4c01-81bc-51391f0104bd"},{"name":"GetAccountDetails","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"GetAccountDetailsResponse\"][\"GetAccountDetailsResult\"][\"DataBag\"];\r\nlet jsonResponseBody = jsonBody[\"accountNotifications\"][\"DataBag\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"GetAccountDetails details is OK\", function() {\r\n    pm.expect(jsonResponseBody[\"Language\"]).to.equal(\"he-IL\");\r\n    pm.expect(jsonResponseBody[\"UserName\"]).not.null;\r\n    pm.expect(jsonResponseBody[\"FirstName\"]).to.be.a(\"string\");\r\n    pm.expect(jsonResponseBody[\"LastName\"]).to.be.a(\"string\");\r\n    pm.expect(jsonResponseBody[\"Sender\"]).to.include(\"@\");\r\n    pm.expect(jsonResponseBody[\"Reply\"]).to.include(\"@\");\r\n    pm.expect(jsonResponseBody[\"Subscriptions\"]).not.null;\r\n    pm.expect(jsonResponseBody[\"Unsubscriptions\"]).not.null;\r\n    pm.expect(jsonResponseBody[\"ContactUpdate\"]).not.null;\r\n    pm.expect(jsonResponseBody[\"NotifyQuotaExceeded\"]).not.null;\r\n    pm.expect(jsonResponseBody[\"ResellerId\"]).not.null;\r\n    pm.expect(jsonBody[\"senderEmail\"]).to.include(\"@\");\r\n});"]}}],"id":"d6daa55d-791c-4f22-bb55-f169f6a722d6","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/GetAccountDetails"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <GetAccountDetails xmlns=\"http://api.viplus.com/\">\n      <siteID>{{OGetFacebookFormUrlConnectionsSiteId}}</siteID>\n    </GetAccountDetails>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d6daa55d-791c-4f22-bb55-f169f6a722d6"},{"name":"OMembers_Unsubscribe","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OMembers_UnsubscribeResponse\"][\"OMembers_UnsubscribeResult\"];\r\nlet emailAddress = \"449@smoove.postman.test\";\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OMembers_Unsubscribe details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.equal(\"OkInserted\");\r\n    pm.expect(jsonBody[\"ActionOnExists\"]).to.equal(\"Insert\");\r\n    pm.expect(jsonBody[\"Email\"]).to.include(\"@\");\r\n});"]}}],"id":"bbd8dad7-871b-4b49-90b7-cc3fd3e82d86","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OMembers_Unsubscribe"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OMembers_Unsubscribe xmlns=\"http://api.viplus.com/\">\n      <email>449@smoove.postman.test</email>\n    </OMembers_Unsubscribe>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"bbd8dad7-871b-4b49-90b7-cc3fd3e82d86"},{"name":"RMembers_Unsubscribe","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"RMembers_UnsubscribeResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"RMembers_Unsubscribe details is OK\", function() {\r\n    pm.expect(jsonBody[\"RMembers_UnsubscribeResult\"]).to.equal(\"OkInserted\");\r\n});"]}}],"id":"160ae63b-04d1-453d-af98-755ffcb3e568","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/RMembers_Unsubscribe"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <RMembers_Unsubscribe xmlns=\"http://api.viplus.com/\">\n      <email>claudie88@smoove.postman.test</email>\n    </RMembers_Unsubscribe>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"160ae63b-04d1-453d-af98-755ffcb3e568"},{"name":"OMembers_Resubscribe","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OMembers_ResubscribeResponse\"][\"OMembers_ResubscribeResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OMembers_Resubscribe details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.equal(\"OkInserted\");\r\n    pm.expect(jsonBody[\"ActionOnExists\"]).to.equal(\"Insert\");\r\n    pm.expect(jsonBody[\"Email\"]).to.include(\"@\");\r\n});"]}}],"id":"b42caa61-07df-4f4d-a78c-59e35eda808f","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OMembers_Resubscribe"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OMembers_Resubscribe xmlns=\"http://api.viplus.com/\">\n        <ActionOnExists>Merge</ActionOnExists>\n        <ActionOnRestore>Ignore</ActionOnRestore>\n        <email>449@smoove.postman.test</email>\n    </OMembers_Resubscribe>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"b42caa61-07df-4f4d-a78c-59e35eda808f"},{"name":"OGetApplicationForm","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OGetApplicationFormResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OGetApplicationForm details is OK\", function() {\r\n    pm.expect(jsonBody).not.null;\r\n});"]}}],"id":"0be3fb86-b604-4d71-a28d-4650ecc76cd9","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OGetApplicationForm"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OGetApplicationForm xmlns=\"http://api.viplus.com/\">\n      <appType>{{AtpOP}}</appType>\n      <appMainKey>{{restApiKeyForAutomationTests}}</appMainKey>\n    </OGetApplicationForm>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"0be3fb86-b604-4d71-a28d-4650ecc76cd9"},{"name":"OGetApplicationFormNoSite","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OGetApplicationFormNoSiteResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OGetApplicationFormNoSiteResponse details is OK\", function() {\r\n    pm.expect(jsonBody).not.null;\r\n});"]}}],"id":"abdcb659-a2f5-498e-b68a-24cc099e3562","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OGetApplicationFormNoSite"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OGetApplicationFormNoSite xmlns=\"http://api.viplus.com/\">\n      <opData>{{AtpOP}}</opData>\n    </OGetApplicationFormNoSite>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"abdcb659-a2f5-498e-b68a-24cc099e3562"},{"name":"OCampaigns_RegisterContactsToCampaign","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["var uuid = require('uuid');\r\nvar moment = require('moment');\r\n\r\nconst guid = uuid.v4();\r\nlet list = '-677639';\r\nconst currentDate = moment().toISOString();\r\nconst url = pm.environment.get('WsGateSoapBaseUrl') + '/Gates/Ws-' + pm.environment.get('restApiKeyForAutomationTests') + '.asmx';\r\n\r\nlet soapBody = \r\n`<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001 XMLSchema\">\r\n    <soap:Body>\r\n        <OCampaigns_Create xmlns=\"http://api.viplus.com/\">\r\n            <campaign>\r\n                <ApiGuid>` + guid + `</ApiGuid>\r\n                <ExternalId>AutomatedCampaign</ExternalId>\r\n                <ApiAction>Insert</ApiAction>\r\n                <Subject>SOAP request by ViplusApi Postman</Subject>\r\n                <Body>Email's body</Body>\r\n                <From>automationtests@smoove.io</From>\r\n                <ReplyTo>dev@smoove.io</ReplyTo>\r\n                <SenderMail>automationtests@smoove.io</SenderMail>\r\n                <ToLists>\r\n                    <VipList>\r\n                        <Id>` + list +`</Id>\r\n                    </VipList>\r\n                </ToLists>\r\n                <SendDate>` + currentDate +`</SendDate>\r\n            </campaign>\r\n        </OCampaigns_Create>\r\n    </soap:Body>\r\n</soap:Envelope>`;\r\n\r\nconst echoPostRequest = {\r\n  url: url,\r\n  method: 'POST',  \r\n  header: {\r\n      'Content-Type': 'text/xml; charset=utf-8',\r\n      apikey: pm.environment.get(\"restApiKeyForAutomationTests\")\r\n  },\r\n  body: {\r\n      mode: 'raw',\r\n      raw: soapBody\r\n  }\r\n};\r\n\r\npm.sendRequest(echoPostRequest, function(err, res) {\r\n    if (err) {\r\n        console.error(err);\r\n    } else {\r\n        var jsonResponse = xml2Json(res.text());\r\n        pm.environment.set(\"campaignIdCreated\", jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_CreateResponse\"][\"OCampaigns_CreateResult\"][\"Id\"]);\r\n    }\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_RegisterContactsToCampaignResponse\"][\"OCampaigns_RegisterContactsToCampaignResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OCampaigns_RegisterContactsToCampaign details is OK\", function() {\r\n    pm.expect(jsonBody[\"TotalCount\"]).not.null;\r\n    pm.expect(jsonBody[\"SuccessfulCount\"]).not.null;\r\n    pm.expect(jsonBody[\"UnsuccessfulList\"]).not.null;\r\n    pm.expect(jsonBody[\"ImportStatus\"]).to.equal(\"true\");\r\n});"]}}],"id":"2428143b-c670-405c-9362-93928480fb82","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OCampaigns_RegisterContactsToCampaign"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OCampaigns_RegisterContactsToCampaign xmlns=\"http://api.viplus.com/\">\n        <campaignId>{{campaignIdCreated}}</campaignId>\n        <contactsIds>{{OCampaigns_RegisterContactsToCampaigncontactsIds}}</contactsIds>\n    </OCampaigns_RegisterContactsToCampaign>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"2428143b-c670-405c-9362-93928480fb82"},{"name":"OCampaigns_SendCampaign","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["var uuid = require('uuid');\r\nvar moment = require('moment');\r\n\r\nconst guid = uuid.v4();\r\nlet email = 'dev@smoove.io';\r\nconst currentDate = moment().toISOString();\r\nconst url = pm.environment.get('WsGateSoapBaseUrl') + '/Gates/Ws-' + pm.environment.get('restApiKeyForAutomationTests') + '.asmx';\r\n\r\nlet soapBody = \r\n`<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001 XMLSchema\">\r\n    <soap:Body>\r\n        <OCampaigns_Create xmlns=\"http://api.viplus.com/\">\r\n            <campaign>\r\n                <ApiGuid>` + guid + `</ApiGuid>\r\n                <ExternalId>AutomatedCampaign</ExternalId>\r\n                <ApiAction>Insert</ApiAction>\r\n                <Subject>SOAP request by ViplusApi Postman</Subject>\r\n                <Body>Email's body</Body>\r\n                <From>automationtests@smoove.io</From>\r\n                <ReplyTo>dev@smoove.io</ReplyTo>\r\n                <SenderMail>automationtests@smoove.io</SenderMail>\r\n                <ToEmails><string>` + email + `</string></ToEmails>\r\n                <SendDate>` + currentDate +`</SendDate>\r\n            </campaign>\r\n        </OCampaigns_Create>\r\n    </soap:Body>\r\n</soap:Envelope>`;\r\n\r\nconst echoPostRequest = {\r\n  url: url,\r\n  method: 'POST',  \r\n  header: {\r\n      'Content-Type': 'text/xml; charset=utf-8',\r\n      apikey: pm.environment.get(\"restApiKeyForAutomationTests\")\r\n  },\r\n  body: {\r\n      mode: 'raw',\r\n      raw: soapBody\r\n  }\r\n};\r\n\r\npm.sendRequest(echoPostRequest, function(err, res) {\r\n    if (err) {\r\n        console.error(err);\r\n    } else {\r\n        var jsonResponse = xml2Json(res.text());\r\n        pm.environment.set(\"CampaignIdCreated\", jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_CreateResponse\"][\"OCampaigns_CreateResult\"][\"Id\"]);\r\n    }\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let jsonResponse = xml2Json(pm.response.text());\r\nconsole.log(jsonResponse);\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OCampaigns_SendCampaignResponse\"][\"OCampaigns_SendCampaignResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"OCampaigns_Create details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"Id\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"ApiResult\"]).to.eql(\"OkSent\");\r\n    pm.expect(jsonBody[\"ApiAction\"]).to.eql(\"Insert\");\r\n    pm.expect(jsonBody[\"Subject\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"Body\"]).to.be.a(\"string\");\r\n    pm.expect(new Date(jsonBody[\"SendDate\"])).to.be.a(\"date\");\r\n    pm.expect(jsonBody[\"ContentType\"]).to.be.a(\"string\");\r\n});"]}}],"id":"5deee856-9450-4218-85f1-a6a09826bdac","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://api.viplus.com/OCampaigns_SendCampaign"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <OCampaigns_SendCampaign xmlns=\"http://api.viplus.com/\">\n        <!-- In order for this function to work, you have to create an email in \"saved\" status -->\n        <campaignId>{{CampaignIdCreated}}</campaignId> \n    </OCampaigns_SendCampaign>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{WsGateSoapBaseUrl}}/Gates/Ws-{{restApiKeyForAutomationTests}}.asmx","urlObject":{"path":["Gates","Ws-{{restApiKeyForAutomationTests}}.asmx"],"host":["{{WsGateSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"5deee856-9450-4218-85f1-a6a09826bdac"}],"id":"98956a5d-bded-44c3-b7a4-a4dba4b1fe26","event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":["// generate a random email address\nfunction generateRandomString(length) {\n    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n    let result = '';\n    for (let i = 0; i < length; i++) {\n        result += characters.charAt(Math.floor(Math.random() * characters.length));\n    }\n    return result;\n}\n// Change 8 to your desired length\nconst randomName = generateRandomString(8);\nconst randomEmail = `${randomName}@smoove.smoove.postman.test`;\npm.environment.set(\"RandomEmail\", randomEmail); \n\n// generate a random list\nvar randomList = generateRandomString(8);\npm.environment.set(\"RandomList\", randomList);\n\n// generate a random first name\nvar randomFirstName = pm.variables.replaceIn('Orval'+ '490');\npm.environment.set(\"RandomFirstName\", randomFirstName); \n\n// generate a random last name\nvar randomLastName = pm.variables.replaceIn('Harvey'+ '800');\npm.environment.set(\"RandomLastName\", randomLastName); \n\n// generate a random cell phone number\nvar randomCellphone = pm.variables.replaceIn('927-488-3875');\npm.environment.set(\"RandomCellphone\", randomCellphone); \n\n// sets the currect date and time\nlet currentDate = new Date();\npm.environment.set(\"currentDate\", currentDate.toISOString());\n\n// generate random subject\nvar randomSubject = pm.variables.replaceIn('128') + \"Update\";\npm.environment.set(\"RandomSubject\", randomSubject); "]}}],"_postman_id":"98956a5d-bded-44c3-b7a4-a4dba4b1fe26","description":""},{"name":"ViplusService","item":[{"name":"CreateAccount","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"CreateAccountResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"CreateAccount details is OK\", function() {\r\n    pm.expect(parseInt(jsonBody[\"CreateAccountResult\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"dataAccountId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"administratorId\"])).to.be.a(\"number\");\r\n    pm.expect(parseInt(jsonBody[\"dbadministratorId\"])).to.be.a(\"number\");\r\n    pm.expect(jsonBody[\"error\"]).not.null;\r\n    pm.expect(jsonBody[\"emailResponse\"]).not.null;\r\n});"]}}],"id":"c6a88671-be46-45bf-8252-deee8e66c97e","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/CreateAccount"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <CreateAccount xmlns=\"http://atplogic.com/\">\n            <language>he-IL</language>\n            <userName>_smoove_{{RandomUserName}}</userName>\n            <password>{{RandomPassword}}</password>\n            <firstName>{{RandomFirstName}}</firstName>\n            <lastName>{{RandomLastName}}</lastName>\n            <email>{{RandomEmail}}</email>\n            <phone>{{RandomCellphone}}</phone>\n            <companyName>string</companyName>\n            <resellerID>1009</resellerID>\n            <affiliate/>\n            <refererLink/>\n            <refererCode/>\n            <currency>₪</currency>\n            <userIP>127.0.0.1</userIP>\n            <userIPCountry>Israel</userIPCountry>\n            <signupPhase>4</signupPhase>\n            <externalProviderSignupOrigin>None</externalProviderSignupOrigin>\n            <requireMfa>true</requireMfa>\n        </CreateAccount>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c6a88671-be46-45bf-8252-deee8e66c97e"},{"name":"GetAccountTimezone","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"GetAccountTimezoneResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"GetAccountTimezone details is OK\", function() {\r\n    pm.expect(jsonBody[\"GetAccountTimezoneResult\"]).to.equals(\"Asia/Jerusalem\");\r\n});"]}}],"id":"e2ddbe42-56f7-4355-bd73-6b53bb218ffa","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/GetAccountTimezone"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <GetAccountTimezone xmlns=\"http://atplogic.com/\">\n            <siteId>{{GetAccountTimezoneSiteId}}</siteId>\n        </GetAccountTimezone>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e2ddbe42-56f7-4355-bd73-6b53bb218ffa"},{"name":"IsEmailTaken","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"IsEmailTakenResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"IsEmailTaken details is OK\", function () {\r\n    pm.expect(jsonBody[\"IsEmailTakenResult\"]).to.equal(\"true\");\r\n});"]}}],"id":"811414b2-bf83-4da2-b8f7-9f5454a90255","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/IsEmailTaken"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <IsEmailTaken xmlns=\"http://atplogic.com/\">\n            <email>roy@smoove.io</email>\n        </IsEmailTaken>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"811414b2-bf83-4da2-b8f7-9f5454a90255"},{"name":"GetGroups","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"GetGroupsResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"GetGroupsResponse details is OK\", function () {\r\n    pm.expect(jsonBody).not.null;\r\n});"]}}],"id":"e99a152b-4aae-43a4-aa39-5434736e198c","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/GetGroups"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <GetGroups xmlns=\"http://atplogic.com/\">\n            <email>roy@smoove.io</email>\n        </GetGroups>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e99a152b-4aae-43a4-aa39-5434736e198c"},{"name":"IsUsernameTaken","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"IsUsernameTakenResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"IsUsernameTaken details is OK\", function () {\r\n    pm.expect(jsonBody[\"IsUsernameTakenResult\"]).to.equal(\"true\");\r\n});"]}}],"id":"699d6d2d-ab9b-4f13-a6f5-a40980df1a42","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/IsUsernameTaken"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <IsUsernameTaken xmlns=\"http://atplogic.com/\">\n            <username>{{IsUsernameTaken}}</username>\n        </IsUsernameTaken>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"699d6d2d-ab9b-4f13-a6f5-a40980df1a42"},{"name":"GetAdministratorEmailAddress","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"GetAdministratorEmailAddressResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"GetAdministratorEmailAddress details is OK\", function () {\r\n    pm.expect(jsonBody[\"GetAdministratorEmailAddressResult\"]).not.null;\r\n    pm.expect(jsonBody[\"GetAdministratorEmailAddressResult\"]).is.include(\"@\");\r\n});"]}}],"id":"aa2546d5-c906-4029-973f-2313a764a2cb","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/GetAdministratorEmailAddress"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <GetAdministratorEmailAddress xmlns=\"http://atplogic.com/\">\n            <administratorID>{{GetAdministratorEmailAddressAdministratorID}}</administratorID>\n        </GetAdministratorEmailAddress>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"aa2546d5-c906-4029-973f-2313a764a2cb"},{"name":"GetSiteIdByAdministratorId","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"GetSiteIdByAdministratorIdResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"GetSiteIdByAdministratorId details is OK\", function () {\r\n    pm.expect(parseInt(jsonBody[\"GetSiteIdByAdministratorIdResult\"])).to.be.greaterThan(0);\r\n});"]}}],"id":"4bcc2783-9609-4be1-a119-2bc53c0ca5cc","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/GetSiteIdByAdministratorId"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <GetSiteIdByAdministratorId xmlns=\"http://atplogic.com/\">\n            <administratorID>{{GetAdministratorEmailAddressAdministratorID}}</administratorID>\n        </GetSiteIdByAdministratorId>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"4bcc2783-9609-4be1-a119-2bc53c0ca5cc"},{"name":"GetAccountDetailsByAdministratorId","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"GetAccountDetailsByAdministratorIdResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"GetAccountDetailsByAdministratorId details is OK\", function () {\r\n    pm.expect(jsonBody[\"GetAccountDetailsByAdministratorIdResult\"]).not.null;\r\n    pm.expect(jsonBody[\"GetAccountDetailsByAdministratorIdResult\"]).include('DataAccountID type=\\\"System.Int32\\\"');\r\n});"]}}],"id":"3a1208ee-799e-4a55-9012-f3ecf3f38616","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/GetAccountDetailsByAdministratorId"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <GetAccountDetailsByAdministratorId xmlns=\"http://atplogic.com/\">\n            <administratorID>{{GetAdministratorEmailAddressAdministratorID}}</administratorID>\n        </GetAccountDetailsByAdministratorId>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3a1208ee-799e-4a55-9012-f3ecf3f38616"},{"name":"InsertContact","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"InsertContactResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"InsertContact details is OK\", function () {\r\n    pm.expect(parseInt(jsonBody[\"InsertContactResult\"])).to.eql(0);\r\n});"]}}],"id":"a1a3533a-1db7-4a37-afda-863df902d653","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/InsertContact"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <InsertContact xmlns=\"http://atplogic.com/\">\n            <fName>{{RandomFirstName}}</fName>\n            <lName>{{RandomLastName}}</lName>\n            <birthdate>{{currentDate}}</birthdate>\n            <email>{{RandomEmail}}</email>\n            <cellphone>{{RandomCellphone}}</cellphone>\n        </InsertContact>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a1a3533a-1db7-4a37-afda-863df902d653"},{"name":"DeleteContact","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"DeleteContactResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"DeleteContact details is OK\", function() {\r\n    pm.expect(jsonBody[\"DeleteContactResult\"]).is.equal(\"false\");\r\n});"]}}],"id":"83e51666-1894-48b4-8fbd-8bf29ae2ab7a","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/DeleteContact"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <DeleteContact xmlns=\"http://atplogic.com/\">\n            <email>roysmoove30+1@gmail.com</email>\n        </DeleteContact>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"83e51666-1894-48b4-8fbd-8bf29ae2ab7a"},{"name":"SetApplicationKey","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"SetApplicationKeyResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"SetApplicationKey details is OK\", function() {\r\n    pm.expect(jsonBody[\"SetApplicationKeyResult\"]).is.equal(\"true\");\r\n});"]}}],"id":"bfd71845-6249-4ee5-b7ee-6a7efc71629f","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/SetApplicationKey"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <SetApplicationKey xmlns=\"http://atplogic.com/\">\n            <siteId>{{SetApplicationKeySiteId}}</siteId>\n            <appType>{{SetApplicationKeyAppType}}</appType>\n            <appMainKey>{{SetApplicationKeyAppMainKey}}</appMainKey>\n            <appSecondKey>{{SetApplicationKeyAppSecondKey}}</appSecondKey>\n        </SetApplicationKey>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"bfd71845-6249-4ee5-b7ee-6a7efc71629f"},{"name":"IsAuthentication","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"IsAuthenticationResponse\"][\"IsAuthenticationResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Body matches 'VerifyError'\", function () {\r\n    pm.expect(jsonBody).to.include(\"VerifyError\");\r\n});"]}}],"id":"4f92e67a-7a37-4441-90bd-5074b6533f34","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/IsAuthentication"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <IsAuthentication xmlns=\"http://atplogic.com/\">\n            <serviceBag>&lt;DataBag&gt;\n                        &lt;IsUserExistsCheck type=\"System.Boolean\"&gt;true&lt;/IsUserExistsCheck&gt;\n                        &lt;Email&gt;roy@smoove.io&lt;/Email&gt;\n                        &lt;Password&gt;ddasdsasadasd&lt;/Password&gt;\n                        &lt;UserIP&gt;127.0.0.1&lt;/UserIP&gt;\n                        &lt;IsExternalProviderFlow type=\"System.Boolean\"&gt;false&lt;/IsExternalProviderFlow&gt;\n                        &lt;/DataBag&gt;\n            </serviceBag>\n        </IsAuthentication>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"4f92e67a-7a37-4441-90bd-5074b6533f34"},{"name":"IsAuthenticationAdmin","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"IsAuthenticationAdminResponse\"][\"IsAuthenticationAdminResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Body matches 'TryAgain'\", function () {\r\n    pm.expect(jsonBody).to.include(\"TryAgain\");\r\n});"]}}],"id":"28cdb86a-aaaa-48d1-9e68-95caba2068f7","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/IsAuthenticationAdmin"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <IsAuthenticationAdmin xmlns=\"http://atplogic.com/\">\n            <serviceBag>&lt;DataBag&gt;\n                        &lt;UserName&gt;roy@smoove.io&lt;/UserName&gt;\n                        &lt;Password&gt;ddasdsasadasd&lt;/Password&gt;\n                        &lt;UserIP&gt;127.0.0.1&lt;/UserIP&gt;\n                        &lt;RememberMe type=\"System.Boolean\"&gt;false&lt;/RememberMe&gt;\n                        &lt;/DataBag&gt;\n            </serviceBag>\n        </IsAuthenticationAdmin>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"28cdb86a-aaaa-48d1-9e68-95caba2068f7"},{"name":"ActivateOrDeactivateAccount","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"ActivateOrDeactivateAccountResponse\"][\"ActivateOrDeactivateAccountResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Body matches 'true'\", function () {\r\n    pm.expect(jsonBody).to.equal(\"true\");\r\n});"]}}],"id":"9ca8578c-df64-4f3a-8b6c-f92553591ae0","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/ActivateOrDeactivateAccount"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <ActivateOrDeactivateAccount xmlns=\"http://atplogic.com/\">\n            <serviceBag>&lt;DataBag&gt;\n                        &lt;AdministratorID type=\"System.Int32\"&gt;1&lt;/AdministratorID&gt;\n                        &lt;DataAccountID type=\"System.Int32\"&gt;1&lt;/DataAccountID&gt;\n                        &lt;IsActive type=\"System.Boolean\"&gt;true&lt;/IsActive&gt;\n                        &lt;/DataBag&gt;\n            </serviceBag>\n        </ActivateOrDeactivateAccount>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9ca8578c-df64-4f3a-8b6c-f92553591ae0"},{"name":"InsertAccountOnboardingDetails","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"InsertAccountOnboardingDetailsResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"InsertAccountOnboardingDetails details is OK\", function() {\r\n    pm.expect(jsonBody[\"InsertAccountOnboardingDetailsResult\"]).is.equal(\"false\");\r\n});"]}}],"id":"e3a54f2a-826b-4514-a3a3-3cb6f27ecca3","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/InsertAccountOnboardingDetails"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <InsertAccountOnboardingDetails xmlns=\"http://atplogic.com/\">\n            <serviceBagXml>{{InsertAccountOnboardingDetails}}</serviceBagXml>\n        </InsertAccountOnboardingDetails>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e3a54f2a-826b-4514-a3a3-3cb6f27ecca3"},{"name":"UpdateDataAccountMiscData","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"UpdateDataAccountMiscDataResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"UpdateDataAccountMiscData details is OK\", function() {\r\n    pm.expect(jsonBody[\"UpdateDataAccountMiscDataResult\"]).is.equal(\"false\");\r\n});"]}}],"id":"8b751d90-6694-40b7-bddc-61a0c213e7a8","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/UpdateDataAccountMiscData"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <UpdateDataAccountMiscData xmlns=\"http://atplogic.com/\">\n            <serviceBagXml>{{UpdateDataAccountMiscData}}</serviceBagXml>\n        </UpdateDataAccountMiscData>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{ServiceSoapBaseUrl}}/service.asmx","urlObject":{"path":["service.asmx"],"host":["{{ServiceSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8b751d90-6694-40b7-bddc-61a0c213e7a8"}],"id":"5681050e-b01c-4b2c-a0de-3e1c6750598f","event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":["// generate a random email address\nfunction generateRandomString(length) {\n    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n    let result = '';\n    for (let i = 0; i < length; i++) {\n        result += characters.charAt(Math.floor(Math.random() * characters.length));\n    }\n    return result;\n}\n// Change 8 to your desired length\nconst randomName = generateRandomString(8);\nconst randomEmail = `${randomName}@smoove.smoove.postman.test`;\npm.environment.set(\"RandomEmail\", randomEmail); \n\n\n// generate a random user name\nvar randomUserName = pm.variables.replaceIn('Sage_Nikolaus');\npm.environment.set(\"RandomUserName\", randomUserName); \n\n// generate a random password\nvar randomPassword = pm.variables.replaceIn('kn88oy5w2gr6cws');\npm.environment.set(\"RandomPassword\", randomPassword); \n\n// generate a random first name\nvar randomFirstName = pm.variables.replaceIn('Gaetano');\npm.environment.set(\"RandomFirstName\", randomFirstName); \n\n// generate a random last name\nvar randomLastName = pm.variables.replaceIn('Price');\npm.environment.set(\"RandomLastName\", randomLastName); \n\n// generate a random cell phone number\nvar randomCellphone = pm.variables.replaceIn('695-405-3618');\npm.environment.set(\"RandomCellphone\", randomCellphone); \n\n// sets the currect date and time\nlet currentDate = new Date();\npm.environment.set(\"currentDate\", currentDate.toISOString());"]}}],"_postman_id":"5681050e-b01c-4b2c-a0de-3e1c6750598f","description":""},{"name":"ViplusHtmlToImageService","item":[{"name":"GetSnapshotByUri","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"s:Envelope\"][\"s:Body\"][\"GetSnapshotByUriResponse\"][\"GetSnapshotByUriResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"GetSnapshotByUri details is OK\", function() {\r\n    pm.expect(jsonBody).to.be.a(\"string\");\r\n});"]}}],"id":"07f81998-b27c-4e0f-9ec8-4764e635786a","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://tempuri.org/IHtmlToImageService/GetSnapshotByUri"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <GetSnapshotByUri xmlns=\"http://tempuri.org/\">\n            <uri>https://www.google.com</uri>\n        </GetSnapshotByUri>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{BasicHttpBinding_IHtmlToImageServiceBaseUrl}}/HtmlToImageService.svc","urlObject":{"path":["HtmlToImageService.svc"],"host":["{{BasicHttpBinding_IHtmlToImageServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"07f81998-b27c-4e0f-9ec8-4764e635786a"},{"name":"GetWebsiteSnapshot","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nconsole.log(jsonResponse)\r\nlet jsonBody = jsonResponse[\"s:Envelope\"][\"s:Body\"][\"GetWebsiteSnapshotResponse\"][\"GetWebsiteSnapshotResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"GetWebsiteSnapshot details are OK\", function() {\r\n    pm.expect(jsonBody).to.be.an(\"object\");\r\n    pm.expect(jsonBody[\"a:Png\"]).to.be.a(\"string\");\r\n    pm.expect(jsonBody[\"a:Html\"]).to.be.a(\"string\");\r\n});"]}}],"id":"dbdae218-cae7-4cb2-93f4-37ed1045a016","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://tempuri.org/IHtmlToImageService/GetWebsiteSnapshot"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <GetWebsiteSnapshot xmlns=\"http://tempuri.org/\">\n            <url>https://www.smoove.io</url>\n        </GetWebsiteSnapshot>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{BasicHttpBinding_IHtmlToImageServiceBaseUrl}}/HtmlToImageService.svc","urlObject":{"path":["HtmlToImageService.svc"],"host":["{{BasicHttpBinding_IHtmlToImageServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"dbdae218-cae7-4cb2-93f4-37ed1045a016"},{"name":"GetPdfStreamByUri","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"s:Envelope\"][\"s:Body\"][\"GetPdfStreamByUriResponse\"][\"GetPdfStreamByUriResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"GetPdfStreamByUri details is OK\", function() {\r\n    pm.expect(jsonBody).to.be.a(\"string\");\r\n});"]}}],"id":"2cc3336a-1762-444e-a339-a9fbfd33dde3","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://tempuri.org/IHtmlToImageService/GetPdfStreamByUri"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <GetPdfStreamByUri xmlns=\"http://tempuri.org/\">\n            <uri>https://www.google.com</uri>\n        </GetPdfStreamByUri>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{BasicHttpBinding_IHtmlToImageServiceBaseUrl}}/HtmlToImageService.svc","urlObject":{"path":["HtmlToImageService.svc"],"host":["{{BasicHttpBinding_IHtmlToImageServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"2cc3336a-1762-444e-a339-a9fbfd33dde3"}],"id":"86a4991e-60c8-410f-9163-3318379e3679","_postman_id":"86a4991e-60c8-410f-9163-3318379e3679","description":""},{"name":"ViplusSmsResponse","item":[{"name":"ClickatellResponse","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let textResponse = pm.response.text();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"ClickatellResponse response is not empty\",function(){\r\n    pm.expect(textResponse).not.empty;    \r\n});\r\n\r\npm.test(\"The response is HTML, OK\", function () {\r\n    pm.expect(textResponse).to.include('html');\r\n    pm.expect(textResponse).to.include('head');\r\n});"]}}],"id":"39f76cea-6431-4e0a-9ee2-2c9e4602fe92","request":{"method":"POST","header":[],"body":{"mode":"urlencoded","urlencoded":[{"key":"to","value":"123456781"},{"key":"msisdn","value":"0500000000"},{"key":"text","value":"test"}]},"url":"{{ViplusSmsResponse}}/ClickatellResponse.ashx","urlObject":{"path":["ClickatellResponse.ashx"],"host":["{{ViplusSmsResponse}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"39f76cea-6431-4e0a-9ee2-2c9e4602fe92"},{"name":"MicropayTrigger","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let textResponse = pm.response.text();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"MicropayTrigger response is not empty\",function(){\r\n    pm.expect(textResponse).not.empty;    \r\n});\r\n\r\npm.test(\"The response is returning OK\", function () {\r\n    pm.expect(textResponse).to.equal('OK');\r\n});"]}}],"id":"844591ee-5c4e-4ee4-bd8e-40ad2d622e0e","request":{"method":"POST","header":[],"body":{"mode":"urlencoded","urlencoded":[{"key":"dest","value":"0770008888"},{"key":"code","value":"hello12"},{"key":"phone","value":"055880000"},{"key":"sms","value":"hello12"}]},"url":"{{ViplusSmsResponse}}/MicropayTrigger.ashx","urlObject":{"path":["MicropayTrigger.ashx"],"host":["{{ViplusSmsResponse}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"844591ee-5c4e-4ee4-bd8e-40ad2d622e0e"},{"name":"MaskYooTrigger","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let textResponse = pm.response.text();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"MaskYooTrigger response is not empty\",function(){\r\n    pm.expect(textResponse).not.empty;    \r\n});\r\n\r\npm.test(\"The response is returning OK\", function () {\r\n    pm.expect(textResponse).to.equal('OK');\r\n});"]}}],"id":"7fdb54ea-5869-4ad4-8a37-8611d2e90ba8","request":{"method":"POST","header":[],"url":"{{ViplusSmsResponse}}/MaskYooTrigger.ashx?to=123456789&from=0510000000&msg=test1","urlObject":{"path":["MaskYooTrigger.ashx"],"host":["{{ViplusSmsResponse}}"],"query":[{"key":"to","value":"123456789"},{"key":"from","value":"0510000000"},{"key":"msg","value":"test1"}],"variable":[]}},"response":[],"_postman_id":"7fdb54ea-5869-4ad4-8a37-8611d2e90ba8"},{"name":"NexmoTrigger","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let textResponse = pm.response.text();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"NexmoTrigger response is not empty\",function(){\r\n    pm.expect(textResponse).not.empty;    \r\n});\r\n\r\npm.test(\"The response is returning OK\", function () {\r\n    pm.expect(textResponse).to.equal('OK');\r\n});"]}}],"id":"e7c6966a-f875-45d7-adfc-b4c70aa9123c","request":{"method":"POST","header":[],"body":{"mode":"urlencoded","urlencoded":[{"key":"to","value":"123456781"},{"key":"msisdn","value":"0510000000"},{"key":"text","value":"test"}]},"url":"{{ViplusSmsResponse}}/NexmoTrigger.ashx","urlObject":{"path":["NexmoTrigger.ashx"],"host":["{{ViplusSmsResponse}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e7c6966a-f875-45d7-adfc-b4c70aa9123c"},{"name":"NexmoResponse","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let textResponse = pm.response.text();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"NexmoResponse response is not empty\",function(){\r\n    pm.expect(textResponse).not.empty;    \r\n});\r\n\r\npm.test(\"The response is returning 200 OK\", function () {\r\n    pm.expect(textResponse).to.equal('200 OK');\r\n});"]}}],"id":"aee5c3ae-4432-4f7f-a257-a64f1f2f2189","request":{"method":"POST","header":[],"body":{"mode":"urlencoded","urlencoded":[{"key":"to","value":"123456781"},{"key":"msisdn","value":"0510000000"},{"key":"text","value":"test"}]},"url":"{{ViplusSmsResponse}}/NexmoResponse.ashx","urlObject":{"path":["NexmoResponse.ashx"],"host":["{{ViplusSmsResponse}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"aee5c3ae-4432-4f7f-a257-a64f1f2f2189"},{"name":"UnicellOmnichannelMessagesResponsesHandler","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let textResponse = pm.response.text();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"UnicellOmnichannelMessagesStatusesHandler response is not empty\",function(){\r\n    pm.expect(textResponse).not.empty;    \r\n});\r\n\r\npm.test(\"Check if response is HTML\", function () {\r\n    pm.expect(textResponse).to.oneOf(['OK', '0']);\r\n});"]}}],"id":"5103db04-3b68-4106-bab7-603fb17fd6f8","request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"[\r\n    {\r\n        \"ID\": {{UnicellOmnichannelMessages}},\r\n        \"Timestamp\": \"2023-03-05T09:24:25.000\",\r\n        \"Message\": \"test3\",\r\n        \"From\": \"972510000000\",\r\n        \"To\": \"972526694447\",\r\n        \"MessageType\": \"whatsapp\",\r\n        \"IsBlockMessage\": false,\r\n        \"ContentType\": \"text\",\r\n        \"Url\": \"\",\r\n        \"ReplyToClientReferenceID\": null\r\n    },\r\n    {\r\n        \"ID\": {{UnicellOmnichannelMessages}},\r\n        \"Timestamp\": \"2023-03-05T09:24:25.000\",\r\n        \"Message\": \"test3\",\r\n        \"From\": \"972510000000\",\r\n        \"To\": \"972526694447\",\r\n        \"MessageType\": \"whatsapp\",\r\n        \"IsBlockMessage\": false,\r\n        \"ContentType\": \"text\",\r\n        \"Url\": \"\",\r\n        \"ReplyToClientReferenceID\": null\r\n    },\r\n    {\r\n        \"ID\": {{UnicellOmnichannelMessages}},\r\n        \"Timestamp\": \"2023-03-05T09:24:25.000\",\r\n        \"Message\": \"test3\",\r\n        \"From\": \"972510000000\",\r\n        \"To\": \"972526694447\",\r\n        \"MessageType\": \"whatsapp\",\r\n        \"IsBlockMessage\": false,\r\n        \"ContentType\": \"text\",\r\n        \"Url\": \"\",\r\n        \"ReplyToClientReferenceID\": null\r\n    }\r\n]","options":{"raw":{"language":"json"}}},"url":"{{ViplusSmsResponse}}/UnicellOmnichannelMessagesResponsesHandler.ashx","urlObject":{"path":["UnicellOmnichannelMessagesResponsesHandler.ashx"],"host":["{{ViplusSmsResponse}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"5103db04-3b68-4106-bab7-603fb17fd6f8"},{"name":"UnicellOmnichannelMessagesStatusesHandler","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let textResponse = pm.response.text();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"UnicellOmnichannelMessagesStatusesHandler response is not empty\",function(){\r\n    pm.expect(textResponse).not.empty;    \r\n});\r\n\r\npm.test(\"The response is returning OK\", function () {\r\n    pm.expect(textResponse).to.equal('OK');\r\n});"]}}],"id":"c1e359e5-9081-4271-88c3-e0b460bf7bb5","request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"[  \r\n  {\r\n    \"ID\": 71796123,\r\n    \"ReferenceID\": \"01af1001-fe25-4ce3-81e0-13da6c3a5deb\",\r\n    \"AccountID\": 17822,\r\n    \"MessageType\": \"whatsapp\",\r\n    \"Timestamp\": \"2024-12-02T08:56:59.000\",\r\n    \"StatusName\": \"failed\",\r\n    \"ClientReferenceID\": \"9272\",\r\n    \"From\": \"97223764436\",\r\n    \"To\": \"972500000001\",\r\n    \"ErrorReason\": \"Not part of the provider network\",\r\n    \"DeliveredDate\": \"2024-12-02T07:56:59.418\"\r\n  },\r\n  {\r\n    \"ID\": 71796124,\r\n    \"ReferenceID\": \"01af1001-fe25-4ce3-81e0-13da6c3a5deb\",\r\n    \"AccountID\": 17822,\r\n    \"MessageType\": \"whatsapp\",\r\n    \"Timestamp\": \"2024-12-02T08:56:59.000\",\r\n    \"StatusName\": \"failed\",\r\n    \"ClientReferenceID\": \"9273\",\r\n    \"From\": \"97223764436\",\r\n    \"To\": \"972500000000\",\r\n    \"ErrorReason\": \"Not part of the provider network\",\r\n    \"DeliveredDate\": \"2024-12-02T07:56:59.449\"\r\n  }\r\n]\r\n","options":{"raw":{"language":"json"}}},"url":"{{ViplusSmsResponse}}/UnicellOmnichannelMessagesStatusesHandler.ashx","urlObject":{"path":["UnicellOmnichannelMessagesStatusesHandler.ashx"],"host":["{{ViplusSmsResponse}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c1e359e5-9081-4271-88c3-e0b460bf7bb5"},{"name":"UnicellOmnichannelMessagesStatusesTemplatesHandler","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let textResponse = pm.response.text();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"UnicellOmnichannelMessagesStatusesTemplatesHandler response is not empty\",function(){\r\n    pm.expect(textResponse).not.empty;    \r\n});\r\n\r\npm.test(\"The response is returning OK\", function () {\r\n    pm.expect(textResponse).to.equal('OK');\r\n});"]}}],"id":"d5d9900d-b6cf-4869-a447-9eaa2a946d05","request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"[\r\n    {\r\n        \"ID\":{{UnicellOmnichannelMessages}},\r\n        \"Timestamp\":\"2023-03-10T09:24:25.000\",\r\n        \"Message\":\"notify\",\r\n        \"From\":\"972510000000\",\r\n        \"To\":\"97223764436\",\r\n        \"MessageType\":\"whatsapp\",\r\n        \"IsBlockMessage\":false,\r\n        \"Url\":\"\",\r\n        \"ContentType\":\"text\",\r\n        \"ReplyToClientReferenceID\":null\r\n    }\r\n]","options":{"raw":{"language":"json"}}},"url":"{{ViplusSmsResponse}}/UnicellOmnichannelMessagesStatusesTemplatesHandler.ashx","urlObject":{"path":["UnicellOmnichannelMessagesStatusesTemplatesHandler.ashx"],"host":["{{ViplusSmsResponse}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d5d9900d-b6cf-4869-a447-9eaa2a946d05"},{"name":"UnicellSmsResponse","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let textResponse = pm.response.text();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"UnicellSmsResponse response is not empty\",function(){\r\n    pm.expect(textResponse).not.empty;    \r\n});\r\n\r\npm.test(\"The response is HTML, OK\", function () {\r\n    pm.expect(textResponse).to.include('html');\r\n    pm.expect(textResponse).to.include('head');\r\n});"]}}],"id":"dff7708e-ea46-47b5-bd14-5a55f8eb198f","request":{"method":"POST","header":[],"body":{"mode":"urlencoded","urlencoded":[{"key":"version","value":"1"},{"key":"operation","value":"test"},{"key":"user","value":"aptlogic30"},{"key":"password","value":"atplogic40"},{"key":"destination","value":"0510000000"},{"key":"source","value":"0510000000"},{"key":"reference","value":"1"},{"key":"external_reference","value":"1"},{"key":"final_state_time","value":""},{"key":"final_state_code","value":"-1"},{"key":"final_state","value":"1"},{"key":"final_state_reason","value":""},{"key":"home_network_id","value":"1"},{"key":"final_state_network_code","value":"-1"},{"key":"final_state_network_description","value":"-1"}]},"url":"{{ViplusSmsResponse}}/UnicellSmsResponse.aspx","urlObject":{"path":["UnicellSmsResponse.aspx"],"host":["{{ViplusSmsResponse}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"dff7708e-ea46-47b5-bd14-5a55f8eb198f"},{"name":"UnicellResponse","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let textResponse = pm.response.text();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"UnicellResponse response is not empty\",function(){\r\n    pm.expect(textResponse).not.empty;    \r\n});\r\n\r\npm.test(\"The response is returning OK\", function () {\r\n    pm.expect(textResponse).to.equal('OK');\r\n});"]}}],"id":"6e8c111b-8b33-44d0-a8ff-7e9c9032dd6e","request":{"method":"POST","header":[],"body":{"mode":"urlencoded","urlencoded":[{"key":"destination","value":"123456780"},{"key":"source","value":"0510000000"},{"key":"message","value":"test2"}]},"url":"{{ViplusSmsResponse}}/UnicellResponse.ashx","urlObject":{"path":["UnicellResponse.ashx"],"host":["{{ViplusSmsResponse}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6e8c111b-8b33-44d0-a8ff-7e9c9032dd6e"}],"id":"5be4e522-6195-4f27-b805-cd3208d6bb17","_postman_id":"5be4e522-6195-4f27-b805-cd3208d6bb17","description":""},{"name":"AtpSecurityManagerWs","item":[{"name":"AtpLogin","item":[{"name":"LogOutSessionUUID","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"LogOutSessionUUID response is not null\", function() {\r\n    pm.expect(jsonBody[\"LogOutSessionUUIDResponse\"]).not.null;\r\n});"]}}],"id":"feb5312e-0a9a-4543-96de-3b72f26d2afb","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/LogOutSessionUUID"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <LogOutSessionUUID xmlns=\"http://atplogic.com/\">\n      <sessionUUID>{{AtpLoginSessionUUID}}</sessionUUID>\n    </LogOutSessionUUID>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpLoginSoapBaseUrl}}/atplogin/atplogin.asmx","urlObject":{"path":["atplogin","atplogin.asmx"],"host":["{{AtpLoginSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"feb5312e-0a9a-4543-96de-3b72f26d2afb"},{"name":"UpdatePreferredLanguage","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"UpdatePreferredLanguageResponse\"][\"UpdatePreferredLanguageResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"UpdatePreferredLanguage return true\", function() {\r\n    pm.expect(jsonBody).to.equals(\"true\");\r\n});"]}}],"id":"5b43bb54-7cdc-4081-b035-0eb8d6c1fcb2","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/UpdatePreferredLanguage"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <UpdatePreferredLanguage xmlns=\"http://atplogic.com/\">\n      <sessionUUID>{{AtpLoginSessionUUID}}</sessionUUID>\n      <PreferredLanguage>he-IL</PreferredLanguage>\n    </UpdatePreferredLanguage>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpLoginSoapBaseUrl}}/atplogin/atplogin.asmx","urlObject":{"path":["atplogin","atplogin.asmx"],"host":["{{AtpLoginSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"5b43bb54-7cdc-4081-b035-0eb8d6c1fcb2"},{"name":"UpdateLastLoginTimestamp","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"UpdateLastLoginTimestampResponse\"][\"UpdateLastLoginTimestampResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"UpdateLastLoginTimestamp return true\", function() {\r\n    pm.expect(jsonBody).to.equals(\"true\");\r\n});"]}}],"id":"2f4a75bd-6f61-4b13-9675-3e8fa50a815d","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/UpdateLastLoginTimestamp"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <UpdateLastLoginTimestamp xmlns=\"http://atplogic.com/\">\n      <administratorID>{{GetAdministratorEmailAddressAdministratorID}}</administratorID>\n    </UpdateLastLoginTimestamp>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpLoginSoapBaseUrl}}/atplogin/atplogin.asmx","urlObject":{"path":["atplogin","atplogin.asmx"],"host":["{{AtpLoginSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"2f4a75bd-6f61-4b13-9675-3e8fa50a815d"},{"name":"SelectPreferredLanguage","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"SelectPreferredLanguageResponse\"][\"SelectPreferredLanguageResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"SelectPreferredLanguage is a string\", function() {\r\n    pm.expect(jsonBody).to.be.a(\"string\");\r\n});"]}}],"id":"9fc9a795-3b59-439a-8cb1-356449f8a251","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/SelectPreferredLanguage"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <SelectPreferredLanguage xmlns=\"http://atplogic.com/\">\n      <Email>kfir@smoove.io</Email>\n    </SelectPreferredLanguage>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpLoginSoapBaseUrl}}/atplogin/atplogin.asmx","urlObject":{"path":["atplogin","atplogin.asmx"],"host":["{{AtpLoginSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9fc9a795-3b59-439a-8cb1-356449f8a251"},{"name":"SelectPreferredLanguageBySiteId","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"SelectPreferredLanguageBySiteIdResponse\"][\"SelectPreferredLanguageBySiteIdResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"SelectPreferredLanguage is a string\", function() {\r\n    pm.expect(jsonBody).to.be.a(\"string\");\r\n});"]}}],"id":"e751ca66-32d2-48b6-bc4a-09fd22a77825","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/SelectPreferredLanguageBySiteId"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <SelectPreferredLanguageBySiteId xmlns=\"http://atplogic.com/\">\n      <siteId>{{OGetFacebookFormUrlConnectionsSiteId}}</siteId>\n    </SelectPreferredLanguageBySiteId>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpLoginSoapBaseUrl}}/atplogin/atplogin.asmx","urlObject":{"path":["atplogin","atplogin.asmx"],"host":["{{AtpLoginSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e751ca66-32d2-48b6-bc4a-09fd22a77825"},{"name":"AuthenticatePage","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"AuthenticatePageResponse\"][\"AuthenticatePageResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"AuthenticatePage returns true\", function() {\r\n    pm.expect(jsonBody).to.equal(\"true\");\r\n});"]}}],"id":"8403ee46-fa0c-47ae-b043-3dfb40c553e4","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/AuthenticatePage"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <AuthenticatePage xmlns=\"http://atplogic.com/\">\n      <pageName>panel.aspx</pageName>\n    </AuthenticatePage>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpLoginSoapBaseUrl}}/atplogin/atplogin.asmx","urlObject":{"path":["atplogin","atplogin.asmx"],"host":["{{AtpLoginSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8403ee46-fa0c-47ae-b043-3dfb40c553e4"},{"name":"LogGuardianError","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"LogGuardianErrorResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"LogGuardianError response is not null\", function() {\r\n    pm.expect(jsonBody).not.null;\r\n});"]}}],"id":"789eb44b-bb48-44c8-8bd1-6f67b19dc7ec","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/LogGuardianError"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <LogGuardianError xmlns=\"http://atplogic.com/\">\n      <sessionUUID>{{LogGuardianErrorSessionUUID}}</sessionUUID>\n      <errorSource>{{LogGuardianErrorErrorSource}}</errorSource>\n      <errorMSG>{{LogGuardianErrorErrorMSG}}</errorMSG>\n    </LogGuardianError>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpLoginSoapBaseUrl}}/atplogin/atplogin.asmx","urlObject":{"path":["atplogin","atplogin.asmx"],"host":["{{AtpLoginSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"789eb44b-bb48-44c8-8bd1-6f67b19dc7ec"},{"name":"AuthenticateSessionUUID","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"AuthenticateSessionUUIDResponse\"][\"AuthenticateSessionUUIDResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"AuthenticateSessionUUID returns false\", function() {\r\n    pm.expect(jsonBody).to.equals(\"false\");\r\n});"]}}],"id":"5ca6c716-3ab7-4441-8328-db1408c849e6","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/AuthenticateSessionUUID"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <AuthenticateSessionUUID xmlns=\"http://atplogic.com/\">\n      <sessionUUID>{{AtpLoginSessionUUID}}</sessionUUID>\n      <siteType>vpl</siteType>\n      <dataAccountID>{{AtpLoginDataAccountID}}</dataAccountID>\n      <userIP>{{AtpLoginUserIP}}</userIP>\n      <actionURL/>\n      <FullDbAuthenticate>true</FullDbAuthenticate>\n    </AuthenticateSessionUUID>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpLoginSoapBaseUrl}}/atplogin/atplogin.asmx","urlObject":{"path":["atplogin","atplogin.asmx"],"host":["{{AtpLoginSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"5ca6c716-3ab7-4441-8328-db1408c849e6"},{"name":"LogGuardianEvent","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"LogGuardianEventResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"LogGuardianEvent response is not null\", function() {\r\n    pm.expect(jsonBody).not.null;\r\n});"]}}],"id":"422faafd-3605-408b-b7a3-014b51239f1a","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/LogGuardianEvent"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <LogGuardianEvent xmlns=\"http://atplogic.com/\">\n      <siteType>vpl</siteType>\n      <sessionUUID>{{AtpLoginSessionUUID}}</sessionUUID>\n      <dataAccountID>{{AtpLoginDataAccountID}}</dataAccountID>\n      <userIP>{{AtpLoginUserIP}}</userIP>\n      <actionURL/>\n    </LogGuardianEvent>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpLoginSoapBaseUrl}}/atplogin/atplogin.asmx","urlObject":{"path":["atplogin","atplogin.asmx"],"host":["{{AtpLoginSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"422faafd-3605-408b-b7a3-014b51239f1a"},{"name":"GetDataAccountList","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"GetDataAccountListResponse\"][\"GetDataAccountListResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"GetDataAccountList is not empty\", function() {\r\n    pm.expect(jsonBody).to.be.a(\"string\");\r\n});"]}}],"id":"d3b2a150-31a8-47b2-b5f9-a98fddff4513","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/GetDataAccountList"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <GetDataAccountList xmlns=\"http://atplogic.com/\">\n      <sessionUUID>{{AtpLoginSessionUUID}}</sessionUUID>\n      <userIP>{{AtpLoginUserIP}}</userIP>\n      <miCode>viplus</miCode>\n    </GetDataAccountList>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpLoginSoapBaseUrl}}/atplogin/atplogin.asmx","urlObject":{"path":["atplogin","atplogin.asmx"],"host":["{{AtpLoginSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d3b2a150-31a8-47b2-b5f9-a98fddff4513"},{"name":"GetDataAccountDetails","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"GetDataAccountDetailsResponse\"][\"GetDataAccountDetailsResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"GetDataAccountDetails is not empty\", function() {\r\n    pm.expect(jsonBody).to.be.a(\"string\");\r\n});"]}}],"id":"d968a54b-7071-49a5-9f91-c3612bf8ed8b","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/GetDataAccountDetails"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n  <soap:Body>\n    <GetDataAccountDetails xmlns=\"http://atplogic.com/\">\n      <sessionUUID>{{AtpLoginGetDataAccountDetailSsessionUUID}}</sessionUUID>\n      <userIP>{{AtpLoginGetDataAccountDetailUserIp}}</userIP>\n      <dataAccountID>{{AtpLoginGetDataAccountDetailUserIpdataAccountID}}</dataAccountID>\n    </GetDataAccountDetails>\n  </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpLoginSoapBaseUrl}}/atplogin/atplogin.asmx","urlObject":{"path":["atplogin","atplogin.asmx"],"host":["{{AtpLoginSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d968a54b-7071-49a5-9f91-c3612bf8ed8b"}],"id":"09768baa-4093-4890-8052-cfa3a5ee8178","_postman_id":"09768baa-4093-4890-8052-cfa3a5ee8178","description":""},{"name":"AtpManager","item":[{"name":"ProcessAction","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nconsole.log(jsonResponse);\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"ProcessActionResponse\"][\"ProcessActionResult\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"ProcessAction return true\", function() {\r\n    pm.expect(jsonBody).to.equals(\"false\");\r\n});"]}}],"id":"30f8057a-c2d0-4ca0-9ea4-f1a7f87e24ae","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/ProcessAction"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Body>\n        <ProcessAction xmlns=\"http://atplogic.com/\">\n            <miCode>{{AtpManagerProcessActionMiCode}}</miCode>\n        </ProcessAction>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpManagerSoapBaseUrl}}/atpmanager/atpmanager.asmx","urlObject":{"path":["atpmanager","atpmanager.asmx"],"host":["{{AtpManagerSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"30f8057a-c2d0-4ca0-9ea4-f1a7f87e24ae"},{"name":"OnePassProcessActionWithResults","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = xml2Json(pm.response.text());\r\nconsole.log(jsonResponse);\r\nlet jsonBody = jsonResponse[\"soap:Envelope\"][\"soap:Body\"][\"OnePassProcessActionWithResultsResponse\"];\r\nlet requestName = pm.info.requestName;\r\nconsole.log(\"Request Name: \" + requestName);\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"LogOutSessionUUID response is not empty\", function() {\r\n    pm.expect(jsonBody[\"OnePassProcessActionWithResultsResult\"]).to.eql(\"true\");\r\n    pm.expect(jsonBody[\"encryptedResults\"]).not.null;\r\n});"]}}],"id":"6b3c3154-f697-408f-8877-0f96e0680340","request":{"method":"POST","header":[{"key":"Content-Type","value":"text/xml; charset=utf-8"},{"key":"SOAPAction","value":"http://atplogic.com/OnePassProcessActionWithResults"}],"body":{"mode":"raw","raw":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n    <soap:Header>\n        <ServiceAuthHeader xmlns=\"http://atplogic.com/ProcessActionWithResult/soap-auth/\">\n            <Username>{{AtpManagerOnePassProcessActionWithResultsUsername}}</Username>\n            <Password>{{AtpManagerOnePassProcessActionWithResultsPassword}}</Password>\n        </ServiceAuthHeader>\n    </soap:Header>\n    <soap:Body>\n        <OnePassProcessActionWithResults xmlns=\"http://atplogic.com/\">\n            <miCode>{{AtpManagerOnePassProcessActionWithResultsMiCode}}</miCode>\n            <encryptedAction>{{AtpManagerOnePassProcessActionWithResultsEncryptedAction}}</encryptedAction>\n        </OnePassProcessActionWithResults>\n    </soap:Body>\n</soap:Envelope>","options":{"raw":{"language":"xml"}}},"url":"{{AtpManagerSoapBaseUrl}}/atpmanager/atpmanager.asmx","urlObject":{"path":["atpmanager","atpmanager.asmx"],"host":["{{AtpManagerSoapBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6b3c3154-f697-408f-8877-0f96e0680340"}],"id":"ff276024-0d23-4c0c-8804-8e05a1cd7ed0","_postman_id":"ff276024-0d23-4c0c-8804-8e05a1cd7ed0","description":""}],"id":"40f85553-567a-48df-99ad-d3089c3b83db","_postman_id":"40f85553-567a-48df-99ad-d3089c3b83db","description":""},{"name":"Smoove.UrlShortener","item":[{"name":"short-url-bulk","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\nlet contactId = -1;\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.contactId).to.eql(contactId);\r\n    pm.expect(list.shortUrl).to.be.a(\"string\");\r\n    pm.expect(list.originalUrl).to.be.a(\"string\");\r\n});"]}}],"id":"2a4a2ca9-eca2-4ae8-b32e-1dc438a79ef8","request":{"method":"POST","header":[{"key":"Systemauthkey","value":"E02A6B18-B323-4C50-8ABC-A8E0025321A0"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"[{\"SiteId\":{{Smoove.UrlShortener.SiteId}},\"OriginalUrl\":\"http://portal.smoove.io//14qmc61nymbqd6qbdagnb/s/u/7rhnqbgq8?c=he-IL\", \"contactId\": -1}]","options":{"raw":{"language":"text"}}},"url":"https://{{Smoove.UrlShortener.Host}}/short-url-bulk","urlObject":{"protocol":"https","path":["short-url-bulk"],"host":["{{Smoove.UrlShortener.Host}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"2a4a2ca9-eca2-4ae8-b32e-1dc438a79ef8"},{"name":"short-url","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\", function () {\r\n    let responseBody = pm.response.text();\r\n    pm.expect(responseBody).to.be.a(\"string\");\r\n});"]}}],"id":"703a1429-369a-43a0-af5d-3411f95e544e","request":{"method":"POST","header":[{"key":"Systemauthkey","value":"E02A6B18-B323-4C50-8ABC-A8E0025321A0"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\"SiteId\":{{Smoove.UrlShortener.SiteId}},\"OriginalUrl\":\"http://portal.smoove.io//14qmc61nymbqd6qbdagnb/s/u/7rhnqbgq8?c=he-IL\", \"contactId\": -1}","options":{"raw":{"language":"text"}}},"url":"https://{{Smoove.UrlShortener.Host}}/short-url","urlObject":{"protocol":"https","path":["short-url"],"host":["{{Smoove.UrlShortener.Host}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"703a1429-369a-43a0-af5d-3411f95e544e"}],"id":"8eccfce3-5788-4834-8f03-c26a9c76a9f1","_postman_id":"8eccfce3-5788-4834-8f03-c26a9c76a9f1","description":""},{"name":"Smoove.AtpBusiness","item":[{"name":"Account","item":[{"name":"Account Get Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.CustomerID).to.be.greaterThan(0);\r\n    pm.expect(list.CustomerName).to.be.a(\"string\");\r\n    pm.expect(list.CustomerUserName).to.be.a(\"string\");\r\n    pm.expect(list.CustomerFirstName).to.be.a(\"string\");\r\n    pm.expect(list.CustomerLastName).to.be.a(\"string\");\r\n    pm.expect(list.CustomerEmail).is.include(\"@\");\r\n    pm.expect(list.CustomerCity).to.be.a(\"string\");\r\n    pm.expect(list.CustomerAddress).to.be.a(\"string\");\r\n    pm.expect(Number(list.CustomerZipcode)).to.be.a(\"number\");\r\n    pm.expect(Number(list.CustomerPhone)).to.be.a(\"number\");\r\n    pm.expect(list.CustomerCurrency).not.null;\r\n    pm.expect(list.CustomerLanguage).not.null;\r\n    pm.expect(Number(list.SiteId)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.FirstInvoiceDate)).to.be.a(\"date\");\r\n    pm.expect(Number(list.PaymentDetails.CustomerID)).to.be.a(\"number\");\r\n    pm.expect(list.PaymentDetails.Token).to.be.a(\"string\");\r\n    pm.expect(Number(list.PaymentDetails.LastFourDigits)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.PaymentDetails.ExpiryDate)).to.be.a(\"date\");\r\n});"]}}],"id":"0f8122cb-4b81-4fea-be92-06e8454c87ca","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Account/GetCustomer/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Account","GetCustomer","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"0f8122cb-4b81-4fea-be92-06e8454c87ca"},{"name":"Account Get Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(list.SiteId).to.be.greaterThan(0);\r\n    pm.expect(list.Username).to.be.a(\"string\");\r\n    pm.expect(list.Email).is.include(\"@\");\r\n    pm.expect(list.IsActive).to.be.true;\r\n    pm.expect(Number(list.MaxContacts)).to.be.a(\"number\");\r\n    pm.expect(list.FirstName).to.be.null;\r\n    pm.expect(Number(list.CustomerId)).to.be.a(\"number\");\r\n    pm.expect(list.AccountType).to.be.null;\r\n    pm.expect(list.Phone).to.be.null;\r\n    pm.expect(new Date(list.CreatedAt)).to.be.a(\"date\");\r\n    pm.expect(list.ConversionDate).to.be.null;\r\n});"]}}],"id":"03dc075c-b9c5-490c-a899-2e80edec6096","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Account/GetAccount/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Account","GetAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"03dc075c-b9c5-490c-a899-2e80edec6096"},{"name":"Account Get Accounts For Affiliator","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\", function () {\r\n    pm.expect(Number(jsonResponse.CustomerID)).to.be.a(\"number\");\r\n    pm.expect(jsonResponse.Records).to.be.an('array');\r\n});"]}}],"id":"9b21616d-6237-4c92-af9d-6f14f36e5762","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Account/GetAccountsForAffiliator/{{AtpBusiness_ServiceSiteId}}?page=1&pageSize=3","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Account","GetAccountsForAffiliator","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"3"}],"variable":[]}},"response":[],"_postman_id":"9b21616d-6237-4c92-af9d-6f14f36e5762"}],"id":"93f3a6b3-4cbc-4460-9bb0-c2aa94314187","_postman_id":"93f3a6b3-4cbc-4460-9bb0-c2aa94314187","description":"","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}}},{"name":"Affiliate","item":[{"name":"Affiliate Get Users For Affiliator By Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.Affiliator).to.be.a(\"string\");\r\n    pm.expect(Number(list.SiteId)).to.be.a(\"number\");\r\n    pm.expect(list.userName).to.be.a(\"string\");\r\n    pm.expect(list.FullName).to.be.a(\"string\");\r\n    pm.expect(Number(list.MaxContacts)).to.be.a(\"number\");\r\n    pm.expect(Number(list.CustomerId)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.DateStamp)).to.be.a(\"date\");\r\n});"]}}],"id":"0fb78c9c-2f07-4ea7-abcf-ca5bbb29c06f","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Affiliate/GetUsersForAffiliatorByAccount/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Affiliate","GetUsersForAffiliatorByAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"0fb78c9c-2f07-4ea7-abcf-ca5bbb29c06f"},{"name":"Affiliate Get Users For Affiliator By Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.Affiliator).to.be.a(\"string\");\r\n    pm.expect(Number(list.SiteId)).to.be.a(\"number\");\r\n    pm.expect(list.userName).to.be.a(\"string\");\r\n    pm.expect(list.FullName).to.be.a(\"string\");\r\n    pm.expect(Number(list.MaxContacts)).to.be.a(\"number\");\r\n    pm.expect(Number(list.CustomerId)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.DateStamp)).to.be.a(\"date\");\r\n});"]}}],"id":"d544eaf0-cdbc-4771-8db0-22fa55022a8a","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Affiliate/GetUsersForAffiliatorByCustomer/{{AtpBusiness_ServiceCustomerId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Affiliate","GetUsersForAffiliatorByCustomer","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d544eaf0-cdbc-4771-8db0-22fa55022a8a"},{"name":"Affiliate Get Users For Affiliator By Username","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.Affiliator).to.be.a(\"string\");\r\n    pm.expect(Number(list.SiteId)).to.be.a(\"number\");\r\n    pm.expect(list.userName).to.be.a(\"string\");\r\n    pm.expect(list.FullName).to.be.a(\"string\");\r\n    pm.expect(Number(list.MaxContacts)).to.be.a(\"number\");\r\n    pm.expect(Number(list.CustomerId)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.DateStamp)).to.be.a(\"date\");\r\n});"]}}],"id":"a655456a-d2f2-4b9e-b710-a62cdc793985","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Affiliate/GetUsersForAffiliatorByUsername/{{AtpBusiness_ServiceUsername}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Affiliate","GetUsersForAffiliatorByUsername","{{AtpBusiness_ServiceUsername}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a655456a-d2f2-4b9e-b710-a62cdc793985"},{"name":"Affiliate Get Affiliates Count","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(Number(jsonResponse)).to.be.a(\"number\");\r\n});"]}}],"id":"cfd4052e-5f22-490c-8d8b-ec1ba3910942","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Affiliate/GetAffiliatesCount/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Affiliate","GetAffiliatesCount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"cfd4052e-5f22-490c-8d8b-ec1ba3910942"}],"id":"c3851290-769b-46ed-9942-8b93d64507fb","_postman_id":"c3851290-769b-46ed-9942-8b93d64507fb","description":"","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}}},{"name":"Customer","item":[{"name":"Customer Get Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(Number(jsonResponse.CustomerID)).to.be.a(\"number\");\r\n    pm.expect(jsonResponse.CustomerName).to.be.a(\"string\");\r\n    pm.expect(jsonResponse.CustomerUserName).to.be.a(\"string\");\r\n    pm.expect(jsonResponse.CustomerFirstName).to.be.a(\"string\");\r\n    pm.expect(jsonResponse.CustomerLastName).to.be.a(\"string\");\r\n    pm.expect(jsonResponse.CustomerEmail).is.include(\"@\");\r\n    pm.expect(jsonResponse.CustomerCity).to.be.a(\"string\");\r\n    pm.expect(jsonResponse.CustomerAddress).to.be.a(\"string\");\r\n    pm.expect(Number(jsonResponse.CustomerZipcode)).to.be.a(\"number\");\r\n    pm.expect(Number(jsonResponse.CustomerPhone)).to.be.a(\"number\");\r\n    pm.expect(jsonResponse.CustomerCurrency).not.null;\r\n    pm.expect(jsonResponse.CustomerLanguage).not.null;\r\n    pm.expect(Number(jsonResponse.SiteId)).to.be.a(\"number\");\r\n    pm.expect(new Date(jsonResponse.FirstInvoiceDate)).to.be.a(\"date\");\r\n    pm.expect(Number(jsonResponse.PaymentDetails.CustomerID)).to.be.a(\"number\");\r\n    pm.expect(jsonResponse.PaymentDetails.Token).to.be.a(\"string\");\r\n    pm.expect(Number(jsonResponse.PaymentDetails.LastFourDigits)).to.be.a(\"number\");\r\n    pm.expect(new Date(jsonResponse.PaymentDetails.ExpiryDate)).to.be.a(\"date\");\r\n});"]}}],"id":"c68d5e0b-d848-4001-a2d6-27a613d040c7","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Customer/GetCustomer/{{AtpBusiness_ServiceCustomerId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Customer","GetCustomer","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c68d5e0b-d848-4001-a2d6-27a613d040c7"},{"name":"Customer Get Customer By Site Id","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(Number(jsonResponse.CustomerID)).to.be.a(\"number\");\r\n    pm.expect(jsonResponse.CustomerName).to.be.a(\"string\");\r\n    pm.expect(jsonResponse.CustomerUserName).to.be.a(\"string\");\r\n    pm.expect(jsonResponse.CustomerFirstName).to.be.a(\"string\");\r\n    pm.expect(jsonResponse.CustomerLastName).to.be.a(\"string\");\r\n    pm.expect(jsonResponse.CustomerEmail).is.include(\"@\");\r\n    pm.expect(jsonResponse.CustomerCity).to.be.a(\"string\");\r\n    pm.expect(jsonResponse.CustomerAddress).to.be.a(\"string\");\r\n    pm.expect(Number(jsonResponse.CustomerZipcode)).to.be.a(\"number\");\r\n    pm.expect(Number(jsonResponse.CustomerPhone)).to.be.a(\"number\");\r\n    pm.expect(jsonResponse.CustomerCurrency).not.null;\r\n    pm.expect(jsonResponse.CustomerLanguage).not.null;\r\n    pm.expect(jsonResponse.CompanyName === null || typeof jsonResponse.CompanyName === \"string\").to.be.true;\r\n    pm.expect(Number(jsonResponse.SiteId)).to.be.a(\"number\");\r\n    pm.expect(new Date(jsonResponse.FirstInvoiceDate)).to.be.a(\"date\");\r\n    pm.expect(Number(jsonResponse.PaymentDetails.CustomerID)).to.be.a(\"number\");\r\n    pm.expect(jsonResponse.PaymentDetails.Token).to.be.a(\"string\");\r\n    pm.expect(Number(jsonResponse.PaymentDetails.LastFourDigits)).to.be.a(\"number\");\r\n    pm.expect(new Date(jsonResponse.PaymentDetails.ExpiryDate)).to.be.a(\"date\");\r\n});"]}}],"id":"6d6a27a9-2454-4349-bdae-ebb7e922e801","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Customer/GetCustomerBySiteId/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Customer","GetCustomerBySiteId","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6d6a27a9-2454-4349-bdae-ebb7e922e801"},{"name":"Customer Get Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(Number(jsonResponse.SiteId)).to.be.a(\"number\");\r\n    pm.expect(jsonResponse.Username).to.be.a(\"string\");\r\n    pm.expect(jsonResponse.Email).is.include(\"@\");\r\n    pm.expect(jsonResponse.IsActive).to.be.true;\r\n    pm.expect(Number(jsonResponse.MaxContacts)).to.be.a(\"number\");\r\n    pm.expect(jsonResponse.FirstName).to.be.null;\r\n    pm.expect(jsonResponse.LastName).to.be.null;\r\n    pm.expect(Number(jsonResponse.CustomerId)).to.be.a(\"number\");\r\n    pm.expect(jsonResponse.AccountType).to.be.null;\r\n    pm.expect(jsonResponse.Phone).to.be.null;\r\n    pm.expect(new Date(jsonResponse.CreatedAt)).to.be.a(\"date\");\r\n    pm.expect(jsonResponse.ConversionDate).to.be.null;\r\n});"]}}],"id":"0ac3f4c8-9e08-4251-a2cd-526ecb4a25c4","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Customer/GetAccount/{{AtpBusiness_ServiceCustomerId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Customer","GetAccount","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"0ac3f4c8-9e08-4251-a2cd-526ecb4a25c4"},{"name":"Customer Update Payment Details","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\nlet ErrorCode = \"IdWrongFormat\";\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(jsonResponse.Customer === null || typeof jsonResponse.Customer === 'string').to.be.true;\r\n    pm.expect(jsonResponse.ErrorCode = ErrorCode);\r\n    pm.expect(jsonResponse.ErrorMessage).is.include(\"ValidateId\");\r\n});"]}}],"id":"077b3e85-1e5e-4b93-baa8-5b07366f04e8","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"},{"key":"Accept","value":"application/json"}],"body":{"mode":"urlencoded","urlencoded":[{"key":"ExpiryDate","value":"1"},{"key":"CreditCardNumber","value":"1"},{"key":"CVV","value":"1"},{"key":"CardType","value":"1"},{"key":"Id","value":"1"},{"key":"Token","value":"1"},{"key":"SiteId","value":"{{AtpBusiness_ServiceSiteId}}"}]},"url":"{{AtpBusiness_ServiceBaseUrl}}/Customer/UpdatePaymentDetails/{{AtpBusiness_ServiceCustomerId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Customer","UpdatePaymentDetails","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"077b3e85-1e5e-4b93-baa8-5b07366f04e8"}],"id":"8f172502-3676-4c9b-a59a-a563b855a286","_postman_id":"8f172502-3676-4c9b-a59a-a563b855a286","description":"","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}}},{"name":"Invoice","item":[{"name":"Invoice Get Invoices For Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.InvoiceID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceCustomerID)).to.be.a(\"number\");\r\n    pm.expect(list.InvoiceCustomerName).to.be.a(\"string\");\r\n    pm.expect(list.InvoiceCustomerContact).to.be.a(\"string\");\r\n    pm.expect(list.InvoiceCustomerAddress).to.be.a(\"string\");\r\n    pm.expect(list.InvoiceCustomerCityState).to.be.a(\"string\");\r\n    pm.expect(new Date(list.InvoiceDate)).to.be.a(\"date\");\r\n    pm.expect(list.InvoiceCurrency).not.null;\r\n    pm.expect(Number(list.InvoiceDolarRate)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceLanguage)).not.null;\r\n    pm.expect(Number(list.InvoiceTax1Precent)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceTax1)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceTax2Precent)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceTax2)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceTotal)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoicePaidAmount)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoicesPaidReceipts)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceCustomerHP)).to.be.a(\"number\");\r\n});"]}}],"id":"ecd0160a-5bd7-4c2e-ac49-eb92426f1568","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Invoice/GetInvoicesForAccount/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Invoice","GetInvoicesForAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"ecd0160a-5bd7-4c2e-ac49-eb92426f1568"},{"name":"Invoice Get Invoices For Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.InvoiceID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceCustomerID)).to.be.a(\"number\");\r\n    pm.expect(list.InvoiceCustomerName).to.be.a(\"string\");\r\n    pm.expect(list.InvoiceCustomerContact).to.be.a(\"string\");\r\n    pm.expect(list.InvoiceCustomerAddress).to.be.a(\"string\");\r\n    pm.expect(list.InvoiceCustomerCityState).to.be.a(\"string\");\r\n    pm.expect(new Date(list.InvoiceDate)).to.be.a(\"date\");\r\n    pm.expect(list.InvoiceCurrency).not.null;\r\n    pm.expect(Number(list.InvoiceDolarRate)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceLanguage)).not.null;\r\n    pm.expect(Number(list.InvoiceTax1Precent)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceTax1)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceTax2Precent)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceTax2)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceTotal)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoicePaidAmount)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoicesPaidReceipts)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceCustomerHP)).to.be.a(\"number\");\r\n});"]}}],"id":"fb45d067-158f-4af1-8b64-62506a476dce","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Invoice/GetInvoicesForCustomer/{{AtpBusiness_ServiceCustomerId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Invoice","GetInvoicesForCustomer","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"fb45d067-158f-4af1-8b64-62506a476dce"},{"name":"Invoice Get Invoice Details","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(Number(list.Invoice.InvoiceID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Invoice.InvoiceCustomerID)).to.be.a(\"number\");\r\n    pm.expect(list.Invoice.InvoiceCustomerName).to.be.a(\"string\");\r\n    pm.expect(list.Invoice.InvoiceCustomerContact).to.be.a(\"string\");\r\n    pm.expect(list.Invoice.InvoiceCustomerAddress).to.be.a(\"string\");\r\n    pm.expect(list.Invoice.InvoiceCustomerCityState).to.be.a(\"string\");\r\n    pm.expect(new Date(list.Invoice.InvoiceDate)).to.be.a(\"date\");\r\n    pm.expect(list.Invoice.InvoiceCurrency).not.null;\r\n    pm.expect(Number(list.Invoice.InvoiceDolarRate)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Invoice.InvoiceLanguage)).not.null;\r\n    pm.expect(Number(list.Invoice.InvoiceTax1Precent)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Invoice.InvoiceTax1)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Invoice.InvoiceTax2Precent)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Invoice.InvoiceTax2)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Invoice.InvoiceTotal)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Invoice.InvoicePaidAmount)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Invoice.InvoicesPaidReceipts)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Invoice.InvoiceCustomerHP)).to.be.a(\"number\");\r\n});"]}}],"id":"fe3a26d9-92ff-43d1-9d1f-ce3bd97de62e","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Invoice/GetInvoiceDetails/{{AtpBusiness_ServiceInvoiceId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Invoice","GetInvoiceDetails","{{AtpBusiness_ServiceInvoiceId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"fe3a26d9-92ff-43d1-9d1f-ce3bd97de62e"},{"name":"Invoice Send Invoice","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(jsonResponse = true);\r\n});"]}}],"id":"f4e595ed-b696-4902-8a9f-0742cd6b1ce3","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\r\n    \"invoiceId\": {{AtpBusiness_ServiceInvoiceId}},\r\n    \"customerId\": {{AtpBusiness_ServiceCustomerId}},\r\n    \"adminId\": 0\r\n}","options":{"raw":{"language":"json"}}},"url":"{{AtpBusiness_ServiceBaseUrl}}/Invoice/Send/{{AtpBusiness_ServiceInvoiceId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Invoice","Send","{{AtpBusiness_ServiceInvoiceId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f4e595ed-b696-4902-8a9f-0742cd6b1ce3"}],"id":"c2e0810a-5365-4e32-9171-21c85fcba910","_postman_id":"c2e0810a-5365-4e32-9171-21c85fcba910","description":"","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}}},{"name":"Receipt","item":[{"name":"Receipt Get Receipts For Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.ReceiptID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ReceiptCustomerID)).to.be.a(\"number\");\r\n    pm.expect(list.ReceiptCustomerName).to.be.a(\"string\");\r\n    pm.expect(list.ReceiptCustomerContact).to.be.a(\"string\");\r\n    pm.expect(list.ReceiptCustomerAddress).to.be.a(\"string\");\r\n    pm.expect(list.ReceiptCustomerCityState).to.be.a(\"string\");\r\n    pm.expect(new Date(list.ReceiptDate)).to.be.a(\"date\");\r\n    pm.expect(Number(list.ReceiptDolarRate)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ReceiptLanguage)).not.null;\r\n    pm.expect(Number(list.ReceiptTotal)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ReceiptPayMethod)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ReceiptAppliedAmount)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ReceiptAppliedInvoices)).to.be.a(\"number\");\r\n});"]}}],"id":"ee53deed-3c5d-4a07-95b8-ea821f24e61f","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Receipt/GetReceiptsForAccount/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Receipt","GetReceiptsForAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"ee53deed-3c5d-4a07-95b8-ea821f24e61f"},{"name":"Receipt Get Receipt For Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.ReceiptID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ReceiptCustomerID)).to.be.a(\"number\");\r\n    pm.expect(list.ReceiptCustomerName).to.be.a(\"string\");\r\n    pm.expect(list.ReceiptCustomerContact).to.be.a(\"string\");\r\n    pm.expect(list.ReceiptCustomerAddress).to.be.a(\"string\");\r\n    pm.expect(list.ReceiptCustomerCityState).to.be.a(\"string\");\r\n    pm.expect(new Date(list.ReceiptDate)).to.be.a(\"date\");\r\n    pm.expect(Number(list.ReceiptDolarRate)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ReceiptLanguage)).not.null;\r\n    pm.expect(Number(list.ReceiptTotal)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ReceiptPayMethod)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ReceiptAppliedAmount)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ReceiptAppliedInvoices)).to.be.a(\"number\");\r\n});"]}}],"id":"bf527cce-9955-4950-bec6-38a170ed7716","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Receipt/GetReceiptForCustomer/{{AtpBusiness_ServiceCustomerId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Receipt","GetReceiptForCustomer","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"bf527cce-9955-4950-bec6-38a170ed7716"},{"name":"Receipt Get Receipt Details","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    pm.expect(Number(list.Receipt.ReceiptID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Receipt.ReceiptCustomerID)).to.be.a(\"number\");\r\n    pm.expect(list.Receipt.ReceiptCustomerName).not.null;\r\n    pm.expect(list.Receipt.ReceiptCustomerContact).not.null;\r\n    pm.expect(list.Receipt.ReceiptCustomerAddress).not.null;\r\n    pm.expect(list.Receipt.ReceiptCustomerCityState).not.null;\r\n    pm.expect(new Date(list.Receipt.ReceiptDate)).to.be.a(\"date\");\r\n    pm.expect(Number(list.Receipt.ReceiptDolarRate)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Receipt.ReceiptLanguage)).not.null;\r\n    pm.expect(Number(list.Receipt.ReceiptTotal)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Receipt.ReceiptPayMethod)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Receipt.ReceiptAppliedAmount)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Receipt.ReceiptAppliedInvoices)).to.be.a(\"number\");\r\n});"]}}],"id":"414ad6f0-9e03-40bc-8d62-5169da4074c0","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Receipt/GetReceiptDetails/{{AtpBusiness_ServiceReceiptId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Receipt","GetReceiptDetails","{{AtpBusiness_ServiceReceiptId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"414ad6f0-9e03-40bc-8d62-5169da4074c0"},{"name":"Receipt Send Receipt","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(jsonResponse = true);\r\n});"]}}],"id":"9f40bf1e-419b-4321-ad62-21cfcf5b7c71","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\r\n    \"receiptId\": {{AtpBusiness_ServiceReceiptId}},\r\n    \"customerId\": {{AtpBusiness_ServiceCustomerId}},\r\n    \"adminId\": 0\r\n}","options":{"raw":{"language":"json"}}},"url":"{{AtpBusiness_ServiceBaseUrl}}/Receipt/Send/{{AtpBusiness_ServiceReceiptId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Receipt","Send","{{AtpBusiness_ServiceReceiptId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9f40bf1e-419b-4321-ad62-21cfcf5b7c71"}],"id":"77a26ac2-d19f-47fb-89da-4deaef358dd0","_postman_id":"77a26ac2-d19f-47fb-89da-4deaef358dd0","description":"","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}}},{"name":"Reports","item":[{"name":"Reports Account Management By Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\nlet ReferenceType = \"Invoice\";\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.ReferenceID)).to.be.a(\"number\");\r\n    pm.expect(list.ReferenceType).to.be.a(\"string\");\r\n    pm.expect(new Date(list.ReferenceDate)).to.be.a(\"date\");\r\n    pm.expect(list.CustomerName).to.be.a(\"string\");\r\n    pm.expect(Number(list.TotalAmount)).to.be.a(\"number\");\r\n    pm.expect(Number(list.AmountApplied)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailInvoiceID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailServiceID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailItemID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailPrice)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailQuantity)).to.be.a(\"number\");\r\n});"]}}],"id":"7c917b30-defa-45f0-bdcc-2a0cbdece074","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/AccountManagementByAccount/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","AccountManagementByAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7c917b30-defa-45f0-bdcc-2a0cbdece074"},{"name":"Reports Account Management By Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.ReferenceID)).to.be.a(\"number\");\r\n    pm.expect(list.ReferenceType).to.be.a(\"string\");\r\n    pm.expect(new Date(list.ReferenceDate)).to.be.a(\"date\");\r\n    pm.expect(list.CustomerName).to.be.a(\"string\");\r\n    pm.expect(Number(list.TotalAmount)).to.be.a(\"number\");\r\n    pm.expect(Number(list.AmountApplied)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailInvoiceID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailServiceID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailItemID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailPrice)).to.be.a(\"number\");\r\n    pm.expect(Number(list.InvoiceDetailQuantity)).to.be.a(\"number\");\r\n});"]}}],"id":"5f83b72e-da60-4f55-b423-d42d122ca4fd","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/AccountManagementByCustomer/{{AtpBusiness_ServiceCustomerId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","AccountManagementByCustomer","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"5f83b72e-da60-4f55-b423-d42d122ca4fd"},{"name":"Reports Calculate Total Invoices By Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.TotalSum)).to.be.a(\"number\");\r\n    pm.expect(list.ItemName).to.be.a(\"string\");\r\n    pm.expect(Number(list.ServiceID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ServiceCustomerID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ServiceItemListID)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.ServiceStartDate)).to.be.a(\"date\");\r\n    pm.expect(new Date(list.ServiceEndDate)).to.be.a(\"date\");\r\n    pm.expect(Number(list.ServiceVer)).to.be.a(\"number\");\r\n    pm.expect(list.ServiceShowName).to.be.a(\"string\");\r\n});"]}}],"id":"082f9b35-66e6-46cc-9683-734eea5a31db","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/CalculateTotalInvoicesByCustomer/{{AtpBusiness_ServiceCustomerId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","CalculateTotalInvoicesByCustomer","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"082f9b35-66e6-46cc-9683-734eea5a31db"},{"name":"Reports Calculate Total Invoices By Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.TotalSum)).to.be.a(\"number\");\r\n    pm.expect(list.ItemName).to.be.a(\"string\");\r\n    pm.expect(Number(list.ServiceID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ServiceCustomerID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ServiceItemListID)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.ServiceStartDate)).to.be.a(\"date\");\r\n    pm.expect(new Date(list.ServiceEndDate)).to.be.a(\"date\");\r\n    pm.expect(Number(list.ServiceVer)).to.be.a(\"number\");\r\n    pm.expect(list.ServiceShowName).to.be.a(\"string\");\r\n});"]}}],"id":"c5d72a06-412e-450c-b6e7-e041a044c685","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/CalculateTotalInvoicesByAccount/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","CalculateTotalInvoicesByAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c5d72a06-412e-450c-b6e7-e041a044c685"},{"name":"Reports Get Paying Affiliates By Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    if(!jsonResponse.length)\r\n        return;\r\n    let list = jsonResponse[0];    \r\n    pm.expect(list.Affiliator).to.be.a(\"string\");\r\n    pm.expect(Number(list.SiteId)).to.be.a(\"number\");\r\n    pm.expect(list.userName).to.be.a(\"string\");\r\n    pm.expect(list.FullName).to.be.a(\"string\");\r\n    pm.expect(Number(list.MaxContacts)).to.be.a(\"number\");\r\n    pm.expect(Number(list.CustomerId)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.DateStamp)).to.be.a(\"date\");\r\n});"]}}],"id":"33aef6b2-c46a-481e-b8a4-9ee8fc474124","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/GetPayingAffiliatesByAccount/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","GetPayingAffiliatesByAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"33aef6b2-c46a-481e-b8a4-9ee8fc474124"},{"name":"Reports Get Paying Affiliates By Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    if(!jsonResponse.length)\r\n        return;\r\n    let list = jsonResponse[0];\r\n    pm.expect(list.Affiliator).to.be.a(\"string\");\r\n    pm.expect(Number(list.SiteId)).to.be.a(\"number\");\r\n    pm.expect(list.userName).to.be.a(\"string\");\r\n    pm.expect(list.FullName).to.be.a(\"string\");\r\n    pm.expect(Number(list.MaxContacts)).to.be.a(\"number\");\r\n    pm.expect(Number(list.CustomerId)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.DateStamp)).to.be.a(\"date\");\r\n});"]}}],"id":"bc29e4a5-2543-4cbd-b47b-7ca33ca18569","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/GetPayingAffiliatesByCustomer/{{AtpBusiness_ServiceCustomerId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","GetPayingAffiliatesByCustomer","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"bc29e4a5-2543-4cbd-b47b-7ca33ca18569"},{"name":"Reports Get Commission Payments History By Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.CommissionId)).to.be.a(\"number\");\r\n    pm.expect(Number(list.TotalAmount)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.DatePaid)).to.be.a(\"date\");\r\n    pm.expect(list.Currency).not.null;\r\n    pm.expect(Number(list.ServiceGroupId)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Amount)).to.be.a(\"number\");\r\n    pm.expect(Number(list.CommissionRate)).to.be.a(\"number\");\r\n});"]}}],"id":"17156a1b-9302-4fff-af08-26936869ae45","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/GetCommissionPaymentsHistoryByCustomer/{{AtpBusiness_ServiceCustomerId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","GetCommissionPaymentsHistoryByCustomer","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"17156a1b-9302-4fff-af08-26936869ae45"},{"name":"Reports Get Commission Payments History By Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.CommissionId)).to.be.a(\"number\");\r\n    pm.expect(Number(list.TotalAmount)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.DatePaid)).to.be.a(\"date\");\r\n    pm.expect(list.Currency).not.null;\r\n    pm.expect(Number(list.ServiceGroupId)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Amount)).to.be.a(\"number\");\r\n    pm.expect(Number(list.CommissionRate)).to.be.a(\"number\");\r\n});"]}}],"id":"40407178-0733-450e-a4a6-35b2709409fb","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/GetCommissionPaymentsHistoryByAccount/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","GetCommissionPaymentsHistoryByAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"40407178-0733-450e-a4a6-35b2709409fb"},{"name":"Reports Get Calculate Commission Payment By Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(jsonResponse).not.null;\r\n    pm.expect(jsonResponse).to.be.a(\"array\");\r\n});"]}}],"id":"e83737c8-c385-4000-9bf1-00787f407f43","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/GetCalculateCommissionPaymentByCustomer/{{AtpBusiness_ServiceCustomerId}}?toDate=01/04/2020","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","GetCalculateCommissionPaymentByCustomer","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[{"description":{"content":"<p>(Required) </p>\n","type":"text/plain"},"key":"toDate","value":"01/04/2020"}],"variable":[]}},"response":[],"_postman_id":"e83737c8-c385-4000-9bf1-00787f407f43"},{"name":"Reports Get Calculate Commission Payment By Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(jsonResponse).not.null;\r\n    pm.expect(jsonResponse).to.be.a(\"array\");\r\n});"]}}],"id":"5868d404-e47b-4869-abab-8471140a01f7","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/GetCalculateCommissionPaymentByAccount/{{AtpBusiness_ServiceSiteId}}?toDate=01/04/2020","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","GetCalculateCommissionPaymentByAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[{"description":{"content":"<p>(Required) </p>\n","type":"text/plain"},"key":"toDate","value":"01/04/2020"}],"variable":[]}},"response":[],"_postman_id":"5868d404-e47b-4869-abab-8471140a01f7"},{"name":"Reports Put Commission Payment By Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test(\"Status code is 204 (DEV) or 500 (PROD)\", function () {\r\n    if(pm.environment.name === \"Smoove-PROD\") //No comissions should be payed in production\r\n        pm.response.to.have.status(500); \r\n    else    \r\n        pm.response.to.have.status(204);\r\n});"]}}],"id":"76adca9d-868a-4533-9311-ee209e63a7b9","request":{"method":"PUT","header":[],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/PutCommissionPaymentByCustomer/{{AtpBusiness_ServiceCustomerId}}?toDate=01/04/2023&fromDate=01/04/2020","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","PutCommissionPaymentByCustomer","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[{"description":{"content":"<p>(Required) </p>\n","type":"text/plain"},"key":"toDate","value":"01/04/2023"},{"key":"fromDate","value":"01/04/2020"}],"variable":[]}},"response":[],"_postman_id":"76adca9d-868a-4533-9311-ee209e63a7b9"},{"name":"Reports Put Commission Payment By Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test(\"Status code is 204 (DEV) or 500 (PROD)\", function () {\r\n    if(pm.environment.name === \"Smoove-PROD\") //No comissions should be payed in production\r\n        pm.response.to.have.status(500); \r\n    else    \r\n        pm.response.to.have.status(204);\r\n});"]}}],"id":"a9bc6f7b-93dc-4ffd-bd03-d762d59bdc16","request":{"method":"PUT","header":[],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/PutCommissionPaymentByAccount/{{AtpBusiness_ServiceSiteId}}?toDate=01/04/2023&fromDate=01/04/2020","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","PutCommissionPaymentByAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[{"key":"toDate","value":"01/04/2023"},{"key":"fromDate","value":"01/04/2020"}],"variable":[]}},"response":[],"_postman_id":"a9bc6f7b-93dc-4ffd-bd03-d762d59bdc16"},{"name":"Reports Get Calculate Commission Payment Details By Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(jsonResponse).not.null;\r\n    pm.expect(jsonResponse).to.be.a(\"array\");\r\n});"]}}],"id":"3f5cd092-b753-42fc-89d6-59e129277707","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/GetCalculateCommissionPaymentDetailsByCustomer/{{AtpBusiness_ServiceCustomerId}}?toDate=01/04/2021&fromDate=01/04/2020","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","GetCalculateCommissionPaymentDetailsByCustomer","{{AtpBusiness_ServiceCustomerId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[{"description":{"content":"<p>(Required) </p>\n","type":"text/plain"},"key":"toDate","value":"01/04/2021"},{"key":"fromDate","value":"01/04/2020"}],"variable":[]}},"response":[],"_postman_id":"3f5cd092-b753-42fc-89d6-59e129277707"},{"name":"Reports Get Calculate Commission Payment Details By Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(jsonResponse).not.null;\r\n    pm.expect(jsonResponse).to.be.a(\"array\");\r\n});"]}}],"id":"550cc3af-ddc5-4891-8a52-16dd4ebcc370","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/GetCalculateCommissionPaymentDetailsByAccount/{{AtpBusiness_ServiceSiteId}}?toDate=01/04/2021&fromDate=01/04/2020&dollarToNisRate=0","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","GetCalculateCommissionPaymentDetailsByAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[{"description":{"content":"<p>(Required) </p>\n","type":"text/plain"},"key":"toDate","value":"01/04/2021"},{"key":"fromDate","value":"01/04/2020"},{"key":"dollarToNisRate","value":"0"}],"variable":[]}},"response":[],"_postman_id":"550cc3af-ddc5-4891-8a52-16dd4ebcc370"},{"name":"Reports Get Affiliates Payments","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse;\r\n    console.log(list);\r\n    pm.expect(Number(list.FreeAccounts)).to.be.a(\"number\");\r\n    pm.expect(Number(list.PayingAccounts)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.PaymentDate)).to.be.a(\"date\");\r\n    pm.expect(Number(list.TotalAmount)).to.be.a(\"number\");\r\n    pm.expect(list.ServicePayments).to.be.a(\"array\");\r\n    pm.expect(Number(list.CommissionRate)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Amount)).to.be.a(\"number\");\r\n    pm.expect(list.Currency).not.null;\r\n    pm.expect(list.AffiliatePayments).to.be.a(\"array\");\r\n    pm.expect(Number(list.SiteId)).to.be.a(\"number\");\r\n    pm.expect(Number(list.Amount)).to.be.a(\"number\");\r\n});"]}}],"id":"7ccf1f02-811e-4082-bf28-2565a291dbbc","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Reports/GetAffiliatesPayments/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Reports","GetAffiliatesPayments","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7ccf1f02-811e-4082-bf28-2565a291dbbc"}],"id":"33227071-777d-423e-b8e0-abe02eed70f4","_postman_id":"33227071-777d-423e-b8e0-abe02eed70f4","description":"","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}}},{"name":"Service","item":[{"name":"Service Get Receipt For Account","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.ServiceID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ServiceCustomerID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ServiceItemListID)).to.be.a(\"number\");\r\n    pm.expect(new Date(list.ServiceStartDate)).to.be.a(\"date\");\r\n    pm.expect(new Date(list.ServiceEndDate)).to.be.a(\"date\");\r\n    pm.expect(Number(list.ServiceVer)).to.be.a(\"number\");\r\n    pm.expect(list.serviceShowName).to.be.a(\"string\");\r\n});"]}}],"id":"e16d9463-9f87-4c1d-838a-4abb53325a87","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Service/GetServiceForAccount/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Service","GetServiceForAccount","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e16d9463-9f87-4c1d-838a-4abb53325a87"},{"name":"Service Get Receipt For Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    let list = jsonResponse[0];\r\n    pm.expect(Number(list.ItemID)).to.be.a(\"number\");\r\n    pm.expect(Number(list.ItemParent)).to.be.a(\"number\");\r\n    pm.expect(list.ItemProgName).to.be.a(\"string\");\r\n    pm.expect(list.ItemName).to.be.a(\"string\");\r\n});"]}}],"id":"bb6fe92c-e478-46b9-b50d-668daca4af0b","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Service/GetAllServices","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Service","GetAllServices"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"bb6fe92c-e478-46b9-b50d-668daca4af0b"},{"name":"Service Get Receipt For Customer","event":[{"listen":"test","script":{"type":"text/javascript","exec":["let jsonResponse = pm.response.json();\r\n\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response item has all required properties\",function(){\r\n    pm.expect(jsonResponse).not.null;\r\n    pm.expect(jsonResponse).to.be.a(\"array\");\r\n});"]}}],"id":"cc0f28c8-0cfc-458e-bbed-ba1533df00ce","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{AtpBusiness_ServiceBaseUrl}}/Service/GetServiceForCustomer/{{AtpBusiness_ServiceSiteId}}","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}},"urlObject":{"path":["Service","GetServiceForCustomer","{{AtpBusiness_ServiceSiteId}}"],"host":["{{AtpBusiness_ServiceBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"cc0f28c8-0cfc-458e-bbed-ba1533df00ce"}],"id":"8b65bbef-0ef1-4fad-90e5-73aba607fc3d","_postman_id":"8b65bbef-0ef1-4fad-90e5-73aba607fc3d","description":"","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":true,"source":{"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","name":"Smoove.AtpBusiness","type":"folder"}}}],"id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apikey"},{"key":"value","value":"{{AtpBusiness_ServiceApiKey}}"}]},"isInherited":false},"_postman_id":"8fcb4858-b4ee-4e04-9bcc-f7641337db62","description":""},{"name":"ViplusMembers","item":[{"name":"click.smoove.io> snooze","event":[{"listen":"test","script":{"type":"text/javascript","exec":["//200\r\npm.test(\"Response status code is 200\", function () {\r\n    pm.expect(pm.response.code).to.equal(200);\r\n});\r\n\r\n//include tz-snooze\r\npm.test(\"Validate the URL includes /tz-snooze\", function () {\r\n    const body = pm.response.text();\r\n    \r\n    const match = body.match(/const\\s+baseUrl\\s*=\\s*['\"]([^'\"]+)['\"];?/);\r\n    pm.expect(match, \"baseUrl constant should be present in HTML response\").to.not.be.null;\r\n\r\n    const baseUrl = match[1];\r\n    pm.expect(baseUrl).to.match(/^\\/tz-snooze/);\r\n});\r\n\r\n//go to tz-snooze link to get 200\r\npm.test(\"Validate the redirect URL is 200\", function () {\r\n    const responseText = pm.response.text();\r\n\r\n// Extract baseUrl value from the HTML using regex\r\nconst MembersClickDomain = pm.environment.get(\"MembersClickDomain\");\r\nconst match = responseText.match(/const baseUrl = '([^']+)'/);\r\n    pm.expect(match, \"baseUrl not found in response\").to.not.be.null;\r\n\r\n    const baseUrl = match[1];\r\n    const fullUrl = \"https://\" + MembersClickDomain + baseUrl;\r\n\r\n    console.log(\"Testing URL:\", fullUrl);\r\n\r\n    pm.sendRequest(fullUrl, function (err, res) {\r\n        pm.expect(err).to.be.null;\r\n        pm.expect(res).to.have.status(200);\r\n    });\r\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","exec":["//Spoofing the user agent since running this request via \"newman cli\" uses a different user agent\r\npm.request.headers.add({ key: 'User-Agent', value: 'PostmanRuntime/7.52.x' }); "]}}],"id":"be2c3a83-008b-4110-9e69-9536773d76a2","request":{"method":"GET","header":[],"url":"https://{{MembersClickDomain}}{{SnoozeLink}}","urlObject":{"protocol":"https","host":["{{MembersClickDomain}}{{SnoozeLink}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"be2c3a83-008b-4110-9e69-9536773d76a2"}],"id":"917d2a03-a9c9-4032-9f65-3270c6ece1d1","_postman_id":"917d2a03-a9c9-4032-9f65-3270c6ece1d1","description":""},{"name":"Smoove.Studio","item":[{"name":"auth - authenticated","item":[{"name":"authenticated","item":[{"name":"Auth Is Authenticated","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Response time is < 30000ms\", function () {\n  pm.expect(pm.response.responseTime).to.be.below(30000);\n});\n\npm.test(\"Response status code is 200\", function () {\n    pm.expect(pm.response.code).to.equal(200);\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveStudioCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}}],"id":"fa743aef-f876-4215-840c-d63a9a01e38e","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveStudioBaseUrl}}auth/authenticated","urlObject":{"path":["authenticated"],"host":["{{smooveStudioBaseUrl}}auth"],"query":[],"variable":[]}},"response":[],"_postman_id":"fa743aef-f876-4215-840c-d63a9a01e38e"}],"id":"0d22f7a2-d60e-458c-8aac-7c0ae551df56","_postman_id":"0d22f7a2-d60e-458c-8aac-7c0ae551df56","description":""},{"name":"authorized","item":[{"name":"Auth Is Authorized","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test(\"Response status code is 200\", function () {\r\n    pm.expect(pm.response.code).to.equal(200);\r\n});\r\n\r\n\r\npm.test(\"Response time is less than 4000ms\", function () {\r\n    pm.expect(pm.response.responseTime).to.be.below(4000);\r\n});\r\n\r\n\r\npm.test(\"Response is an array with at least one element\", function () {\r\n    const responseData = pm.response.json();\r\n    \r\n    pm.expect(responseData).to.be.an('object');\r\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","exec":["let cookie = pm.environment.get(\"smooveStudioCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}}],"id":"46aec1d8-d74d-4c40-a905-9f45d89191fb","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveStudioBaseUrl}}auth/authorized","urlObject":{"path":["authorized"],"host":["{{smooveStudioBaseUrl}}auth"],"query":[],"variable":[]}},"response":[],"_postman_id":"46aec1d8-d74d-4c40-a905-9f45d89191fb"}],"id":"c97974bc-fc44-476d-bffc-e30020b5acda","_postman_id":"c97974bc-fc44-476d-bffc-e30020b5acda","description":""},{"name":"identities","item":[{"name":"Auth Get Identities","event":[{"listen":"test","script":{"type":"text/javascript","exec":["const json = pm.response.json();\r\n\r\npm.test(\"Response status code is 200\", function () {\r\n    pm.expect(pm.response.code).to.equal(200);\r\n});\r\n\r\npm.test(\"Response time is less than 4000ms\", function () {\r\n    pm.expect(pm.response.responseTime).to.be.below(4000);\r\n});\r\n\r\npm.test(\"Content-Type is JSON\", function () {\r\n    pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");\r\n});\r\n\r\npm.test(\"Response body is a valid JSON object\", function () {\r\n    pm.expect(json).to.be.an(\"object\");\r\n});\r\n\r\n// Schema\r\npm.test(\"Response contains mixpanelIdentity\", function () {\r\n    pm.expect(json).to.include.all.keys(\"mixpanelIdentity\");\r\n});\r\n\r\npm.test(\"mixpanelIdentity contains required fields\", function () {\r\n    pm.expect(json.mixpanelIdentity).to.include.all.keys(\"site_id\", \"user_id\", \"email\");\r\n});\r\n\r\n// Data types\r\npm.test(\"Field types are correct\", function () {\r\n    pm.expect(json.mixpanelIdentity.site_id).to.be.a(\"number\");\r\n    pm.expect(json.mixpanelIdentity.user_id).to.be.a(\"string\");\r\n    pm.expect(json.mixpanelIdentity.email).to.be.a(\"string\");\r\n});\r\n\r\n// Value validation\r\npm.test(\"Field values are valid\", function () {\r\n    pm.expect(json.mixpanelIdentity.site_id).to.be.greaterThan(0);    \r\n    pm.expect(json.mixpanelIdentity.user_id).to.not.be.empty;\r\n    pm.expect(Number(json.mixpanelIdentity.user_id)).to.not.be.NaN;\r\n    pm.expect(json.mixpanelIdentity.email).to.match(/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/);\r\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","exec":["let cookie = pm.environment.get(\"smooveStudioCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}}],"id":"13b5197a-43e3-4afd-bebe-7246fe2bf86b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveStudioBaseUrl}}auth/identities","urlObject":{"path":["identities"],"host":["{{smooveStudioBaseUrl}}auth"],"query":[],"variable":[]}},"response":[],"_postman_id":"13b5197a-43e3-4afd-bebe-7246fe2bf86b"}],"id":"815c9525-cd7d-408f-936f-fc20d7371110","_postman_id":"815c9525-cd7d-408f-936f-fc20d7371110","description":""},{"name":"exit","item":[{"name":"Auth Exit","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test(\"Response status code is 200\", function () {\r\n    pm.expect(pm.response.code).to.equal(200);\r\n});\r\n\r\n\r\npm.test(\"Response time is less than 4000ms\", function () {\r\n    pm.expect(pm.response.responseTime).to.be.below(4000);\r\n});\r\n\r\n\r\npm.test(\"Response is an array with at least one element\", function () {\r\n    const responseData = pm.response.json();\r\n    \r\n    pm.expect(responseData).to.be.an('object');\r\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","exec":["let cookie = pm.environment.get(\"smooveStudioCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}}],"id":"dabc8d52-4c74-47ee-ac9f-638c0822b519","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveStudioBaseUrl}}auth/exit","urlObject":{"path":["exit"],"host":["{{smooveStudioBaseUrl}}auth"],"query":[],"variable":[]}},"response":[],"_postman_id":"dabc8d52-4c74-47ee-ac9f-638c0822b519"}],"id":"88085e4f-8570-4572-afd5-f218f0f045a1","_postman_id":"88085e4f-8570-4572-afd5-f218f0f045a1","description":""}],"id":"aa28e64f-c5c4-4249-bb0a-5f5a2a15ee6b","_postman_id":"aa28e64f-c5c4-4249-bb0a-5f5a2a15ee6b","description":""},{"name":"generator","item":[{"name":"scratch","item":[{"name":"Generator Generate From Scratch","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Content-Type is application/json\", function () {\n    const ct = pm.response.headers.get(\"Content-Type\") || \"\";\n    pm.expect(ct).to.include(\"application/json\");\n});\n\nconst json = pm.response.json();\n\npm.test(\"Response JSON is a saved content item\", function () {\n    pm.expect(json, \"Expected response body to be a JSON object\").to.be.an(\"object\");\n    pm.expect(json).to.include.all.keys(\"id\", \"url\", \"html\", \"name\", \"formValidation\");\n    pm.expect(json.id).to.be.a(\"number\");\n    pm.expect(Number.isInteger(json.id)).to.be.true;\n    pm.expect(json.id).to.be.above(0);\n    pm.expect(json.url).to.be.a(\"string\").and.to.not.be.empty;\n    pm.expect(json.html).to.be.a(\"string\").and.to.not.be.empty;\n    pm.expect(json.name).to.be.a(\"string\").and.to.not.be.empty;\n    pm.expect(json.formValidation).to.be.an(\"object\");\n    pm.expect(json.formValidation.verdict).to.be.a(\"string\");\n    pm.expect(json.formValidation.verdictReasons).to.be.an(\"array\");\n    pm.expect([\"valid\", \"invalid\", \"noForm\"]).to.include(json.formValidation.verdict);\n});\n"]}},{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveStudioCookie\");\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst body = {\n    userPrompt: \"משתלת בוטיק עם עגלת קפה\",\n    language: \"Hebrew\",\n    provider: \"gemini\",\n    contentItemType: \"landingPage\",\n    generationMode: \"scratch\"\n};\n\npm.request.body.raw = JSON.stringify(body);\n"]}}],"id":"ee586d86-a771-4e56-9c0a-d9a634371e85","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"{{smooveStudioBaseUrl}}generator/contentItem","urlObject":{"path":["contentItem"],"host":["{{smooveStudioBaseUrl}}generator"],"query":[],"variable":[]}},"response":[],"_postman_id":"ee586d86-a771-4e56-9c0a-d9a634371e85"}],"id":"f7f71c19-f1ac-40fe-bb40-d0c5e0b2f8a2","_postman_id":"f7f71c19-f1ac-40fe-bb40-d0c5e0b2f8a2","description":""},{"name":"generate","item":[{"name":"Generator Generate For Template","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Content-Type is application/json\", function () {\n    const ct = pm.response.headers.get(\"Content-Type\") || \"\";\n    pm.expect(ct).to.include(\"application/json\");\n});\n\nconst json = pm.response.json();\n\npm.test(\"Response JSON is a saved content item\", function () {\n    pm.expect(json, \"Expected response body to be a JSON object\").to.be.an(\"object\");\n    pm.expect(json).to.include.all.keys(\"id\", \"url\", \"html\", \"name\", \"formValidation\");\n    pm.expect(json.id).to.be.a(\"number\");\n    pm.expect(Number.isInteger(json.id)).to.be.true;\n    pm.expect(json.id).to.be.above(0);\n    pm.expect(json.url).to.be.a(\"string\").and.to.not.be.empty;\n    pm.expect(json.html).to.be.a(\"string\").and.to.not.be.empty;\n    pm.expect(json.name).to.be.a(\"string\").and.to.not.be.empty;\n    pm.expect(json.formValidation).to.be.an(\"object\");\n    pm.expect(json.formValidation.verdict).to.be.a(\"string\");\n    pm.expect(json.formValidation.verdictReasons).to.be.an(\"array\");\n    pm.expect([\"valid\", \"invalid\", \"noForm\"]).to.include(json.formValidation.verdict);\n});\n"]}},{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveStudioCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst body = {\n    userPrompt: \"סדנת יוגה במדבר\",\n    language: \"Hebrew\",\n    provider: \"gemini\",\n    contentItemType: \"landingPage\",\n    templateId: pm.environment.get(\"smooveStudioTemplate\")\n};\n\npm.request.body.raw = JSON.stringify(body);\n"]}}],"id":"14168a17-2311-4836-9bca-3c1150dd928f","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"{{smooveStudioBaseUrl}}generator/contentItem","urlObject":{"path":["contentItem"],"host":["{{smooveStudioBaseUrl}}generator"],"query":[],"variable":[]}},"response":[],"_postman_id":"14168a17-2311-4836-9bca-3c1150dd928f"}],"id":"a72473f2-eefa-42a3-a769-51696e628368","_postman_id":"a72473f2-eefa-42a3-a769-51696e628368","description":""},{"name":"improve","item":[{"name":"Generator Improve Content","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const json = pm.response.json();\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Content-Type is application/json\", function () {\n    const ct = pm.response.headers.get(\"Content-Type\") || \"\";\n    pm.expect(ct).to.include(\"application/json\");\n});\n\npm.test(\"Response JSON is a saved content item\", function () {\n    pm.expect(json, \"Expected response body to be a JSON object\").to.be.an(\"object\");\n    pm.expect(json).to.include.all.keys(\"id\", \"url\", \"html\", \"name\", \"formValidation\");\n    pm.expect(json.id).to.be.a(\"number\");\n    pm.expect(Number.isInteger(json.id)).to.be.true;\n    pm.expect(json.id).to.be.above(0);\n    pm.expect(json.url).to.be.a(\"string\").and.to.not.be.empty;\n    pm.expect(json.html).to.be.a(\"string\").and.to.not.be.empty;\n    pm.expect(json.name).to.be.a(\"string\").and.to.not.be.empty;\n    pm.expect(json.formValidation).to.be.an(\"object\");\n    pm.expect(json.formValidation.verdict).to.be.a(\"string\");\n    pm.expect(json.formValidation.verdictReasons).to.be.an(\"array\");\n    pm.expect([\"valid\", \"invalid\", \"noForm\"]).to.include(json.formValidation.verdict);\n});\n"]}},{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveStudioCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst body = JSON.parse(pm.request.body.raw || \"{}\");\nif (!body.userPrompt && body.description) {\n    body.userPrompt = body.description;\n    pm.request.body.raw = JSON.stringify(body);\n}\n"]}}],"id":"76af0d9c-fe98-4feb-9394-9cfa07fb4821","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\"content\":\"<html><head id=\\\"ivuh\\\" data-gjs-type=\\\"head\\\"><meta charset=\\\"UTF-8\\\">\\n</head><body data-new-gr-c-s-check-loaded=\\\"14.1274.0\\\" data-gr-ext-installed=\\\"\\\"><style>\\n      \\n    body { background-color: #fff }\\n    * ::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1) }\\n    * ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2) }\\n    * ::-webkit-scrollbar { width: 10px }\\n  \\n\\n      \\n\\n      [data-gjs-type=\\\"wrapper\\\"] {\\n        min-height: 100vh;\\n        padding-top: 0.001em;\\n      }\\n\\n      .gjs-dashed *[data-gjs-highlightable] {\\n        outline: 1px dashed rgba(170,170,170,0.7);\\n        outline-offset: -2px;\\n      }\\n\\n      .gjs-selected {\\n        outline: 2px solid #3b97e3 !important;\\n        outline-offset: -2px;\\n      }\\n\\n      .gjs-selected-parent {\\n        outline: 2px solid #ffca6f !important\\n      }\\n\\n      .gjs-no-select {\\n        user-select: none;\\n        -webkit-user-select:none;\\n        -moz-user-select: none;\\n      }\\n\\n      .gjs-freezed {\\n        opacity: 0.5;\\n        pointer-events: none;\\n      }\\n\\n      .gjs-no-pointer {\\n        pointer-events: none;\\n      }\\n\\n      .gjs-pointer-init {\\n        pointer-events: initial;\\n      }\\n\\n      .gjs-plh-image {\\n        background: #f5f5f5;\\n        border: none;\\n        height: 100px;\\n        width: 100px;\\n        display: block;\\n        outline: 3px solid #ffca6f;\\n        cursor: pointer;\\n        outline-offset: -2px\\n      }\\n\\n      .gjs-grabbing {\\n        cursor: grabbing;\\n        cursor: -webkit-grabbing;\\n      }\\n\\n      .gjs-is__grabbing {\\n        overflow-x: hidden;\\n      }\\n\\n      .gjs-is__grabbing,\\n      .gjs-is__grabbing * {\\n        cursor: grabbing !important;\\n      }\\n\\n      \\n      * { box-sizing: border-box; } body {margin: 0;}\\n    </style><!-- Hero Section --><title data-gjs-highlightable=\\\"true\\\" id=\\\"ir7j\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"2jn54ejk\\\">בדיקה - שירותים מקצועיים בתחום הבדיקה והירשמות לאירוע</title><link data-gjs-highlightable=\\\"true\\\" id=\\\"iw78w\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" href=\\\"https://fonts.googleapis.com/css2?family=Assistant:wght@400;600;700&amp;family=Heebo:wght@400;600;700&amp;display=swap\\\" rel=\\\"stylesheet\\\"><link data-gjs-highlightable=\\\"true\\\" id=\\\"ig9cy\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" rel=\\\"stylesheet\\\" href=\\\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css\\\"><section data-gjs-highlightable=\\\"true\\\" id=\\\"hero\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"yepk2fkc\\\" class=\\\"hero-section\\\"><img id=\\\"i5o17\\\" data-gjs-type=\\\"image\\\" draggable=\\\"true\\\" src=\\\"https://images.unsplash.com/photo-1551135049-8a33b5883817?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3w4MDE1MjF8MHwxfHNlYXJjaHwxMHx8aW5zcGVjdGlvbiUyMHNlcnZpY2VzJTIwcHJvZmVzc2lvbmFsJTIwYnVzaW5lc3N8ZW58MHwwfHx8MTc3MTUxMjU3MXww&amp;ixlib=rb-4.1.0&amp;q=80&amp;w=1080\\\" alt=\\\"Inspection Services, professional business logo\\\" data-smoove-id=\\\"w7tdb07s\\\" class=\\\"hero-logo\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"ivaq9\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"lcw6eckg\\\" class=\\\"container\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"iyrng\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"xlgk5wj7\\\" class=\\\"hero-content\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"io4gz\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"zz4nncjo\\\" class=\\\"hero-text\\\"><h1 data-gjs-highlightable=\\\"true\\\" id=\\\"i3orj\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"9qyqx4lv\\\" class=\\\"hero-title gjs-selected\\\">הצטרפו לאירוע המיוחד שלנו בבדיקה</h1><h2 data-gjs-highlightable=\\\"true\\\" id=\\\"i8l6k\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"wzseeyci\\\" class=\\\"hero-subtitle\\\">פתרונות ושירותים מקצועיים בתחום הבדיקה</h2><p data-gjs-highlightable=\\\"true\\\" id=\\\"i8b9v\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"p2xr0gke\\\" class=\\\"hero-description\\\">אנחנו מזמינים אתכם להירשם לאירוע שלנו, שבו תוכלו ללמוד על השירותים המקצועיים שלנו ולהתחבר עם מומחים בתחום.</p><a data-gjs-highlightable=\\\"true\\\" id=\\\"idyaj\\\" data-gjs-type=\\\"link\\\" draggable=\\\"true\\\" href=\\\"#lead-form\\\" data-smoove-id=\\\"7gw4zwjd\\\" class=\\\"hero-button\\\">הירשמו עכשיו</a></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"i3xie\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"ja291zxe\\\" class=\\\"hero-image-container\\\"><img id=\\\"iae1k\\\" data-gjs-type=\\\"image\\\" draggable=\\\"true\\\" src=\\\"https://images.unsplash.com/flagged/photo-1551135049-83f3419ef05c?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3w4MDE1MjF8MHwxfHNlYXJjaHw5fHxJbnNwZWN0aW9uJTIwU2VydmljZXMlMkMlMjBwcm9mZXNzaW9uYWwlMjBldmVudCUyMHJlZ2lzdHJhdGlvbiUyMG1lZXRpbmd8ZW58MHwwfHx8MTc3MTUxMjU3Mnww&amp;ixlib=rb-4.1.0&amp;q=80&amp;w=1080\\\" alt=\\\"Inspection Services, professional event registration meeting\\\" loading=\\\"eager\\\" data-smoove-id=\\\"xxmejx3z\\\" class=\\\"hero-image\\\"></div></div></div></section><!-- Services Section --><section data-gjs-highlightable=\\\"true\\\" id=\\\"services\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"4zj8valf\\\" class=\\\"services-section\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"igvl4\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"lcw6eckg\\\" class=\\\"container\\\"><h2 data-gjs-highlightable=\\\"true\\\" id=\\\"iqqdk\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"ut1i3cvs\\\" class=\\\"section-title\\\">גלו את השירותים שלנו</h2><p data-gjs-highlightable=\\\"true\\\" id=\\\"i5jji\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"ejh3726h\\\" class=\\\"section-subtitle\\\">שלושה תחומי שירות מרכזיים המתמקדים באיכות ושירות מעולה ללקוחות</p><div data-gjs-highlightable=\\\"true\\\" id=\\\"i1e3a\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"4dlviegz\\\" class=\\\"services-grid\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"i1gaq\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"7cvvzrqs\\\" class=\\\"service-card\\\"><img id=\\\"ie33p\\\" data-gjs-type=\\\"image\\\" draggable=\\\"true\\\" src=\\\"https://images.unsplash.com/photo-1666101040767-d276f74e377c?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3w4MDE1MjF8MHwxfHNlYXJjaHw1fHxJbnNwZWN0aW9uJTIwU2VydmljZXMlMkMlMjBxdWFsaXR5JTIwdGVzdGluZyUyMGFjdGl2aXRpZXN8ZW58MHwwfHx8MTc3MTUxMjU3M3ww&amp;ixlib=rb-4.1.0&amp;q=80&amp;w=1080\\\" alt=\\\"Inspection Services, quality testing activities\\\" loading=\\\"lazy\\\" data-smoove-id=\\\"nnq5yh3l\\\" class=\\\"service-image\\\"><h3 data-gjs-highlightable=\\\"true\\\" id=\\\"ik996\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"6fa2l0kr\\\" class=\\\"service-title\\\">בדיקות איכות</h3><p data-gjs-highlightable=\\\"true\\\" id=\\\"ienfx\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"k8xr5f5o\\\" class=\\\"service-description\\\">שירותי בדיקה מקצועיים המבטיחים איכות מעולה במוצרים ובשירותים. הצטרפו לסמינרים ולקורסים שלנו בנושא.</p><a data-gjs-highlightable=\\\"true\\\" id=\\\"ihbv8\\\" data-gjs-type=\\\"link\\\" draggable=\\\"true\\\" href=\\\"#lead-form\\\" data-smoove-id=\\\"irszlocl\\\" class=\\\"service-link\\\">למדו עוד</a></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"iqlw1\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"7cvvzrqs\\\" class=\\\"service-card\\\"><img id=\\\"i0gsz\\\" data-gjs-type=\\\"image\\\" draggable=\\\"true\\\" src=\\\"https://images.unsplash.com/photo-1716037991590-c975184b37df?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3w4MDE1MjF8MHwxfHNlYXJjaHw1fHxJbnNwZWN0aW9uJTIwU2VydmljZXMlMkMlMjBwcm9mZXNzaW9uYWwlMjB0cmFpbmluZyUyMGFuZCUyMGNlcnRpZmljYXRpb258ZW58MHwwfHx8MTc3MTUxMjU3NHww&amp;ixlib=rb-4.1.0&amp;q=80&amp;w=1080\\\" alt=\\\"Inspection Services, professional training and certification\\\" loading=\\\"lazy\\\" data-smoove-id=\\\"sk0q4izo\\\" class=\\\"service-image\\\"><h3 data-gjs-highlightable=\\\"true\\\" id=\\\"iinx3\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"6fa2l0kr\\\" class=\\\"service-title\\\">הכשרות והסמכות</h3><p data-gjs-highlightable=\\\"true\\\" id=\\\"i5lyr\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"k8xr5f5o\\\" class=\\\"service-description\\\">הכשרות מקצועיות והסמכות בתחום הבדיקה. השתתפו באירועים ייחודיים להעמקת הידע.</p><a data-gjs-highlightable=\\\"true\\\" id=\\\"icqkv\\\" data-gjs-type=\\\"link\\\" draggable=\\\"true\\\" href=\\\"#lead-form\\\" data-smoove-id=\\\"irszlocl\\\" class=\\\"service-link\\\">גלו עוד</a></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"ipj7o\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"7cvvzrqs\\\" class=\\\"service-card\\\"><img id=\\\"i2uqf\\\" data-gjs-type=\\\"image\\\" draggable=\\\"true\\\" src=\\\"https://images.unsplash.com/photo-1554035042-34f354352d97?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3w4MDE1MjF8MHwxfHNlYXJjaHw3fHxJbnNwZWN0aW9uJTIwU2VydmljZXMlMkMlMjBjb25zdWx0YXRpb24lMjBhbmQlMjBzdXBwb3J0fGVufDB8MHx8fDE3NzE1MTI1NzV8MA&amp;ixlib=rb-4.1.0&amp;q=80&amp;w=1080\\\" alt=\\\"Inspection Services, consultation and support\\\" loading=\\\"lazy\\\" data-smoove-id=\\\"2tlk3f8c\\\" class=\\\"service-image\\\"><h3 data-gjs-highlightable=\\\"true\\\" id=\\\"i8g77\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"6fa2l0kr\\\" class=\\\"service-title\\\">ייעוץ ותמיכה</h3><p data-gjs-highlightable=\\\"true\\\" id=\\\"in9e1\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"k8xr5f5o\\\" class=\\\"service-description\\\">ייעוץ מקצועי ותמיכה מתמשכת ללקוחותינו. הצטרפו למפגשים עם מומחים לבניית קשרים עסקיים.</p><a data-gjs-highlightable=\\\"true\\\" id=\\\"inzv5\\\" data-gjs-type=\\\"link\\\" draggable=\\\"true\\\" href=\\\"#lead-form\\\" data-smoove-id=\\\"irszlocl\\\" class=\\\"service-link\\\">התחילו לייעץ</a></div></div></div></section><!-- Testimonials Section --><section data-gjs-highlightable=\\\"true\\\" id=\\\"testimonials\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"u404uf80\\\" class=\\\"testimonials-section\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"i46eo\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"lcw6eckg\\\" class=\\\"container\\\"><h2 data-gjs-highlightable=\\\"true\\\" id=\\\"ih5v6\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"xsoyphu3\\\" class=\\\"testimonials-title\\\">לקוחות מרוצים</h2><p data-gjs-highlightable=\\\"true\\\" id=\\\"iqhdi\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"ox2m0aso\\\" class=\\\"testimonials-subtitle\\\">אלפי לקוחות נהנים מהשירותים המקצועיים שלנו בתחום הבדיקה</p><div data-gjs-highlightable=\\\"true\\\" id=\\\"is1on\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"5dzvrned\\\" class=\\\"testimonials-grid\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"if6zu\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"rawlmgnl\\\" class=\\\"testimonial-card\\\"><img id=\\\"ipdaw\\\" data-gjs-type=\\\"image\\\" draggable=\\\"true\\\" src=\\\"https://images.unsplash.com/photo-1592831383329-23d79a212006?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3w4MDE1MjF8MHwxfHNlYXJjaHwxfHxTYXJhaCUyMENvaGVufGVufDB8MHx8fDE3NzE1MDEyOTR8MA&amp;ixlib=rb-4.1.0&amp;q=80&amp;w=1080\\\" alt=\\\"Sarah Cohen\\\" loading=\\\"lazy\\\" data-smoove-id=\\\"kop23z90\\\" class=\\\"testimonial-avatar\\\"><p data-gjs-highlightable=\\\"true\\\" id=\\\"ionio\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"c2kk5oge\\\" class=\\\"testimonial-text\\\">השירותים של בדיקה עזרו לנו לשפר את האיכות במוצרים שלנו. האירועים וההכשרות היו מושלמים!</p><h4 data-gjs-highlightable=\\\"true\\\" id=\\\"ifucy\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"0lbg8fuo\\\" class=\\\"testimonial-name\\\">שרה כהן</h4><p data-gjs-highlightable=\\\"true\\\" id=\\\"irusg\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"balkb6kd\\\" class=\\\"testimonial-role\\\">לקוחה מרוצה משירותי איכות</p></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"iit9i\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"rawlmgnl\\\" class=\\\"testimonial-card\\\"><img id=\\\"ixg55\\\" data-gjs-type=\\\"image\\\" draggable=\\\"true\\\" src=\\\"https://images.unsplash.com/photo-1761627067195-494c6edcc9a6?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3w4MDE1MjF8MHwxfHNlYXJjaHwxfHxEYXZpZCUyMExldml8ZW58MHwwfHx8MTc3MTUwMTI5NXww&amp;ixlib=rb-4.1.0&amp;q=80&amp;w=1080\\\" alt=\\\"David Levi\\\" loading=\\\"lazy\\\" data-smoove-id=\\\"2bhi6gx1\\\" class=\\\"testimonial-avatar\\\"><p data-gjs-highlightable=\\\"true\\\" id=\\\"ikk9n\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"c2kk5oge\\\" class=\\\"testimonial-text\\\">ההסמכות וההכשרות של בדיקה שינו את האופן שבו אנחנו עובדים. ממליץ בחום!</p><h4 data-gjs-highlightable=\\\"true\\\" id=\\\"i92m7\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"0lbg8fuo\\\" class=\\\"testimonial-name\\\">דוד לוי</h4><p data-gjs-highlightable=\\\"true\\\" id=\\\"i2op5\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"balkb6kd\\\" class=\\\"testimonial-role\\\">לקוח משירותי הכשרה</p></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"ib6yx\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"rawlmgnl\\\" class=\\\"testimonial-card\\\"><img id=\\\"is6ok\\\" data-gjs-type=\\\"image\\\" draggable=\\\"true\\\" src=\\\"https://images.unsplash.com/photo-1600456899121-68eda5705257?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3w4MDE1MjF8MHwxfHNlYXJjaHwxMnx8UmFjaGVsJTIwQmVuLURhdmlkfGVufDB8MHx8fDE3NzE1MTI1NzZ8MA&amp;ixlib=rb-4.1.0&amp;q=80&amp;w=1080\\\" alt=\\\"Rachel Ben-David\\\" loading=\\\"lazy\\\" data-smoove-id=\\\"w46qxxpm\\\" class=\\\"testimonial-avatar\\\"><p data-gjs-highlightable=\\\"true\\\" id=\\\"iyyf3\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"c2kk5oge\\\" class=\\\"testimonial-text\\\">הייעוץ המקצועי והתמיכה של בדיקה עזרו לנו להתמודד עם אתגרים בתחום. אירועים מעולים!</p><h4 data-gjs-highlightable=\\\"true\\\" id=\\\"ihui8\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"0lbg8fuo\\\" class=\\\"testimonial-name\\\">רחל בן-דוד</h4><p data-gjs-highlightable=\\\"true\\\" id=\\\"if4sx\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"balkb6kd\\\" class=\\\"testimonial-role\\\">לקוחה משירותי ייעוץ</p></div></div></div></section><!-- FOMO Section --><section data-gjs-highlightable=\\\"true\\\" id=\\\"fomo\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"0quhob9p\\\" class=\\\"fomo-section\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"ivcli1\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"lcw6eckg\\\" class=\\\"container\\\"><h2 data-gjs-highlightable=\\\"true\\\" id=\\\"ihpqzi\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"4blwcjyn\\\" class=\\\"fomo-title\\\">הצטרפו לאלפי לקוחות מרוצים</h2><p data-gjs-highlightable=\\\"true\\\" id=\\\"izz7pq\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"1v4ls1q7\\\" class=\\\"fomo-description\\\">כל יום עוברים מאות לקוחות נהנים מהשירותים המקצועיים שלנו בתחום הבדיקה. אל תפספסו את ההזדמנות להירשם לאירוע שלנו!</p><a data-gjs-highlightable=\\\"true\\\" id=\\\"iyvppj\\\" data-gjs-type=\\\"link\\\" draggable=\\\"true\\\" href=\\\"#lead-form\\\" data-smoove-id=\\\"f51wb701\\\" class=\\\"fomo-button\\\">הירשמו עכשיו בחינם</a></div></section><!-- Lead Form Section --><section data-gjs-highlightable=\\\"true\\\" id=\\\"lead-form\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"5a1w7zdy\\\" class=\\\"lead-form-section\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"imik6f\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"lcw6eckg\\\" class=\\\"container\\\"><h2 data-gjs-highlightable=\\\"true\\\" id=\\\"iii3yy\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"bb2j3uwc\\\" class=\\\"lead-form-title\\\">הירשמו לאירוע המיוחד</h2><p data-gjs-highlightable=\\\"true\\\" id=\\\"iwfx5g\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" data-smoove-id=\\\"3tz4d1zf\\\" class=\\\"lead-form-subtitle\\\">מלאו את הפרטים ונחזור אליכם עם מידע נוסף על השירותים שלנו</p><form data-gjs-highlightable=\\\"true\\\" id=\\\"i1a0dg\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" action=\\\"#\\\" method=\\\"POST\\\" data-smoove-id=\\\"kdg9n1qo\\\" class=\\\"lead-form\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"ijd1it\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"a7i88drz\\\" class=\\\"form-group\\\"><label data-gjs-highlightable=\\\"true\\\" id=\\\"i1a8pg\\\" data-gjs-type=\\\"label\\\" draggable=\\\"true\\\" for=\\\"first-name\\\" data-smoove-id=\\\"27e9q92a\\\">שם פרטי *</label><input data-gjs-highlightable=\\\"true\\\" id=\\\"first-name\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" type=\\\"text\\\" name=\\\"uf__ai-form-552882_ai-field_first-name_35255\\\" placeholder=\\\"הזינו את שמכם הפרטי\\\" dir=\\\"rtl\\\" lang=\\\"he\\\" required=\\\"true\\\" data-smoove-id=\\\"p1uugvoi\\\" class=\\\"form-control\\\"></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"igr3gu\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"a7i88drz\\\" class=\\\"form-group\\\"><label data-gjs-highlightable=\\\"true\\\" id=\\\"iy4dxk\\\" data-gjs-type=\\\"label\\\" draggable=\\\"true\\\" for=\\\"last-name\\\" data-smoove-id=\\\"b3bn7gu4\\\">שם משפחה *</label><input data-gjs-highlightable=\\\"true\\\" id=\\\"last-name\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" type=\\\"text\\\" name=\\\"uf__ai-form-552882_ai-field_last-name_35256\\\" placeholder=\\\"הזינו את שם המשפחה\\\" dir=\\\"rtl\\\" lang=\\\"he\\\" required=\\\"true\\\" data-smoove-id=\\\"jt925ueq\\\" class=\\\"form-control\\\"></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"ibqxvp\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"a7i88drz\\\" class=\\\"form-group\\\"><label data-gjs-highlightable=\\\"true\\\" id=\\\"i8anbr\\\" data-gjs-type=\\\"label\\\" draggable=\\\"true\\\" for=\\\"phone\\\" data-smoove-id=\\\"x4k5d7pu\\\">טלפון *</label><input data-gjs-highlightable=\\\"true\\\" id=\\\"phone\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" type=\\\"tel\\\" name=\\\"uf__ai-form-552882_ai-field_phone_35257\\\" placeholder=\\\"050-1234567\\\" dir=\\\"rtl\\\" inputmode=\\\"tel\\\" required=\\\"true\\\" data-smoove-id=\\\"ptjglgdm\\\" class=\\\"form-control\\\"></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"iv1vb2\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"a7i88drz\\\" class=\\\"form-group\\\"><label data-gjs-highlightable=\\\"true\\\" id=\\\"ir0jav\\\" data-gjs-type=\\\"label\\\" draggable=\\\"true\\\" for=\\\"email\\\" data-smoove-id=\\\"dwx1qf9z\\\">אימייל *</label><input data-gjs-highlightable=\\\"true\\\" id=\\\"email\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" type=\\\"email\\\" name=\\\"uf__ai-form-552882_ai-field_email_35258\\\" placeholder=\\\"example@email.com\\\" dir=\\\"rtl\\\" required=\\\"true\\\" data-smoove-id=\\\"kv7bfaky\\\" class=\\\"form-control\\\"></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"ikak9j\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"a7i88drz\\\" class=\\\"form-group\\\"><label data-gjs-highlightable=\\\"true\\\" id=\\\"ixaujd\\\" data-gjs-type=\\\"label\\\" draggable=\\\"true\\\" for=\\\"message\\\" data-smoove-id=\\\"s8wzgly6\\\">ספרו לנו על הצרכים שלכם</label><textarea data-gjs-highlightable=\\\"true\\\" id=\\\"message\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" name=\\\"uf__ai-form-552882_ai-field_message_35259\\\" placeholder=\\\"מה אתם צריכים בתחום הבדיקה? אילו שירותים מעניינים אתכם?\\\" dir=\\\"rtl\\\" lang=\\\"he\\\" rows=\\\"4\\\" data-smoove-id=\\\"kvstzdy2\\\" class=\\\"form-control\\\"></textarea></div><button data-gjs-highlightable=\\\"true\\\" id=\\\"ibwrfb\\\" data-gjs-type=\\\"text\\\" draggable=\\\"true\\\" type=\\\"submit\\\" data-smoove-id=\\\"0nx3dj17\\\" name=\\\"uf_submit\\\" value=\\\"ai-form-552882\\\" class=\\\"submit-btn\\\">שלחו והירשמו</button></form></div></section><!-- Scroll to Top Button --><button data-gjs-highlightable=\\\"true\\\" id=\\\"scrollToTop\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" aria-label=\\\"חזרה למעלה\\\" data-smoove-id=\\\"c6jr6i2o\\\" class=\\\"scroll-to-top\\\"><i data-gjs-highlightable=\\\"true\\\" id=\\\"i2h9yj\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" data-smoove-id=\\\"x0q7wdqc\\\" class=\\\"fas fa-arrow-up\\\"></i></button><!-- Structured Data --><div data-gjs-highlightable=\\\"true\\\" id=\\\"i31gs5\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" class=\\\"gjs-css-rules\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"gjs-css-rules\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\"></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"gjs-css-rules-992\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\"></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"gjs-css-rules-768\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\"></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"gjs-css-rules-480\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\"></div></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"i1qsxk\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" class=\\\"gjs-js-cont\\\"></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"irjnux\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" class=\\\"gjs-css-rules\\\"><div data-gjs-highlightable=\\\"true\\\" id=\\\"gjs-css-rules-2\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\"></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"gjs-css-rules-992-2\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\"></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"gjs-css-rules-768-2\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\"></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"gjs-css-rules-480-2\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\"></div></div><div data-gjs-highlightable=\\\"true\\\" id=\\\"iw7pdj\\\" data-gjs-type=\\\"default\\\" draggable=\\\"true\\\" class=\\\"gjs-js-cont\\\"></div><div class=\\\"gjs-css-rules\\\"><div id=\\\"gjs-css-rules\\\"><style>body{background-color:var(--body-bg-color);margin:0;font-family:\\\"Assistant\\\", \\\"Heebo\\\", Arial, sans-serif;color:var(--text-color-primary);line-height:1.7;font-size:18px;text-rendering:optimizeLegibility;direction:rtl;text-align:right;}</style><style>* ::-webkit-scrollbar-track{background:rgba(0, 0, 0, 0.1);}</style><style>* ::-webkit-scrollbar-thumb{background:rgba(255, 255, 255, 0.2);}</style><style>* ::-webkit-scrollbar{width:10px;}</style><style>[data-gjs-type=\\\"wrapper\\\"]{min-height:100vh;padding-top:0.001em;}</style><style>.gjs-dashed *[data-gjs-highlightable]{outline:1px dashed rgba(170,170,170,0.7);outline-offset:-2px;}</style><style>.gjs-selected{outline:2px solid #3b97e3 !important;outline-offset:-2px;}</style><style>.gjs-selected-parent{outline:2px solid #ffca6f !important;}</style><style>.gjs-no-select{user-select:none;-webkit-user-select:none;-moz-user-select:none;}</style><style>.gjs-freezed{opacity:0.5;pointer-events:none;}</style><style>.gjs-no-pointer{pointer-events:none;}</style><style>.gjs-pointer-init{pointer-events:initial;}</style><style>.gjs-plh-image{background:#f5f5f5;border:none;height:100px;width:100px;display:block;outline:3px solid #ffca6f;cursor:pointer;outline-offset:-2px;}</style><style>.gjs-grabbing{cursor:-webkit-grabbing;}</style><style>.gjs-is__grabbing{overflow-x:hidden;}</style><style>.gjs-is__grabbing, .gjs-is__grabbing *{cursor:grabbing !important;}</style><style>*{box-sizing:border-box;margin:0;padding:0;}</style><style>:root{--body-bg-color:#f5f5f5;--text-color-primary:#2c3e50;--text-color-light:#ffffff;--section-bg-light:#ffffff;--section-bg-dark:#1a1a2e;--section-text-on-light:#2c3e50;--section-text-on-dark:#ffffff;--icon-color-on-light:#007bff;--icon-color-on-dark:#ffffff;--accent-color-1:#007bff;--gradient-start:#007bff;--gradient-end:#0056b3;--glass-bg:rgba(255, 255, 255, 0.15);--glass-border:rgba(255, 255, 255, 0.3);}</style><style>html{scroll-behavior:smooth;}</style><style>.container{max-width:1200px;margin:0 auto;padding:0 60px;}</style><style>.hero-section{position:relative;min-height:100vh;display:flex;align-items:center;background:linear-gradient(135deg, var(--gradient-start), var(--gradient-end));overflow:hidden;padding:100px 0 80px;}</style><style>.hero-section::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background:url(https://images.unsplash.com/photo-1627546930202-db1fe2fb9ffb?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3w4MDE1MjF8MHwxfHNlYXJjaHwzfHxJbnNwZWN0aW9uJTIwU2VydmljZXMlMkMlMjBwcm9mZXNzaW9uYWwlMjBldmVudCUyMHJlZ2lzdHJhdGlvbiUyMG1lZXRpbmd8ZW58MHwwfHx8MTc3MTUxMjU3Mnww&ixlib=rb-4.1.0&q=80&w=1080);background-size:cover;background-position:center;opacity:0.15;z-index:0;}</style><style>.hero-logo{position:absolute;top:30px;right:30px;max-width:100px;width:100px;height:auto;object-fit:contain;z-index:10;}</style><style>.hero-content{position:relative;z-index:2;display:grid;grid-template-columns:1fr 1fr;gap:80px;align-items:center;}</style><style>.hero-text{order:2;}</style><style>.hero-image-container{order:1;}</style><style>.hero-title{font-size:48px;font-weight:700;line-height:1.3;color:#ffffff;margin-bottom:24px;text-shadow:2px 2px 8px rgba(0,0,0,0.3);animation:fadeInUp 1s ease;}</style><style>.hero-subtitle{font-size:28px;font-weight:600;color:#e0f7ff;margin-bottom:20px;text-shadow:1px 1px 6px rgba(0,0,0,0.2);animation:fadeInUp 1.2s ease;}</style><style>.hero-description{font-size:20px;line-height:1.8;color:#ffffff;margin-bottom:40px;text-shadow:1px 1px 4px rgba(0,0,0,0.2);animation:fadeInUp 1.4s ease;}</style><style>.hero-button{display:inline-block;padding:18px 48px;background-color:#ffffff;color:#007bff;font-size:18px;font-weight:600;text-decoration:none;border-radius:50px;transition:all 0.3s ease;box-shadow:0 8px 20px rgba(0,0,0,0.2);animation:fadeInUp 1.6s ease;}</style><style>.hero-button:hover{transform:translateY(-3px) scale(1.05);box-shadow:0 12px 28px rgba(0,0,0,0.3);}</style><style>.hero-image{width:100%;height:auto;border-radius:30px;box-shadow:0 20px 60px rgba(0,0,0,0.3);animation:fadeInLeft 1.2s ease;filter:brightness(0.9) grayscale(0.2);transition:all 0.8s ease;}</style><style>.hero-image:hover{filter:brightness(1) grayscale(0);transform:scale(1.05) rotate(2deg);}</style><style>.services-section{padding:100px 0;background-color:#1a1a2e;position:relative;}</style><style>.section-title{font-size:36px;font-weight:700;text-align:center;color:#ffffff;margin-bottom:20px;position:relative;display:inline-block;margin-left:auto;margin-right:auto;}</style><style>.section-title::after{content:'';position:absolute;bottom:-10px;right:0;width:80px;height:4px;background:linear-gradient(90deg, var(--gradient-start), var(--gradient-end));border-radius:2px;}</style><style>.section-subtitle{font-size:20px;text-align:center;color:#e0e0e0;margin-bottom:60px;max-width:700px;margin-right:auto;margin-left:auto;}</style><style>.services-grid{display:grid;grid-template-columns:repeat(3, 1fr);gap:40px;}</style><style>.service-card{background:var(--glass-bg);backdrop-filter:blur(10px);border:1px solid var(--glass-border);border-radius:25px;padding:40px 30px;text-align:center;transition:all 0.5s ease;position:relative;overflow:hidden;}</style><style>.service-card::before{content:'';position:absolute;top:-50%;right:-50%;width:200%;height:200%;background:linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);transform:rotate(45deg);transition:all 0.6s ease;}</style><style>.service-card:hover::before{right:100%;}</style><style>.service-card:hover{transform:translateY(-15px) scale(1.03);box-shadow:0 20px 50px rgba(0,0,0,0.3);}</style><style>.service-image{width:100%;height:250px;object-fit:cover;border-radius:20px;margin-bottom:24px;filter:brightness(0.85) grayscale(0.3);transition:all 0.8s ease;}</style><style>.service-card:hover .service-image{filter:brightness(1) grayscale(0);transform:scale(1.1);}</style><style>.service-title{font-size:26px;font-weight:600;color:#ffffff;margin-bottom:16px;}</style><style>.service-description{font-size:17px;line-height:1.7;color:#ffffff;margin-bottom:24px;}</style><style>.service-link{display:inline-block;padding:14px 36px;background-color:#007bff;color:#ffffff;font-size:17px;font-weight:600;text-decoration:none;border-radius:30px;transition:all 0.3s ease;}</style><style>.service-link:hover{transform:scale(1.08);box-shadow:0 8px 20px rgba(0,0,0,0.25);}</style><style>.testimonials-section{padding:100px 0;background-color:#f5f5f5;}</style><style>.testimonials-title{font-size:36px;font-weight:700;text-align:center;color:#2c3e50;margin-bottom:20px;position:relative;display:inline-block;margin-left:auto;margin-right:auto;}</style><style>.testimonials-title::after{content:'';position:absolute;bottom:-10px;right:0;width:80px;height:4px;background:linear-gradient(90deg, var(--gradient-start), var(--gradient-end));border-radius:2px;}</style><style>.testimonials-subtitle{font-size:20px;text-align:center;color:#555555;margin-bottom:60px;max-width:700px;margin-right:auto;margin-left:auto;}</style><style>.testimonials-grid{display:grid;grid-template-columns:repeat(3, 1fr);gap:40px;}</style><style>.testimonial-card{background:var(--glass-bg);backdrop-filter:blur(10px);border:1px solid var(--glass-border);border-radius:25px;padding:40px 30px;text-align:center;transition:all 0.5s ease;position:relative;}</style><style>.testimonial-card:hover{transform:translateY(-10px);box-shadow:0 15px 40px rgba(0,0,0,0.2);}</style><style>.testimonial-avatar{width:80px;height:80px;border-radius:50%;object-fit:cover;margin:0 auto 20px;border:4px solid var(--gradient-start);box-shadow:0 8px 20px rgba(0,0,0,0.2);}</style><style>.testimonial-text{font-size:17px;line-height:1.8;color:#2c3e50;margin-bottom:20px;font-style:italic;}</style><style>.testimonial-name{font-size:20px;font-weight:600;color:#007bff;margin-bottom:8px;}</style><style>.testimonial-role{font-size:16px;color:#2c3e50;opacity:0.8;}</style><style>.fomo-section{padding:100px 0;background:linear-gradient(135deg, var(--gradient-start), var(--gradient-end));text-align:center;position:relative;overflow:hidden;}</style><style>.fomo-section::before{content:'';position:absolute;top:-50%;right:-50%;width:200%;height:200%;background:radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);animation:pulse 4s ease-in-out infinite;}</style><style>.fomo-title{display:block;font-size:48px;font-weight:700;color:#ffffff;margin-bottom:24px;text-shadow:2px 2px 8px rgba(0,0,0,0.3);position:relative;z-index:2;}</style><style>.fomo-description{font-size:24px;line-height:1.7;color:#ffffff;margin-bottom:40px;max-width:800px;margin-right:auto;margin-left:auto;position:relative;z-index:2;}</style><style>.fomo-button{display:inline-block;padding:20px 60px;background-color:#ffffff;color:#007bff;font-size:22px;font-weight:700;text-decoration:none;border-radius:50px;transition:all 0.3s ease;box-shadow:0 10px 30px rgba(0,0,0,0.3);position:relative;z-index:2;}</style><style>.fomo-button:hover{transform:translateY(-5px) scale(1.08);box-shadow:0 15px 40px rgba(0,0,0,0.4);}</style><style>.lead-form-section{padding:100px 0;background-color:#ffffff;}</style><style>.lead-form-title{font-size:36px;font-weight:700;text-align:center;color:#2c3e50;margin-bottom:20px;position:relative;display:inline-block;margin-left:auto;margin-right:auto;}</style><style>.lead-form-title::after{content:'';position:absolute;bottom:-10px;right:0;width:80px;height:4px;background:linear-gradient(90deg, var(--gradient-start), var(--gradient-end));border-radius:2px;}</style><style>.lead-form-subtitle{font-size:20px;text-align:center;color:#555555;margin-bottom:60px;max-width:700px;margin-right:auto;margin-left:auto;}</style><style>.lead-form{max-width:600px;margin:0 auto;background:var(--glass-bg);backdrop-filter:blur(10px);border:1px solid var(--glass-border);border-radius:25px;padding:50px 40px;}</style><style>.form-group{margin-bottom:28px;}</style><style>.form-group label{display:block;font-size:18px;font-weight:600;color:#2c3e50;margin-bottom:10px;}</style><style>.form-control{width:100%;padding:16px 20px;font-size:17px;font-family:\\\"Assistant\\\", \\\"Heebo\\\", Arial, sans-serif;border:2px solid var(--glass-border);border-radius:15px;background-color:#f9f9f9;color:#2c3e50;transition:all 0.3s ease;direction:rtl;text-align:right;}</style><style>.form-control:focus{outline:none;border-color:var(--gradient-start);box-shadow:0 0 0 4px rgba(var(--gradient-start), 0.1);}</style><style>textarea.form-control{resize:vertical;min-height:120px;}</style><style>.submit-btn{width:100%;padding:18px 40px;background-color:#007bff;color:#ffffff;font-size:20px;font-weight:700;border:none;border-radius:50px;cursor:pointer;transition:all 0.3s ease;box-shadow:0 8px 20px rgba(0,0,0,0.2);}</style><style>.submit-btn:hover{transform:translateY(-3px) scale(1.03);box-shadow:0 12px 28px rgba(0,0,0,0.3);}</style><style>.scroll-to-top{position:fixed;bottom:30px;left:30px;width:44px;height:44px;background-color:#007bff;color:#ffffff;border:none;border-radius:50%;cursor:pointer;display:none;align-items:center;justify-content:center;font-size:20px;z-index:1000;box-shadow:0 6px 20px rgba(0,0,0,0.3);transition:all 0.3s ease;}</style><style>.scroll-to-top:hover{transform:translateY(-5px);box-shadow:0 10px 30px rgba(0,0,0,0.4);}</style><style>.scroll-to-top.show{display:flex;}</style><style>@keyframes fadeInUp{from{opacity:0;transform:translateY(50px);}to{opacity:1;transform:translateY(0);}}</style><style>@keyframes fadeInLeft{from{opacity:0;transform:translateX(-50px);}to{opacity:1;transform:translateX(0);}}</style><style>@keyframes pulse{0%, 100%{transform:scale(1) rotate(0deg);}50%{transform:scale(1.1) rotate(180deg);}}</style><style>@media (max-width: 767px){.container{padding:25px 16px;}}</style><style>@media (max-width: 767px){.hero-section{min-height:auto;padding:80px 0 60px;display:flex;flex-direction:column;justify-content:flex-end;}}</style><style>@media (max-width: 767px){.hero-logo{position:absolute;top:20px;margin-left:auto;margin-right:auto;right:auto;max-width:100px;width:100px;height:auto;z-index:1;}}</style><style>@media (max-width: 767px){.hero-content{grid-template-columns:1fr;gap:40px;padding-top:25px;position:relative;z-index:2;}}</style><style>@media (max-width: 767px){.hero-text{order:1;}}</style><style>@media (max-width: 767px){.hero-image-container{order:2;}}</style><style>@media (max-width: 767px){.hero-title{font-size:32px;}}</style><style>@media (max-width: 767px){.hero-subtitle{font-size:22px;}}</style><style>@media (max-width: 767px){.hero-description{font-size:17px;}}</style><style>@media (max-width: 767px){.hero-button{padding:16px 36px;font-size:17px;width:100%;text-align:center;}}</style><style>@media (max-width: 767px){.hero-image{max-height:50vh;object-fit:cover;}}</style><style>@media (max-width: 767px){.services-section{padding:60px 0;}}</style><style>@media (max-width: 767px){.testimonials-section{padding:60px 0;}}</style><style>@media (max-width: 767px){.fomo-section{padding:60px 0;}}</style><style>@media (max-width: 767px){.lead-form-section{padding:60px 0;}}</style><style>@media (max-width: 767px){.section-title{font-size:28px;max-width:100% !important;overflow-wrap:break-word !important;word-break:break-word !important;width:100% !important;box-sizing:border-box !important;padding:0 16px;padding-left:16px !important;padding-right:16px !important;margin-left:auto !important;margin-right:auto !important;}}</style><style>@media (max-width: 767px){.testimonials-title{font-size:28px;max-width:100% !important;overflow-wrap:break-word !important;word-break:break-word !important;width:100% !important;box-sizing:border-box !important;padding:0 16px;padding-left:16px !important;padding-right:16px !important;margin-left:auto !important;margin-right:auto !important;}}</style><style>@media (max-width: 767px){.fomo-title{font-size:28px;max-width:100% !important;overflow-wrap:break-word !important;word-break:break-word !important;width:100% !important;box-sizing:border-box !important;padding:0 16px;padding-left:16px !important;padding-right:16px !important;margin-left:auto !important;margin-right:auto !important;}}</style><style>@media (max-width: 767px){.lead-form-title{font-size:28px;max-width:100% !important;overflow-wrap:break-word !important;word-break:break-word !important;width:100% !important;box-sizing:border-box !important;padding:0 16px;padding-left:16px !important;padding-right:16px !important;margin-left:auto !important;margin-right:auto !important;}}</style><style>@media (max-width: 767px){.section-subtitle{font-size:17px;margin-bottom:40px;}}</style><style>@media (max-width: 767px){.testimonials-subtitle{font-size:17px;margin-bottom:40px;}}</style><style>@media (max-width: 767px){.lead-form-subtitle{font-size:17px;margin-bottom:40px;}}</style><style>@media (max-width: 767px){.fomo-description{font-size:19px;}}</style><style>@media (max-width: 767px){.services-grid{grid-template-columns:1fr;gap:30px;}}</style><style>@media (max-width: 767px){.testimonials-grid{grid-template-columns:1fr;gap:30px;}}</style><style>@media (max-width: 767px){.service-card{padding:30px 24px;}}</style><style>@media (max-width: 767px){.testimonial-card{padding:30px 24px;}}</style><style>@media (max-width: 767px){.service-image{height:220px;}}</style><style>@media (max-width: 767px){.service-title{font-size:22px;}}</style><style>@media (max-width: 767px){.testimonial-name{font-size:22px;}}</style><style>@media (max-width: 767px){.service-description{font-size:16px;}}</style><style>@media (max-width: 767px){.testimonial-text{font-size:16px;}}</style><style>@media (max-width: 767px){.service-link{padding:14px 32px;font-size:16px;}}</style><style>@media (max-width: 767px){.testimonial-avatar{width:60px;height:60px;}}</style><style>@media (max-width: 767px){.fomo-button{padding:18px 48px;font-size:19px;width:100%;}}</style><style>@media (max-width: 767px){.lead-form{padding:40px 24px;}}</style><style>@media (max-width: 767px){.form-control{padding:14px 18px;font-size:16px;min-height:48px;}}</style><style>@media (max-width: 767px){.submit-btn{padding:16px 36px;font-size:18px;min-height:48px;}}</style><style>@media (max-width: 767px){.scroll-to-top{width:48px;height:48px;bottom:20px;left:20px;}}</style><style>#iyvppj{background-color:#ffffff;color:#007bff;}</style></div><div id=\\\"gjs-css-rules-992\\\"></div><div id=\\\"gjs-css-rules-768\\\"></div><div id=\\\"gjs-css-rules-480\\\"></div></div><div class=\\\"gjs-js-cont\\\"></div></body><grammarly-desktop-integration data-grammarly-shadow-root=\\\"true\\\"></grammarly-desktop-integration></html>\",\"description\":\"נסח מחדש\",\"language\":\"he\",\"element\":\"9qyqx4lv\"}","options":{"raw":{"language":"json"}}},"url":"{{smooveStudioBaseUrl}}generator/improve","urlObject":{"path":["improve"],"host":["{{smooveStudioBaseUrl}}generator"],"query":[],"variable":[]}},"response":[],"_postman_id":"76af0d9c-fe98-4feb-9394-9cfa07fb4821"}],"id":"37fb5a19-7835-43e4-8851-3c3ec344bd3a","_postman_id":"37fb5a19-7835-43e4-8851-3c3ec344bd3a","description":""}],"id":"c991bc34-5513-421e-9a43-a465be4b5b1e","_postman_id":"c991bc34-5513-421e-9a43-a465be4b5b1e","description":""},{"name":"api","item":[{"name":"my-images - authenticated","item":[{"name":"search","item":[{"name":"Image Gallery Search Images","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", () => {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\n//pm.test(\"Response time is under 5000ms\", () => {\r\n//    pm.expect(pm.response.responseTime).to.be.below(5000);\r\n//});\r\n\r\npm.test(\"Content-Type is JSON\", () => {\r\n    pm.response.to.have.header(\"Content-Type\");\r\n    pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");\r\n});\r\n\r\npm.test(\"Response has all required fields\", () => {\r\n    const json = pm.response.json();\r\n\r\n    [\"images\", \"currentPage\", \"totalPages\", \"totalCount\", \"hasMore\", \"totalSize\"]\r\n        .forEach(field => pm.expect(json).to.have.property(field));\r\n\r\n    pm.expect(json.totalSize).to.be.at.least(0);\r\n\r\n    if (json.images.length === 0) {\r\n        pm.expect(json.images).to.be.an(\"array\").that.is.empty;\r\n        pm.expect(json.totalCount).to.equal(0);\r\n        pm.expect(json.totalPages).to.equal(0);\r\n        pm.expect(json.totalSize).to.equal(0.0);\r\n        pm.expect(json.hasMore).to.equal(false);\r\n    } else {\r\n        pm.expect(json.images).to.be.an(\"array\").that.is.not.empty;\r\n        json.images.forEach((img, i) => {\r\n            [\"id\", \"url\"].forEach(field =>\r\n                pm.expect(img, `images[${i}] missing '${field}'`).to.have.property(field)\r\n            );\r\n        });\r\n   }\r\n});\r\n\r\npm.test(\"Image objects have correct fields and types\", () => {\r\n    const json = pm.response.json();\r\n\r\n    json.images.forEach((img, i) => {\r\n        const label = `images[${i}]`;\r\n\r\n        // Required string fields\r\n        [\"id\", \"userId\", \"originalName\", \"blobPath\", \"url\", \"fileType\"]\r\n            .forEach(field => pm.expect(img[field], `${label}.${field}`).to.be.a(\"string\").and.not.empty);\r\n\r\n        // Optional nullable metadata (API: string?)\r\n        [\"alt\", \"title\", \"description\"].forEach(field => {\r\n            if (img[field] !== undefined && img[field] !== null) {\r\n                pm.expect(img[field], `${label}.${field}`).to.be.a(\"string\");\r\n            }\r\n        });\r\n\r\n        // fileSize required; width/height are nullable ints on the API\r\n        pm.expect(img.fileSize, `${label}.fileSize`).to.be.a(\"number\").and.above(0);\r\n        [\"width\", \"height\"].forEach(field => {\r\n            if (img[field] !== undefined && img[field] !== null) {\r\n                pm.expect(img[field], `${label}.${field}`).to.be.a(\"number\").and.above(0);\r\n            }\r\n        });\r\n\r\n        // Boolean\r\n        pm.expect(img.isPublic, `${label}.isPublic`).to.be.a(\"boolean\");\r\n\r\n        // Arrays\r\n        pm.expect(img.tags, `${label}.tags`).to.be.an(\"array\");\r\n        pm.expect(img.dominantColors, `${label}.dominantColors`).to.be.an(\"array\");\r\n\r\n        // Dates - valid ISO 8601 format\r\n        [\"createdAt\", \"updatedAt\"].forEach(field => {\r\n            pm.expect(img[field], `${label}.${field}`).to.be.a(\"string\");\r\n            pm.expect(new Date(img[field]).toString()).to.not.equal(\"Invalid Date\");\r\n        });\r\n\r\n        // URL format\r\n        [\"url\", \"blobPath\"].forEach(field => {\r\n            pm.expect(img[field], `${label}.${field}`).to.match(/^https?:\\/\\/.+/);\r\n        });\r\n    });\r\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveStudioCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}}],"id":"72927a3a-94ce-4d1a-9559-d506b6b56107","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveStudioBaseUrl}}api/my-images/search?q=&page=1&pageSize=20","urlObject":{"path":["my-images","search"],"host":["{{smooveStudioBaseUrl}}api"],"query":[{"key":"q","value":""},{"key":"page","value":"1"},{"key":"pageSize","value":"20"}],"variable":[]}},"response":[{"id":"a0bae3b1-dcd4-448f-ac03-d3c6275f825f","name":"Untitled Response","originalRequest":{"method":"GET","header":[{"key":"Accept","value":"text/plain"},{"key":"apiKey","value":"<API Key>","description":"Added as a part of security scheme: apikey"}],"url":{"raw":"{{baseUrl}}/api/my-images/search?q=&page=1&pageSize=20","host":["{{baseUrl}}"],"path":["api","my-images","search"],"query":[{"key":"q","value":""},{"key":"page","value":"1"},{"key":"pageSize","value":"20"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"images\": [\n    {\n      \"id\": \"string\",\n      \"userId\": \"string\",\n      \"originalName\": \"string\",\n      \"blobPath\": \"string\",\n      \"url\": \"string\",\n      \"fileSize\": 5730,\n      \"fileType\": \"string\",\n      \"isPublic\": false,\n      \"tags\": [\n        \"string\",\n        \"string\"\n      ],\n      \"dominantColors\": [\n        {\n          \"hex\": \"string\",\n          \"percentage\": 3625.5678090023766\n        },\n        {\n          \"hex\": \"string\",\n          \"percentage\": 5722.316678413528\n        }\n      ],\n      \"createdAt\": \"2024-04-06T09:20:47.752Z\",\n      \"updatedAt\": \"2011-08-18T20:49:18.992Z\",\n      \"thumbnailUrl\": \"string\",\n      \"alt\": \"string\",\n      \"title\": \"string\",\n      \"description\": \"string\",\n      \"width\": 8547,\n      \"height\": 8037\n    },\n    {\n      \"id\": \"string\",\n      \"userId\": \"string\",\n      \"originalName\": \"string\",\n      \"blobPath\": \"string\",\n      \"url\": \"string\",\n      \"fileSize\": 70,\n      \"fileType\": \"string\",\n      \"isPublic\": true,\n      \"tags\": [\n        \"string\",\n        \"string\"\n      ],\n      \"dominantColors\": [\n        {\n          \"hex\": \"string\",\n          \"percentage\": 4407.3431871530875\n        },\n        {\n          \"hex\": \"string\",\n          \"percentage\": 4075.107819750865\n        }\n      ],\n      \"createdAt\": \"1984-01-10T07:04:27.920Z\",\n      \"updatedAt\": \"2019-09-02T07:59:08.381Z\",\n      \"thumbnailUrl\": \"string\",\n      \"alt\": \"string\",\n      \"title\": \"string\",\n      \"description\": \"string\",\n      \"width\": 3365,\n      \"height\": 6140\n    }\n  ],\n  \"currentPage\": 2419,\n  \"totalPages\": 2332,\n  \"totalCount\": 2990,\n  \"hasMore\": false,\n  \"totalSize\": 9854.80378474582\n}"}],"_postman_id":"72927a3a-94ce-4d1a-9559-d506b6b56107"}],"id":"efe334c1-56e4-4c96-9d13-29ff64ecd9ed","_postman_id":"efe334c1-56e4-4c96-9d13-29ff64ecd9ed","description":""},{"name":"upload","item":[{"name":"Image Gallery Upload Image","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["\r\npm.test(\"Status code is 201\", function () {\r\n    pm.response.to.have.status(201);\r\n});\r\n\r\npm.test(\"Response is valid JSON\", function () {\r\n    pm.response.to.be.json;\r\n});\r\n\r\npm.test(\"Response has image object, message and totalGallerySize\", function () {\r\n    const json = pm.response.json();\r\n    pm.expect(json).to.be.an(\"object\");\r\n    [\"image\", \"message\", \"totalGallerySize\"]\r\n        .forEach(field => pm.expect(json).to.have.property(field));\r\n});\r\n\r\npm.test(\"Message is correct\", function () {\r\n    const json = pm.response.json();\r\n    pm.expect(json.message).to.be.a(\"string\");\r\n    pm.expect(json.message).to.include(\"Image uploaded successfully\");\r\n});\r\n\r\npm.test(\"totalGallerySize is a number\", function () {\r\n    const json = pm.response.json();\r\n    pm.expect(json.totalGallerySize).to.be.a(\"number\");\r\n});\r\n\r\npm.test(\"Image object has expected properties and formats\", function () {\r\n    const json = pm.response.json();\r\n    const img = json.image;\r\n    pm.expect(img).to.be.an(\"object\");\r\n    const expectedProps = [\"id\", \"userId\", \"originalName\", \"blobPath\", \"url\", \"alt\", \"title\", \"description\", \"fileSize\", \"fileType\", \"isPublic\", \"tags\", \"dominantColors\", \"createdAt\", \"updatedAt\"];\r\n    expectedProps.forEach(p => pm.expect(img).to.have.property(p));\r\n\r\n// id and userId are non-empty strings\r\n    pm.expect(json.image.id).to.be.a(\"string\").and.to.have.length.above(0);\r\n    pm.expect(json.image.userId).to.be.a(\"string\").and.to.have.length.above(0);\r\n\r\n// originalName, blobPath and url look like strings and not empty\r\n    pm.expect(json.image.originalName).to.be.a(\"string\").and.to.have.length.above(0);\r\n    pm.expect(json.image.blobPath).to.be.a(\"string\").and.to.have.length.above(0);\r\n    pm.expect(json.image.url).to.be.a(\"string\").and.to.have.length.above(0);\r\n\r\n// fileType and fileSize types\r\n    pm.expect(json.image.fileType).to.be.a(\"string\");\r\n    pm.expect(json.image.fileSize).to.be.a(\"number\");\r\n\r\n// isPublic is boolean and tags is an array\r\n    pm.expect(json.image.isPublic).to.be.a(\"boolean\");\r\n    pm.expect(json.image.tags).to.be.an(\"array\");\r\n\r\n// createdAt and updatedAt are ISO datetimes\r\n    const created = json.image.createdAt;\r\n    const updated = json.image.updatedAt;\r\n    pm.expect(created).to.be.a(\"string\");\r\n    pm.expect(updated).to.be.a(\"string\");\r\n    // basic ISO timestamp check\r\n    const isoRegex = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z$/;\r\n    pm.expect(created).to.match(isoRegex);\r\n    pm.expect(updated).to.match(isoRegex);\r\n\r\n// dominantColors is an array\r\n    pm.expect(json.image.dominantColors).to.be.an(\"array\");\r\n}); "]}},{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveStudioCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}}],"id":"98dc0758-79d2-4879-8c98-7524b58673f8","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n  \"imageUrl\": \"https://content.smoove.io/viplus/Content/Logo%20(1)_500x500-r.jpg\",\r\n  \"alt\": \"My alt\",\r\n  \"title\": \"My title\",\r\n  \"description\": \"My description\",\r\n  \"tags\": \"tag1,tag2\",\r\n  \"isPublic\": true\r\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveStudioBaseUrl}}api/my-images/upload-from-url","urlObject":{"path":["my-images","upload-from-url"],"host":["{{smooveStudioBaseUrl}}api"],"query":[],"variable":[]}},"response":[],"_postman_id":"98dc0758-79d2-4879-8c98-7524b58673f8"}],"id":"4dee7400-a3b9-43ee-9b66-dc69aaff29e7","_postman_id":"4dee7400-a3b9-43ee-9b66-dc69aaff29e7","description":""},{"name":"{id}","item":[{"name":"Image Gallery Get Image By Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveStudioCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", () => {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response time is less than 2000ms\", () => {\r\n    pm.expect(pm.response.responseTime).to.be.below(2000);\r\n});\r\n\r\npm.test(\"Content-Type is JSON\", () => {\r\n    pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");\r\n});\r\n\r\npm.test(\"Response has all required fields\", () => {\r\n    const json = pm.response.json();\r\n    [\"id\", \"userId\", \"originalName\", \"blobPath\", \"url\", \"alt\", \"title\", \"description\",\r\n     \"width\", \"height\", \"fileSize\", \"fileType\", \"isPublic\", \"tags\", \"dominantColors\",\r\n     \"createdAt\", \"updatedAt\"]\r\n        .forEach(field => pm.expect(json, field).to.have.property(field));\r\n});\r\n\r\npm.test(\"Field types are correct\", () => {\r\n    const json = pm.response.json();\r\n\r\n    [\"id\", \"userId\", \"originalName\", \"blobPath\", \"url\", \"alt\", \"title\", \"description\", \"fileType\"]\r\n        .forEach(field => pm.expect(json[field], field).to.be.a(\"string\").and.not.empty);\r\n\r\n    [\"width\", \"height\", \"fileSize\"]\r\n        .forEach(field => pm.expect(json[field], field).to.be.a(\"number\").and.above(0));\r\n\r\n    pm.expect(json.isPublic).to.be.a(\"boolean\");\r\n    pm.expect(json.tags).to.be.an(\"array\");\r\n    pm.expect(json.dominantColors).to.be.an(\"array\");\r\n});\r\n\r\npm.test(\"Field values are correct\", () => {\r\n    const json = pm.response.json();\r\n\r\n    pm.expect(json.id).to.eql(pm.environment.get(\"smooveStudioImageId\"));\r\n    pm.expect(json.userId).to.eql(pm.environment.get(\"smooveStudioImageUserId\"));\r\n    pm.expect(json.fileType).to.match(/^image\\/.+/);\r\n    pm.expect(json.width).to.eql(1124);\r\n    pm.expect(json.height).to.eql(706);\r\n    pm.expect(json.fileSize).to.eql(62597);\r\n    pm.expect(json.isPublic).to.be.oneOf([true, false]);\r\n\r\n    [\"url\", \"blobPath\"].forEach(field =>\r\n        pm.expect(json[field], field).to.match(/^https?:\\/\\/.+/)\r\n    );\r\n\r\n    [\"createdAt\", \"updatedAt\"].forEach(field => {\r\n        pm.expect(json[field], field).to.be.a(\"string\");\r\n        pm.expect(new Date(json[field]).toString()).to.not.equal(\"Invalid Date\");\r\n    });\r\n});"]}}],"id":"3931eaba-08b9-427f-8b3c-b910d869153c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveStudioBaseUrl}}api/my-images/{{smooveStudioImageId}}","urlObject":{"path":["my-images","{{smooveStudioImageId}}"],"host":["{{smooveStudioBaseUrl}}api"],"query":[],"variable":[]}},"response":[{"id":"99c1efb0-847f-4ccd-bada-4051bb294fb7","name":"Untitled Response","originalRequest":{"method":"GET","header":[{"key":"Accept","value":"text/plain"},{"key":"apiKey","value":"<API Key>","description":"Added as a part of security scheme: apikey"}],"url":{"raw":"{{baseUrl}}/api/my-images/:id","host":["{{baseUrl}}"],"path":["api","my-images",":id"],"variable":[{"key":"id","value":"string"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"id\": \"string\",\n  \"userId\": \"string\",\n  \"originalName\": \"string\",\n  \"blobPath\": \"string\",\n  \"url\": \"string\",\n  \"fileSize\": 9913,\n  \"fileType\": \"string\",\n  \"isPublic\": true,\n  \"tags\": [\n    \"string\",\n    \"string\"\n  ],\n  \"dominantColors\": [\n    {\n      \"hex\": \"string\",\n      \"percentage\": 2000.3429291404173\n    },\n    {\n      \"hex\": \"string\",\n      \"percentage\": 8264.971242608339\n    }\n  ],\n  \"createdAt\": \"2014-10-02T02:12:45.245Z\",\n  \"updatedAt\": \"1980-05-18T02:27:00.978Z\",\n  \"thumbnailUrl\": \"string\",\n  \"alt\": \"string\",\n  \"title\": \"string\",\n  \"description\": \"string\",\n  \"width\": 2780,\n  \"height\": 168\n}"}],"_postman_id":"3931eaba-08b9-427f-8b3c-b910d869153c"},{"name":"Image Gallery Update Image","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveStudioCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", () => {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response time is less than 4000ms\", () => {\r\n    pm.expect(pm.response.responseTime).to.be.below(4000);\r\n});\r\n\r\npm.test(\"Content-Type is JSON\", () => {\r\n    const contentType = pm.response.headers.get(\"Content-Type\");\r\n    if (contentType) {\r\n        pm.expect(contentType).to.include(\"application/json\");\r\n    } else {\r\n        pm.expect(true).to.be.true;\r\n    }\r\n});\r\n\r\npm.test(\"Response has all required fields\", () => {\r\n    const json = pm.response.json();\r\n    [\"id\", \"userId\", \"originalName\", \"blobPath\", \"url\", \"alt\", \"title\", \"description\",\r\n     \"width\", \"height\", \"fileSize\", \"fileType\", \"isPublic\", \"tags\", \"dominantColors\",\r\n     \"createdAt\", \"updatedAt\"]\r\n        .forEach(field => pm.expect(json, field).to.have.property(field));\r\n});\r\n\r\npm.test(\"Field types are correct\", () => {\r\n    const json = pm.response.json();\r\n\r\n    [\"id\", \"userId\", \"originalName\", \"blobPath\", \"url\", \"alt\", \"title\", \"description\", \"fileType\"]\r\n        .forEach(field => pm.expect(json[field], field).to.be.a(\"string\").and.not.empty);\r\n\r\n    [\"width\", \"height\", \"fileSize\"]\r\n        .forEach(field => pm.expect(json[field], field).to.be.a(\"number\").and.above(0));\r\n\r\n    pm.expect(json.isPublic).to.be.a(\"boolean\");\r\n    pm.expect(json.tags).to.be.an(\"array\");\r\n    pm.expect(json.dominantColors).to.be.an(\"array\");\r\n});\r\n\r\npm.test(\"Field values are correct\", () => {\r\n    const json = pm.response.json();\r\n\r\n    pm.expect(json.id).to.eql(pm.environment.get(\"smooveStudioImageId\"));\r\n    pm.expect(json.userId).to.eql(pm.environment.get(\"smooveStudioImageUserId\"));\r\n    pm.expect(json.fileType).to.match(/^image\\/.+/);\r\n    pm.expect(json.width).to.eql(1124);\r\n    pm.expect(json.height).to.eql(706);\r\n    pm.expect(json.fileSize).to.eql(62597);\r\n    pm.expect(json.isPublic).to.eql(false);\r\n    pm.expect(json.tags).to.have.lengthOf(2);\r\n\r\n    [\"url\", \"blobPath\"].forEach(field =>\r\n        pm.expect(json[field], field).to.match(/^https?:\\/\\/.+/)\r\n    );\r\n\r\n    [\"createdAt\", \"updatedAt\"].forEach(field => {\r\n        pm.expect(json[field], field).to.be.a(\"string\");\r\n        pm.expect(new Date(json[field]).toString()).to.not.equal(\"Invalid Date\");\r\n    });\r\n\r\n    pm.expect(new Date(json.updatedAt)).to.be.above(new Date(json.createdAt));\r\n});"]}}],"id":"ae42f9d3-6d72-4606-b849-1d2fcff8b542","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"tags\": [\n    \"automated_test\",\n    \"postman\"\n  ],\n  \"isPublic\": false,\n  \"alt\": \"That's an automated update attempt\",\n  \"title\": \"My image\",\n  \"description\": \"A generated description done by Postman's automated test\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveStudioBaseUrl}}api/my-images/{{smooveStudioImageId}}","urlObject":{"path":["my-images","{{smooveStudioImageId}}"],"host":["{{smooveStudioBaseUrl}}api"],"query":[],"variable":[]}},"response":[{"id":"20743710-17a7-456c-bb79-6129b42960b4","name":"Untitled Response","originalRequest":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"},{"key":"apiKey","value":"<API Key>","description":"Added as a part of security scheme: apikey"}],"body":{"mode":"raw","raw":"{\n  \"tags\": [\n    \"string\",\n    \"string\"\n  ],\n  \"isPublic\": false,\n  \"alt\": \"string\",\n  \"title\": \"string\",\n  \"description\": \"string\"\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{baseUrl}}/api/my-images/:id","host":["{{baseUrl}}"],"path":["api","my-images",":id"],"variable":[{"key":"id","value":"string"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"id\": \"string\",\n  \"userId\": \"string\",\n  \"originalName\": \"string\",\n  \"blobPath\": \"string\",\n  \"url\": \"string\",\n  \"fileSize\": 9913,\n  \"fileType\": \"string\",\n  \"isPublic\": true,\n  \"tags\": [\n    \"string\",\n    \"string\"\n  ],\n  \"dominantColors\": [\n    {\n      \"hex\": \"string\",\n      \"percentage\": 2000.3429291404173\n    },\n    {\n      \"hex\": \"string\",\n      \"percentage\": 8264.971242608339\n    }\n  ],\n  \"createdAt\": \"2014-10-02T02:12:45.245Z\",\n  \"updatedAt\": \"1980-05-18T02:27:00.978Z\",\n  \"thumbnailUrl\": \"string\",\n  \"alt\": \"string\",\n  \"title\": \"string\",\n  \"description\": \"string\",\n  \"width\": 2780,\n  \"height\": 168\n}"}],"_postman_id":"ae42f9d3-6d72-4606-b849-1d2fcff8b542"},{"name":"Image Gallery Delete Image","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveStudioCookie\");\nconst baseUrl = pm.environment.get(\"smooveStudioBaseUrl\");\n\n// Minimal 1x1 PNG as raw binary bytes\nconst base64Image = \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\";\n\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\npm.collectionVariables.set(\"smooveStudioImageDelete\", \"8939688F158B0A1FAA1A0745\");\n\n/*\npm.sendRequest({\n    url: `${baseUrl}api/my-images/upload`,\n    method: \"POST\",\n    header: {\n        \"Cookie\": `jvlpsi=${cookie};`,\n        \"Accept\": \"text/plain\",\n        \"Content-Type\": \"multipart/form-data\"\n    },\n    body: {\n        mode: \"formdata\",\n        formdata: [\n            {\n                key: \"Image\",\n                src: base64Image,\n                type: \"file\"                \n            },\n            {\n                key: \"Alt\",\n                value: \"string\",\n                type: \"text\"\n            },\n            {\n                key: \"Title\",\n                value: \"string\",\n                type: \"text\"\n            },\n            {\n                key: \"Description\",\n                value: \"string\",\n                type: \"text\"\n            },\n            {\n                key: \"Tags\",\n                value: \"string\",\n                type: \"text\"\n            },\n            {\n                key: \"IsPublic\",\n                value: \"true\",\n                type: \"text\"\n            }\n        ]\n    }\n}, (err, res) => {\n    if (err) {\n        console.error(\"Upload failed:\", err);\n        return;\n    }\n\n    console.log(\"Upload status:\", res.code);\n    console.log(\"Upload body:\", res.text());\n\n    const json = res.json();\n    const imageId = json.image ? json.image.id : json.id;\n    console.log(\"Uploaded image ID:\", imageId);\n\n    pm.collectionVariables.set(\"smooveStudioImageDelete\", imageId);\n});*/"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 404\", () => { \r\n    pm.response.to.have.status(404); \r\n}); \r\n\r\npm.test(\"Response time is less than 30000ms\", () => {\r\n    pm.expect(pm.response.responseTime).to.be.below(30000); \r\n});\r\n    \r\npm.test(\"Content-Type is JSON\", () => { \r\n    const contentType = pm.response.headers.get(\"Content-Type\"); \r\n    if (contentType) {\r\n        pm.expect(contentType).to.include(\"application/json\"); } \r\n        else { pm.expect(true).to.be.true; } }); \r\n\r\npm.test(\"Delete confirmation message is correct\", () => { \r\n    const json = pm.response.json(); \r\n    pm.expect(json).to.have.property(\"error\"); \r\n    pm.expect(json).to.have.property(\"errorCode\"); \r\n    pm.expect(json.error).to.be.a(\"string\").and.not.empty; \r\n    pm.expect(json.errorCode).to.be.a(\"string\").and.not.empty; \r\n    pm.expect(json.errorCode).to.eql(\"IMAGE_NOT_FOUND\"); \r\n    pm.expect(json.error).to.eql(\"Image not found or you don't have permission to delete it\");\r\n});"]}}],"id":"c4366bf7-2083-4714-83dd-382b63b1868d","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveStudioBaseUrl}}api/my-images/","urlObject":{"path":["my-images",""],"host":["{{smooveStudioBaseUrl}}api"],"query":[],"variable":[]}},"response":[{"id":"dd818655-9835-4ed9-bb21-e28abff18ef0","name":"Untitled Response","originalRequest":{"method":"DELETE","header":[{"key":"Accept","value":"*/*"},{"key":"apiKey","value":"<API Key>","description":"Added as a part of security scheme: apikey"}],"url":{"raw":"{{baseUrl}}/api/my-images/:id","host":["{{baseUrl}}"],"path":["api","my-images",":id"],"variable":[{"key":"id","value":"string"}]}},"status":"OK","code":200,"_postman_previewlanguage":"text","header":[{"key":"Content-Type","value":"*/*"}],"cookie":[],"responseTime":null,"body":"string"}],"_postman_id":"c4366bf7-2083-4714-83dd-382b63b1868d"}],"id":"8e90db65-0236-4023-ba27-930836ee98a3","_postman_id":"8e90db65-0236-4023-ba27-930836ee98a3","description":""},{"name":"settings","item":[{"name":"Image Gallery Get Gallery Settings","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveStudioCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", () => {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response time is under 4000ms\", () => {\r\n    pm.expect(pm.response.responseTime).to.be.below(4000);\r\n});\r\n\r\npm.test(\"Content-Type is JSON\", () => {\r\n    pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");\r\n});\r\n\r\npm.test(\"Response has all required fields\", () => {\r\n    const json = pm.response.json();\r\n\r\n    pm.expect(json).to.have.property(\"settings\");\r\n    pm.expect(json).to.have.property(\"stats\");\r\n\r\n    [\"maxFileSize\", \"galleryLimit\", \"allowedFileTypes\"].forEach(field =>\r\n        pm.expect(json.settings, `settings.${field}`).to.have.property(field)\r\n    );\r\n\r\n    [\"totalSize\", \"imageCount\", \"galleryLimit\", \"usagePercentage\"].forEach(field =>\r\n        pm.expect(json.stats, `stats.${field}`).to.have.property(field)\r\n    );\r\n});\r\n\r\npm.test(\"Settings values are valid\", () => {\r\n    const { settings } = pm.response.json();\r\n\r\n    pm.expect(settings.maxFileSize).to.be.a(\"number\").and.above(0);\r\n    pm.expect(settings.galleryLimit).to.be.a(\"number\").and.above(0);\r\n    pm.expect(settings.allowedFileTypes).to.be.an(\"array\").and.not.empty;\r\n\r\n    settings.allowedFileTypes.forEach((type, i) => {\r\n        pm.expect(type, `allowedFileTypes[${i}]`).to.be.a(\"string\").and.match(/^image\\/.+/);\r\n    });\r\n});\r\n\r\npm.test(\"Stats values are valid\", () => {\r\n    const { stats } = pm.response.json();\r\n\r\n    pm.expect(stats.totalSize).to.be.a(\"number\").and.at.least(0);\r\n    pm.expect(stats.imageCount).to.be.a(\"number\").and.at.least(0);\r\n    pm.expect(stats.galleryLimit).to.be.a(\"number\").and.above(0);\r\npm.expect(stats.usagePercentage).to.be.a(\"number\").and.at.least(0);\r\n});\r\n\r\npm.test(\"Stats are logically consistent\", () => {\r\n    const { settings, stats } = pm.response.json();\r\n\r\n    pm.expect(stats.galleryLimit).to.equal(settings.galleryLimit);\r\n\r\n    const expectedUsage = (stats.imageCount / stats.galleryLimit) * 100;\r\n    pm.expect(stats.usagePercentage).to.be.closeTo(expectedUsage, 0.01);\r\n\r\n    if (stats.imageCount === 0) {\r\n        pm.expect(stats.totalSize).to.equal(0);\r\n        pm.expect(stats.usagePercentage).to.equal(0);\r\n    }\r\n});"]}}],"id":"ab9505ad-35cb-4941-be22-a9a4a8852400","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveStudioBaseUrl}}api/my-images/settings","urlObject":{"path":["my-images","settings"],"host":["{{smooveStudioBaseUrl}}api"],"query":[],"variable":[]}},"response":[{"id":"c5e4ea87-13bd-4264-bc3b-0243a65306c8","name":"Untitled Response","originalRequest":{"method":"GET","header":[{"key":"Accept","value":"*/*"},{"key":"apiKey","value":"<API Key>","description":"Added as a part of security scheme: apikey"}],"url":"{{baseUrl}}/api/my-images/settings"},"status":"OK","code":200,"_postman_previewlanguage":"text","header":[{"key":"Content-Type","value":"*/*"}],"cookie":[],"responseTime":null,"body":"string"}],"_postman_id":"ab9505ad-35cb-4941-be22-a9a4a8852400"}],"id":"49bfc6f2-7022-4af3-8f50-d1ecca67a860","_postman_id":"49bfc6f2-7022-4af3-8f50-d1ecca67a860","description":""},{"name":"tags","item":[{"name":"Image Gallery Get Image Tags","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveStudioCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const json = pm.response.json();\r\n\r\n// Status code\r\npm.test(\"Status code is 200\", function () {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\n// Response is valid JSON\r\npm.test(\"Response is valid JSON array\", function () {\r\n    pm.response.to.be.json;\r\n    pm.expect(json).to.be.an(\"array\");\r\n});\r\n\r\n// Array is empty\r\npm.test(\"Response array is empty\", function () {\r\n    pm.expect(json).to.have.lengthOf(0);\r\n});\r\n\r\n// Response time\r\npm.test(\"Response time is less than 6000ms\", function () {\r\n    pm.expect(pm.response.responseTime).to.be.below(6000);\r\n});\r\n\r\n// Content-Type\r\npm.test(\"Content-Type is JSON\", function () {\r\n    pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");\r\n});"]}}],"id":"f435a6ba-9b73-40eb-b11d-ef6b2b2a05a6","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveStudioBaseUrl}}api/my-images/tags","urlObject":{"path":["my-images","tags"],"host":["{{smooveStudioBaseUrl}}api"],"query":[],"variable":[]}},"response":[{"id":"bce001b7-e94c-415e-9958-d5c7ae810189","name":"Untitled Response","originalRequest":{"method":"GET","header":[{"key":"Accept","value":"text/plain"},{"key":"apiKey","value":"<API Key>","description":"Added as a part of security scheme: apikey"}],"url":"{{baseUrl}}/api/my-images/tags"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"[\n  \"string\",\n  \"string\"\n]"}],"_postman_id":"f435a6ba-9b73-40eb-b11d-ef6b2b2a05a6"}],"id":"e7b99ef6-742e-439d-939c-a369daf5a0cb","_postman_id":"e7b99ef6-742e-439d-939c-a369daf5a0cb","description":""},{"name":"Image Gallery Get Images","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveStudioCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", () => {\r\n    pm.response.to.have.status(200);\r\n});\r\n\r\npm.test(\"Response time is less than 4000ms\", () => {\r\n    pm.expect(pm.response.responseTime).to.be.below(4000);\r\n});\r\n\r\npm.test(\"Response contains all required fields\", () => {\r\n    const json = pm.response.json();\r\n    [\"images\", \"currentPage\", \"totalPages\", \"totalCount\", \"hasMore\", \"totalSize\"]\r\n        .forEach(field => pm.expect(json).to.have.property(field));\r\n});\r\n\r\npm.test(\"Field types are correct\", () => {\r\n    const json = pm.response.json();\r\n    pm.expect(json.images).to.be.an(\"array\");\r\n    pm.expect(json.currentPage).to.be.a(\"number\");\r\n    pm.expect(json.totalPages).to.be.a(\"number\");\r\n    pm.expect(json.totalCount).to.be.a(\"number\");\r\n    pm.expect(json.hasMore).to.be.a(\"boolean\");\r\n    pm.expect(json.totalSize).to.be.a(\"number\");\r\n});\r\n\r\npm.test(\"Pagination values are correct\", () => {\r\n    const json = pm.response.json();\r\n    pm.expect(json.currentPage).to.be.at.least(1);\r\n    pm.expect(json.totalPages).to.be.at.least(1);\r\n    pm.expect(json.totalCount).to.equal(json.images.length);\r\n    pm.expect(json.hasMore).to.equal(json.currentPage < json.totalPages);\r\n    pm.expect(json.totalSize).to.be.at.least(0);\r\n});\r\n\r\npm.test(\"Image objects have correct fields and types\", () => {\r\n    const json = pm.response.json();\r\n\r\n    pm.expect(json.images).to.not.be.empty;\r\n\r\n    json.images.forEach((img, i) => {\r\n        const label = `images[${i}]`;\r\n\r\n        [\"id\", \"userId\", \"originalName\", \"blobPath\", \"url\", \"fileType\"]\r\n            .forEach(field => pm.expect(img[field], `${label}.${field}`).to.be.a(\"string\").and.not.empty);\r\n\r\n        [\"alt\", \"title\", \"description\"].forEach(field => {\r\n            if (img[field] !== undefined && img[field] !== null) {\r\n                pm.expect(img[field], `${label}.${field}`).to.be.a(\"string\");\r\n            }\r\n        });\r\n\r\n        pm.expect(img.fileSize, `${label}.fileSize`).to.be.a(\"number\").and.above(0);\r\n        [\"width\", \"height\"].forEach(field => {\r\n            if (img[field] !== undefined && img[field] !== null) {\r\n                pm.expect(img[field], `${label}.${field}`).to.be.a(\"number\").and.above(0);\r\n            }\r\n        });\r\n\r\n        pm.expect(img.isPublic, `${label}.isPublic`).to.be.a(\"boolean\");\r\n        pm.expect(img.tags, `${label}.tags`).to.be.an(\"array\");\r\n        pm.expect(img.dominantColors, `${label}.dominantColors`).to.be.an(\"array\");\r\n        pm.expect(img.fileType, `${label}.fileType`).to.match(/^image\\/.+/);\r\n\r\n        [\"url\", \"blobPath\"].forEach(field =>\r\n            pm.expect(img[field], `${label}.${field}`).to.match(/^https?:\\/\\/.+/)\r\n        );\r\n\r\n        [\"createdAt\", \"updatedAt\"].forEach(field => {\r\n            pm.expect(img[field], `${label}.${field}`).to.be.a(\"string\");\r\n            pm.expect(new Date(img[field]).toString()).to.not.equal(\"Invalid Date\");\r\n        });\r\n    });\r\n});"]}}],"id":"f9a6d9d3-a53c-42ef-a9ed-c6551d40af74","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveStudioBaseUrl}}api/my-images?page=1&pageSize=20&query=string&tags=string&sortBy=createdAt&sortOrder=desc","urlObject":{"path":["my-images"],"host":["{{smooveStudioBaseUrl}}api"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"20"},{"key":"query","value":"string"},{"key":"tags","value":"string"},{"key":"sortBy","value":"createdAt"},{"key":"sortOrder","value":"desc"}],"variable":[]}},"response":[{"id":"177063a1-5135-4fb1-8322-210a7edf43e7","name":"Untitled Response","originalRequest":{"method":"GET","header":[{"key":"Accept","value":"text/plain"},{"key":"apiKey","value":"<API Key>","description":"Added as a part of security scheme: apikey"}],"url":{"raw":"{{baseUrl}}/api/my-images?page=1&pageSize=20&query=string&tags=string&sortBy=createdAt&sortOrder=desc","host":["{{baseUrl}}"],"path":["api","my-images"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"20"},{"key":"query","value":"string"},{"key":"tags","value":"string"},{"key":"sortBy","value":"createdAt"},{"key":"sortOrder","value":"desc"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"images\": [\n    {\n      \"id\": \"string\",\n      \"userId\": \"string\",\n      \"originalName\": \"string\",\n      \"blobPath\": \"string\",\n      \"url\": \"string\",\n      \"fileSize\": 5730,\n      \"fileType\": \"string\",\n      \"isPublic\": false,\n      \"tags\": [\n        \"string\",\n        \"string\"\n      ],\n      \"dominantColors\": [\n        {\n          \"hex\": \"string\",\n          \"percentage\": 3625.5678090023766\n        },\n        {\n          \"hex\": \"string\",\n          \"percentage\": 5722.316678413528\n        }\n      ],\n      \"createdAt\": \"2024-04-06T09:20:47.752Z\",\n      \"updatedAt\": \"2011-08-18T20:49:18.992Z\",\n      \"thumbnailUrl\": \"string\",\n      \"alt\": \"string\",\n      \"title\": \"string\",\n      \"description\": \"string\",\n      \"width\": 8547,\n      \"height\": 8037\n    },\n    {\n      \"id\": \"string\",\n      \"userId\": \"string\",\n      \"originalName\": \"string\",\n      \"blobPath\": \"string\",\n      \"url\": \"string\",\n      \"fileSize\": 70,\n      \"fileType\": \"string\",\n      \"isPublic\": true,\n      \"tags\": [\n        \"string\",\n        \"string\"\n      ],\n      \"dominantColors\": [\n        {\n          \"hex\": \"string\",\n          \"percentage\": 4407.3431871530875\n        },\n        {\n          \"hex\": \"string\",\n          \"percentage\": 4075.107819750865\n        }\n      ],\n      \"createdAt\": \"1984-01-10T07:04:27.920Z\",\n      \"updatedAt\": \"2019-09-02T07:59:08.381Z\",\n      \"thumbnailUrl\": \"string\",\n      \"alt\": \"string\",\n      \"title\": \"string\",\n      \"description\": \"string\",\n      \"width\": 3365,\n      \"height\": 6140\n    }\n  ],\n  \"currentPage\": 2419,\n  \"totalPages\": 2332,\n  \"totalCount\": 2990,\n  \"hasMore\": false,\n  \"totalSize\": 9854.80378474582\n}"}],"_postman_id":"f9a6d9d3-a53c-42ef-a9ed-c6551d40af74"}],"id":"56c9260c-02ec-402e-b9c2-515e570a6b4f","_postman_id":"56c9260c-02ec-402e-b9c2-515e570a6b4f","description":""},{"name":"public-images","item":[{"name":"search","item":[{"name":"Public Images Search Images","id":"a62cfed4-f0a4-4c3b-bfc8-97eb75dd270d","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveStudioBaseUrl}}api/public-images/search?query=test&page=1&perPage=20&orientation=test&orderBy=relevant","urlObject":{"path":["public-images","search"],"host":["{{smooveStudioBaseUrl}}api"],"query":[{"key":"query","value":"test"},{"key":"page","value":"1"},{"key":"perPage","value":"20"},{"key":"orientation","value":"test"},{"key":"orderBy","value":"relevant"}],"variable":[]}},"response":[{"id":"82c38617-1aeb-48ed-b00b-d60746c6e692","name":"Untitled Response","originalRequest":{"method":"GET","header":[{"key":"Accept","value":"text/plain"},{"key":"apiKey","value":"<API Key>","description":"Added as a part of security scheme: apikey"}],"url":{"raw":"{{baseUrl}}/api/public-images/search?query=string&page=1&perPage=20&orientation=string&orderBy=relevant","host":["{{baseUrl}}"],"path":["api","public-images","search"],"query":[{"key":"query","value":"string"},{"key":"page","value":"1"},{"key":"perPage","value":"20"},{"key":"orientation","value":"string"},{"key":"orderBy","value":"relevant"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"results\": [\n    {\n      \"id\": \"string\",\n      \"unsplashId\": \"string\",\n      \"url\": \"string\",\n      \"thumbnailUrl\": \"string\",\n      \"photographer\": \"string\",\n      \"photographerUrl\": \"string\",\n      \"downloadLocation\": \"string\",\n      \"likes\": 6066,\n      \"color\": \"string\",\n      \"downloadUrl\": \"string\",\n      \"alt\": \"string\",\n      \"title\": \"string\",\n      \"description\": \"string\",\n      \"width\": 3796,\n      \"height\": 7844\n    },\n    {\n      \"id\": \"string\",\n      \"unsplashId\": \"string\",\n      \"url\": \"string\",\n      \"thumbnailUrl\": \"string\",\n      \"photographer\": \"string\",\n      \"photographerUrl\": \"string\",\n      \"downloadLocation\": \"string\",\n      \"likes\": 6501,\n      \"color\": \"string\",\n      \"downloadUrl\": \"string\",\n      \"alt\": \"string\",\n      \"title\": \"string\",\n      \"description\": \"string\",\n      \"width\": 4100,\n      \"height\": 9729\n    }\n  ],\n  \"total\": 4143,\n  \"totalPages\": 5223,\n  \"currentPage\": 9704,\n  \"perPage\": 6354\n}"}],"_postman_id":"a62cfed4-f0a4-4c3b-bfc8-97eb75dd270d"}],"id":"9e16c634-2fcb-4c65-ac72-19171fc955a0","_postman_id":"9e16c634-2fcb-4c65-ac72-19171fc955a0","description":""},{"name":"download","item":[{"name":"{id}","item":[{"name":"Public Images Download Image","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test(\"Status is 200\", function () {\r\n    pm.expect(pm.response.code).to.equal(200);\r\n});\r\n\r\npm.test(\"Response structure is correct\", function () {\r\n    const json = pm.response.json();\r\n\r\n    pm.expect(json).to.have.property(\"imageUrl\");\r\n    pm.expect(json).to.have.property(\"imageData\");\r\n    pm.expect(json).to.have.property(\"message\");\r\n});\r\n\r\npm.test(\"Message is correct\", function () {\r\n    const json = pm.response.json();\r\n    pm.expect(json.message).to.eql(\"Image ready for use\");\r\n});\r\n\r\npm.test(\"imageUrl is a valid URL\", function () {\r\n    const json = pm.response.json();\r\n    pm.expect(json.imageUrl).to.match(/^https?:\\/\\/.+/);\r\n});\r\n\r\npm.test(\"imageData fields are correct\", function () {\r\n    const { imageData } = pm.response.json();\r\n\r\n    pm.expect(imageData.id).to.be.a(\"string\").and.not.empty;\r\n    pm.expect(imageData.unsplashId).to.eql(imageData.id);\r\n    pm.expect(imageData.alt).to.be.a(\"string\").and.not.empty;\r\n    pm.expect(imageData.width).to.be.a(\"number\").and.above(0);\r\n    pm.expect(imageData.height).to.be.a(\"number\").and.above(0);\r\n    pm.expect(imageData.likes).to.be.a(\"number\").and.at.least(0);\r\n    pm.expect(imageData.color).to.match(/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/);\r\n    pm.expect(imageData.photographer).to.be.a(\"string\").and.not.empty;\r\n});\r\n\r\npm.test(\"imageData URLs are valid\", function () {\r\n    const { imageData } = pm.response.json();\r\n\r\n    [\"url\", \"thumbnailUrl\", \"photographerUrl\", \"downloadLocation\", \"downloadUrl\"].forEach(field => {\r\n        pm.expect(imageData[field], field).to.match(/^https?:\\/\\/.+/);\r\n    });\r\n});\r\n\r\npm.test(\"imageUrl matches imageData.url\", function () {\r\n    const json = pm.response.json();\r\n    pm.expect(json.imageUrl).to.eql(json.imageData.url);\r\n});\r\n\r\nconst { imageData } = pm.response.json();\r\n\r\n[\"url\", \"thumbnailUrl\", \"photographerUrl\", \"downloadUrl\"].forEach(field => {\r\n    pm.test(`${field} returns 200`, function (done) {\r\n        pm.sendRequest(imageData[field], function (err, res) {\r\n            pm.expect(err).to.be.null;\r\n            pm.expect(res).to.have.status(200);\r\n            done();\r\n        });\r\n    });\r\n});\r\n\r\npm.test(\"imageUrl returns 200\", function (done) {\r\n    pm.sendRequest(pm.response.json().imageUrl, function (err, res) {\r\n        pm.expect(err).to.be.null;\r\n        pm.expect(res).to.have.status(200);\r\n        done();\r\n    });\r\n});"]}}],"id":"ad9e8c2e-dbd0-42e2-8083-59f834523dae","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveStudioBaseUrl}}api/public-images/download/:id","urlObject":{"path":["public-images","download",":id"],"host":["{{smooveStudioBaseUrl}}api"],"query":[],"variable":[{"id":"2b1e481e-e6f7-4995-886c-0602afa69366","type":"any","value":"N0e6W2WDa5U","key":"id"}]}},"response":[{"id":"2ff5ad3e-39d9-4b57-9547-70bdf61f9f06","name":"Untitled Response","originalRequest":{"method":"POST","header":[{"key":"Accept","value":"text/plain"},{"key":"apiKey","value":"<API Key>","description":"Added as a part of security scheme: apikey"}],"url":{"raw":"{{baseUrl}}/api/public-images/download/:id","host":["{{baseUrl}}"],"path":["api","public-images","download",":id"],"variable":[{"key":"id","value":"string"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"imageUrl\": \"string\",\n  \"imageData\": {\n    \"id\": \"string\",\n    \"unsplashId\": \"string\",\n    \"url\": \"string\",\n    \"thumbnailUrl\": \"string\",\n    \"photographer\": \"string\",\n    \"photographerUrl\": \"string\",\n    \"downloadLocation\": \"string\",\n    \"likes\": 9956,\n    \"color\": \"string\",\n    \"downloadUrl\": \"string\",\n    \"alt\": \"string\",\n    \"title\": \"string\",\n    \"description\": \"string\",\n    \"width\": 3813,\n    \"height\": 4529\n  },\n  \"message\": \"string\"\n}"}],"_postman_id":"ad9e8c2e-dbd0-42e2-8083-59f834523dae"}],"id":"48b4aa57-d95e-4eb9-bc75-2268631e4fdc","_postman_id":"48b4aa57-d95e-4eb9-bc75-2268631e4fdc","description":""}],"id":"2d0a6680-64b8-4768-bdc1-ae440a6567cd","_postman_id":"2d0a6680-64b8-4768-bdc1-ae440a6567cd","description":""},{"name":"{id}","item":[{"name":"Public Images Get Image Details","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test(\"Status is 200\", function () {\r\n    pm.expect(pm.response.code).to.equal(200);\r\n});\r\n\r\npm.test(\"Response structure is correct\", function () {\r\n    const json = pm.response.json();\r\n\r\n    [\"id\", \"unsplashId\", \"url\", \"thumbnailUrl\", \"alt\", \"width\", \"height\",\r\n     \"photographer\", \"photographerUrl\", \"downloadLocation\", \"likes\", \"color\", \"downloadUrl\"]\r\n        .forEach(field => pm.expect(json).to.have.property(field));\r\n});\r\n\r\npm.test(\"Field values are correct\", function () {\r\n    const json = pm.response.json();\r\n\r\n    pm.expect(json.id).to.be.a(\"string\").and.not.empty;\r\n    pm.expect(json.unsplashId).to.eql(json.id);\r\n    pm.expect(json.alt).to.be.a(\"string\").and.not.empty;\r\n    pm.expect(json.width).to.be.a(\"number\").and.above(0);\r\n    pm.expect(json.height).to.be.a(\"number\").and.above(0);\r\n    pm.expect(json.likes).to.be.a(\"number\").and.at.least(0);\r\n    pm.expect(json.color).to.match(/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/);\r\n    pm.expect(json.photographer).to.be.a(\"string\").and.not.empty;\r\n});\r\n\r\npm.test(\"URLs are valid\", function () {\r\n    const json = pm.response.json();\r\n\r\n    [\"url\", \"thumbnailUrl\", \"photographerUrl\", \"downloadLocation\", \"downloadUrl\"].forEach(field => {\r\n        pm.expect(json[field], field).to.match(/^https?:\\/\\/.+/);\r\n    });\r\n});\r\n\r\npm.test(\"url matches downloadUrl\", function () {\r\n    const json = pm.response.json();\r\n    pm.expect(json.url).to.eql(json.downloadUrl);\r\n});\r\n\r\nconst json = pm.response.json();\r\n\r\n[\"url\", \"thumbnailUrl\", \"photographerUrl\", \"downloadUrl\"].forEach(field => {\r\n    pm.test(`${field} returns 200`, function (done) {\r\n        pm.sendRequest(json[field], function (err, res) {\r\n            pm.expect(err).to.be.null;\r\n            pm.expect(res).to.have.status(200);\r\n            done();\r\n        });\r\n    });\r\n});"]}}],"id":"e94e5503-2dc1-40cb-9d9b-866adb12e034","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveStudioBaseUrl}}api/public-images/:id","urlObject":{"path":["public-images",":id"],"host":["{{smooveStudioBaseUrl}}api"],"query":[],"variable":[{"id":"777d732f-3c95-4b9f-8ab3-4a645570aa54","type":"any","value":"N0e6W2WDa5U","key":"id"}]}},"response":[{"id":"4492fafa-a6e4-4727-9f00-73b5721561e1","name":"Untitled Response","originalRequest":{"method":"GET","header":[{"key":"Accept","value":"text/plain"},{"key":"apiKey","value":"<API Key>","description":"Added as a part of security scheme: apikey"}],"url":{"raw":"{{baseUrl}}/api/public-images/:id","host":["{{baseUrl}}"],"path":["api","public-images",":id"],"variable":[{"key":"id","value":"string"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"id\": \"string\",\n  \"unsplashId\": \"string\",\n  \"url\": \"string\",\n  \"thumbnailUrl\": \"string\",\n  \"photographer\": \"string\",\n  \"photographerUrl\": \"string\",\n  \"downloadLocation\": \"string\",\n  \"likes\": 3703,\n  \"color\": \"string\",\n  \"downloadUrl\": \"string\",\n  \"alt\": \"string\",\n  \"title\": \"string\",\n  \"description\": \"string\",\n  \"width\": 8244,\n  \"height\": 9387\n}"}],"_postman_id":"e94e5503-2dc1-40cb-9d9b-866adb12e034"}],"id":"5577e2c2-7179-4979-9191-3f236f4db4d4","_postman_id":"5577e2c2-7179-4979-9191-3f236f4db4d4","description":""}],"id":"14b89694-15a9-4efb-8569-e8c6a4dcedb0","_postman_id":"14b89694-15a9-4efb-8569-e8c6a4dcedb0","description":""}],"id":"28e286dd-18bb-4c51-b3e3-af2236a06f4c","_postman_id":"28e286dd-18bb-4c51-b3e3-af2236a06f4c","description":""},{"name":"templates","item":[{"name":"alltemplates","item":[{"name":"Templates Get All","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Response status code is 200\", function () {\n    pm.expect(pm.response.code).to.equal(200);\n});\n\npm.test(\"Response time is less than 20000ms\", function () {\n    pm.expect(pm.response.responseTime).to.be.below(20000);\n});\n\npm.test(\"Response has a non-empty templates array\", function () {\n    const responseData = pm.response.json();\n    pm.expect(responseData).to.be.an(\"object\").that.is.not.empty;\n    pm.expect(responseData.templates).to.be.an(\"array\").that.is.not.empty;\n});\n\npm.test(\"Validate the schema of each template object in the response\", function () {\n    const templates = pm.response.json().templates;\n    const allowedTypes = [\"landingPage\", \"email\"];\n\n    templates.forEach((template) => {\n        pm.expect(template).to.be.an(\"object\");\n        pm.expect(template.id).to.be.a(\"string\").and.not.be.empty;\n        pm.expect(template.type).to.be.a(\"string\");\n        pm.expect(allowedTypes).to.include(template.type);\n        pm.expect(template.name).to.be.a(\"string\").and.not.be.empty;\n        pm.expect(template.language).to.be.a(\"string\").and.not.be.empty;\n        pm.expect(template.isActive).to.be.a(\"boolean\");\n        pm.expect(template.createdAt).to.be.a(\"string\").and.not.be.empty;\n        pm.expect(template.html).to.be.a(\"string\");\n    });\n});\n\npm.test(\"Validate template field formats\", function () {\n    const templates = pm.response.json().templates;\n    const allowedLanguages = [\"Hebrew\", \"English\", \"he\", \"en\", \"hebrew\", \"english\"];\n\n    templates.forEach((template) => {\n        pm.expect(new Date(template.createdAt).toString()).to.not.eql(\"Invalid Date\");\n        pm.expect(allowedLanguages.map((l) => l.toLowerCase())).to.include(String(template.language).toLowerCase());\n    });\n});\n"]}}],"id":"de60e989-4c30-4e8a-8ffb-56632040c91d","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveStudioBaseUrl}}templates/alltemplates","urlObject":{"path":["alltemplates"],"host":["{{smooveStudioBaseUrl}}templates"],"query":[],"variable":[]}},"response":[],"_postman_id":"de60e989-4c30-4e8a-8ffb-56632040c91d"}],"id":"8503b613-9c95-4312-abdd-5b3d457ea1ba","_postman_id":"8503b613-9c95-4312-abdd-5b3d457ea1ba","description":""},{"name":"{id}","item":[{"name":"Templates Get By Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveStudioCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst templateId = pm.environment.get(\"smooveStudioTemplate\");\nif (!templateId) {\n    throw new Error(\"Set smooveStudioTemplate in environment\");\n}\n\nconst baseUrl = pm.environment.get(\"smooveStudioBaseUrl\");\npm.request.url = `${baseUrl}templates/${templateId}`;\n"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Response status code is 200\", function () {\n    pm.expect(pm.response.code).to.equal(200);\n});\n\npm.test(\"Response time is less than 10000ms\", function () {\n    pm.expect(pm.response.responseTime).to.be.below(10000);\n});\n\npm.test(\"Validate presence of required fields in the response\", function () {\n    const template = pm.response.json();\n    pm.expect(template).to.be.an(\"object\");\n    pm.expect(template).to.include.all.keys(\"id\", \"type\", \"name\", \"language\", \"isActive\", \"createdAt\", \"html\");\n});\n\npm.test(\"Validate template field types and formats\", function () {\n    const template = pm.response.json();\n    const allowedTypes = [\"landingPage\", \"email\"];\n    const allowedLanguages = [\"Hebrew\", \"English\", \"he\", \"en\", \"hebrew\", \"english\"];\n\n    pm.expect(template.id).to.be.a(\"string\").and.not.be.empty;\n    pm.expect(allowedTypes).to.include(template.type);\n    pm.expect(template.name).to.be.a(\"string\").and.not.be.empty;\n    pm.expect(template.language).to.be.a(\"string\").and.not.be.empty;\n    pm.expect(allowedLanguages.map((l) => l.toLowerCase())).to.include(String(template.language).toLowerCase());\n    pm.expect(template.isActive).to.be.a(\"boolean\");\n    pm.expect(new Date(template.createdAt).toString()).to.not.eql(\"Invalid Date\");\n    pm.expect(template.html).to.be.a(\"string\").and.not.be.empty;\n});\n\npm.test(\"Validate landing page html structure\", function () {\n    const template = pm.response.json();\n    if (template.type !== \"landingPage\") {\n        return;\n    }\n\n    pm.expect(template.html).to.include(\"<!DOCTYPE html>\");\n    pm.expect(template.html.toLowerCase()).to.include(\"<html\");\n    pm.expect(template.html.toLowerCase()).to.include(\"</html>\");\n});\n"]}}],"id":"b4ec3451-7d6d-4603-bb94-5a00e73d2edb","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveStudioBaseUrl}}templates/{{smooveStudioTemplate}}","urlObject":{"path":["{{smooveStudioTemplate}}"],"host":["{{smooveStudioBaseUrl}}templates"],"query":[],"variable":[]}},"response":[],"_postman_id":"b4ec3451-7d6d-4603-bb94-5a00e73d2edb"}],"id":"7cb215ff-6486-49bc-9875-14e71710d8bd","_postman_id":"7cb215ff-6486-49bc-9875-14e71710d8bd","description":""}],"id":"890f1eeb-b418-4be9-9281-0772f0683c59","_postman_id":"890f1eeb-b418-4be9-9281-0772f0683c59","description":""}],"id":"6d978919-d6ff-4526-88a5-765978b02f6b","_postman_id":"6d978919-d6ff-4526-88a5-765978b02f6b","description":""},{"name":"Smoove.AgentApi","item":[{"name":"access","item":[{"name":"Agent Get Access","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"AgentAccessResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    pm.expect(json, \"missing isBlocked\").to.have.property(\"isBlocked\");\n    pm.expect(json.isBlocked, \"isBlocked\").to.be.a(\"boolean\");\n    pm.expect(\n        json.reason == null || typeof json.reason === \"string\",\n        \"reason\"\n    ).to.eql(true);\n});\n\npm.test(\"Check: configured agent account is not blocked\", function () {\n    const json = pm.response.json();\n    const siteId = pm.environment.get(\"agentApiSiteId\");\n    const username = pm.environment.get(\"agentApiUsername\");\n    pm.expect(siteId, \"agentApiSiteId\").to.be.a(\"string\").and.not.empty;\n    pm.expect(username, \"agentApiUsername\").to.be.a(\"string\").and.not.empty;\n    pm.expect(json.isBlocked, \"isBlocked for \" + username + \" / \" + siteId).to.eql(false);\n    pm.expect(json.reason, \"reason\").to.eql(null);\n});"]}}],"id":"95330ea3-2336-4c08-877b-cd9b15f3a781","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{agentApiBaseUrl}}/api/agent/access","urlObject":{"path":["api","agent","access"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"95330ea3-2336-4c08-877b-cd9b15f3a781"}],"id":"d4608dc9-1d72-47c1-8f7d-88f24919b0d1","_postman_id":"d4608dc9-1d72-47c1-8f7d-88f24919b0d1","description":""},{"name":"chats","item":[{"name":"create","item":[{"name":"Agent Create Chat","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nconst title = \"Postman Agent Chat \" + Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.environment.set(\"agentApiChatTitle\", title);\npm.request.body.update(JSON.stringify({ title: title }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function getAgentChat(chatId) {\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/get?page=1&size=50\",\n        method: \"GET\",\n        header: agentHeaders()\n    });\n}\n\nasync function deleteAgentChat(chatId) {\n    if (!chatId) return { code: 204 };\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/delete\",\n        method: \"DELETE\",\n        header: agentHeaders()\n    });\n}\n\nasync function cleanupAgentChat(chatId) {\n    let res = await deleteAgentChat(chatId);\n    if (res && res.code === 409) {\n        await new Promise(function (r) { setTimeout(r, 2000); });\n        res = await deleteAgentChat(chatId);\n    }\n    return res;\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"CreateChatResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    pm.expect(json.chatId, \"chatId\").to.be.a(\"number\").and.above(0);\n    pm.expect(json.title, \"title\").to.be.a(\"string\").and.eql(pm.environment.get(\"agentApiChatTitle\"));\n});\n\nconst chatId = pm.response.json().chatId;\npm.environment.set(\"agentApiChatId\", String(chatId));\n\nconst getRes = await getAgentChat(chatId);\npm.test(\"Check: GET returns the created chat\", function () {\n    pm.expect(getRes.code).to.eql(200);\n    const got = getRes.json();\n    pm.expect(got.chatId, \"chatId\").to.eql(chatId);\n    pm.expect(got.title, \"title\").to.eql(pm.environment.get(\"agentApiChatTitle\"));\n});\n\nconst cleanupRes = await cleanupAgentChat(chatId);\npm.test(\"Cleanup deletes the created chat\", function () {\n    pm.expect([200, 204]).to.include(cleanupRes.code);\n});\npm.environment.unset(\"agentApiChatId\");\npm.environment.unset(\"agentApiChatTitle\");"]}}],"id":"1ba1c9de-4904-4d56-aa04-af1e7cf70a63","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"title\": \"Postman Agent Chat\"\n}","options":{"raw":{"language":"json"}}},"url":"{{agentApiBaseUrl}}/api/agent/chats/create","urlObject":{"path":["api","agent","chats","create"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"1ba1c9de-4904-4d56-aa04-af1e7cf70a63"}],"id":"3c630be9-7f69-45ed-bf54-70c08bdd5d16","_postman_id":"3c630be9-7f69-45ed-bf54-70c08bdd5d16","description":""},{"name":"list","item":[{"name":"Agent List Chats","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function createAgentChat(title) {\n    const res = await send({\n        url: agentBaseUrl() + \"/api/agent/chats/create\",\n        method: \"POST\",\n        header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({ title: title || (\"Postman \" + Date.now()) })\n        }\n    });\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error(\"Create chat failed: \" + (res && res.code) + \" \" + (res && res.text()));\n    }\n    return res.json();\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nconst searchTitle = \"Postman List Search \" + Date.now();\nconst created = await createAgentChat(searchTitle);\npm.environment.set(\"agentApiChatId\", String(created.chatId));\npm.environment.set(\"agentApiChatTitle\", searchTitle);\npm.environment.set(\"agentApiSearch\", searchTitle);\npm.environment.set(\"agentApiPage\", \"1\");\npm.environment.set(\"agentApiSize\", \"10\");"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function deleteAgentChat(chatId) {\n    if (!chatId) return { code: 204 };\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/delete\",\n        method: \"DELETE\",\n        header: agentHeaders()\n    });\n}\n\nasync function cleanupAgentChat(chatId) {\n    let res = await deleteAgentChat(chatId);\n    if (res && res.code === 409) {\n        await new Promise(function (r) { setTimeout(r, 2000); });\n        res = await deleteAgentChat(chatId);\n    }\n    return res;\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"ListChatsResponse shape with search\", function () {\n    const json = pm.response.json();\n    const seededId = Number(pm.environment.get(\"agentApiChatId\"));\n    const searchTitle = pm.environment.get(\"agentApiChatTitle\");\n    pm.expect(json).to.be.an(\"object\");\n    pm.expect(json.chats, \"chats\").to.be.an(\"array\").and.have.lengthOf.at.least(1);\n    pm.expect(json.hasMore, \"hasMore\").to.be.a(\"boolean\");\n    const chat = json.chats.find(function (c) { return c.chatId === seededId; });\n    pm.expect(chat, \"seeded chat in search results\").to.exist;\n    [\"chatId\", \"status\", \"isPinned\", \"isTurnRunning\", \"hasArtifacts\", \"createdAt\"].forEach(function (key) {\n        pm.expect(chat, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(chat.chatId, \"chatId\").to.be.a(\"number\").and.eql(seededId);\n    pm.expect(chat.title, \"title\").to.eql(searchTitle);\n    pm.expect(chat.status, \"status\").to.be.a(\"string\");\n    pm.expect(chat.isPinned, \"isPinned\").to.be.a(\"boolean\");\n    pm.expect(chat.isTurnRunning, \"isTurnRunning\").to.be.a(\"boolean\");\n    pm.expect(chat.hasArtifacts, \"hasArtifacts\").to.be.a(\"boolean\");\n    pm.expect(chat.createdAt, \"createdAt\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(chat.createdAt)), \"createdAt parseable\").to.eql(false);\n});\n\nconst missSearch = \"postman-no-match-\" + Date.now();\nconst missRes = await send({\n    url: agentBaseUrl() + \"/api/agent/chats/list?page=1&size=10&search=\" + encodeURIComponent(missSearch),\n    method: \"GET\",\n    header: agentHeaders()\n});\npm.test(\"Check: unrelated search does not return the seeded chat\", function () {\n    pm.expect(missRes.code).to.eql(200);\n    const seededId = Number(pm.environment.get(\"agentApiChatId\"));\n    const chats = missRes.json().chats || [];\n    pm.expect(chats.some(function (c) { return c.chatId === seededId; }), \"seeded chat absent\").to.eql(false);\n});\n\nconst cleanupRes = await cleanupAgentChat(pm.environment.get(\"agentApiChatId\"));\npm.test(\"Cleanup deletes the seeded chat\", function () {\n    pm.expect([200, 204]).to.include(cleanupRes.code);\n});\npm.environment.unset(\"agentApiChatId\");\npm.environment.unset(\"agentApiChatTitle\");\npm.environment.unset(\"agentApiSearch\");"]}}],"id":"9b2daf64-e571-44d6-b4c8-240397c4ef0e","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{agentApiBaseUrl}}/api/agent/chats/list?page={{agentApiPage}}&size={{agentApiSize}}&search={{agentApiSearch}}","urlObject":{"path":["api","agent","chats","list"],"host":["{{agentApiBaseUrl}}"],"query":[{"key":"page","value":"{{agentApiPage}}"},{"key":"size","value":"{{agentApiSize}}"},{"key":"search","value":"{{agentApiSearch}}"}],"variable":[]}},"response":[],"_postman_id":"9b2daf64-e571-44d6-b4c8-240397c4ef0e"}],"id":"15ca3bc2-7f30-432c-9b64-469cd4362478","_postman_id":"15ca3bc2-7f30-432c-9b64-469cd4362478","description":""},{"name":"{chatId}","item":[{"name":"assets","item":[{"name":"list","item":[{"name":"Agent List Chat Assets","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nif (!pm.environment.get(\"agentApiChatIdForAssets\")) {\n    throw new Error(\"Set agentApiChatIdForAssets to a chat that has listed assets\");\n}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\n// Allowed assetType values; duplicates (e.g. multiple emails) are fine.\nconst acceptedAssetTypes = [\n    \"businessJourney\",\n    \"list\",\n    \"landingPage\",\n    \"email\",\n    \"bpm\",\n    \"sms\"\n];\n\npm.test(\"ListChatAssetsResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json.assets, \"assets\").to.be.an(\"array\").and.have.lengthOf.at.least(1);\n    json.assets.forEach(function (asset, index) {\n        const label = \"assets[\" + index + \"]\";\n        pm.expect(asset.artifactId, label + \".artifactId\").to.be.a(\"number\").and.above(0);\n        pm.expect(asset.assetId, label + \".assetId\").to.be.a(\"number\").and.above(0);\n        pm.expect(asset.assetType, label + \".assetType\").to.be.a(\"string\").and.not.empty;\n        pm.expect(\n            acceptedAssetTypes,\n            label + \" unexpected assetType \" + asset.assetType\n        ).to.include(asset.assetType);\n    });\n});"]}}],"id":"b67ab673-4d57-4e16-8121-eab799fd09ad","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/assets/list","urlObject":{"path":["api","agent","chats",":chatId","assets","list"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[{"type":"any","value":"{{agentApiChatIdForAssets}}","key":"chatId"}]}},"response":[],"_postman_id":"b67ab673-4d57-4e16-8121-eab799fd09ad"}],"id":"20418a8b-7474-4d2b-a701-a68f8bf5a4fc","_postman_id":"20418a8b-7474-4d2b-a701-a68f8bf5a4fc","description":""}],"id":"a745cc9c-d4fa-4e65-a510-959f269229c2","_postman_id":"a745cc9c-d4fa-4e65-a510-959f269229c2","description":""},{"name":"cancel","item":[{"name":"Agent Cancel","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function createAgentChat(title) {\n    const res = await send({\n        url: agentBaseUrl() + \"/api/agent/chats/create\",\n        method: \"POST\",\n        header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({ title: title || (\"Postman \" + Date.now()) })\n        }\n    });\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error(\"Create chat failed: \" + (res && res.code) + \" \" + (res && res.text()));\n    }\n    return res.json();\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nconst created = await createAgentChat(\"Postman Cancel Chat\");\nconst chatId = created.chatId;\npm.environment.set(\"agentApiChatId\", String(chatId));\n\nconst prompt = pm.environment.get(\"agentApiPrompt\") || \"Reply with ok\";\nlet promptRes = null;\nfor (let attempt = 1; attempt <= 3; attempt++) {\n    const boundary = \"----AgentCancel\" + Date.now() + \"-\" + attempt;\n    const promptBody =\n        \"--\" + boundary + \"\\r\\n\" +\n        'Content-Disposition: form-data; name=\"Prompt\"\\r\\n\\r\\n' +\n        prompt + \"\\r\\n\" +\n        \"--\" + boundary + \"--\\r\\n\";\n    promptRes = await send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/prompt\",\n        method: \"POST\",\n        header: agentHeaders({\n            \"Content-Type\": \"multipart/form-data; boundary=\" + boundary\n        }),\n        body: { mode: \"raw\", raw: promptBody }\n    });\n    if (promptRes && promptRes.code === 200) {\n        break;\n    }\n    if (!promptRes || promptRes.code < 500 || attempt === 3) {\n        throw new Error(\"Seed prompt failed: \" + (promptRes && promptRes.code));\n    }\n    console.log(\"Cancel seed prompt status=\" + promptRes.code + \" retry \" + attempt + \"/3\");\n    await new Promise(function (r) { setTimeout(r, 1000 * attempt); });\n}\nconst turnId = promptRes.json().turnId;\npm.environment.set(\"agentApiTurnId\", turnId);\npm.request.body.update(JSON.stringify({ turnId: turnId }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function getAgentChat(chatId) {\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/get?page=1&size=50\",\n        method: \"GET\",\n        header: agentHeaders()\n    });\n}\n\nasync function deleteAgentChat(chatId) {\n    if (!chatId) return { code: 204 };\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/delete\",\n        method: \"DELETE\",\n        header: agentHeaders()\n    });\n}\n\nasync function cleanupAgentChat(chatId) {\n    let res = await deleteAgentChat(chatId);\n    if (res && res.code === 409) {\n        await new Promise(function (r) { setTimeout(r, 2000); });\n        res = await deleteAgentChat(chatId);\n    }\n    return res;\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"CancelTurnResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json.chatId, \"chatId\").to.be.a(\"number\").and.eql(Number(pm.environment.get(\"agentApiChatId\")));\n    pm.expect(json.turnId, \"turnId\").to.be.a(\"string\").and.eql(pm.environment.get(\"agentApiTurnId\"));\n});\n\nconst chatId = pm.environment.get(\"agentApiChatId\");\nlet getRes = null;\nfor (let attempt = 1; attempt <= 8; attempt++) {\n    await new Promise(function (r) { setTimeout(r, 1000 * attempt); });\n    getRes = await getAgentChat(chatId);\n    if (getRes && getRes.code === 200 && getRes.json().isTurnRunning === false) {\n        break;\n    }\n}\npm.test(\"Check: GET returns the chat after cancel\", function () {\n    pm.expect(getRes.code).to.eql(200);\n    pm.expect(getRes.json().chatId, \"chatId\").to.eql(Number(chatId));\n});\n\npm.test(\"Check: turn is no longer running after cancel\", function () {\n    pm.expect(getRes.code).to.eql(200);\n    const json = getRes.json();\n    pm.expect(json.isTurnRunning, \"isTurnRunning\").to.eql(false);\n    pm.expect(json.pendingInteraction, \"pendingInteraction\").to.eql(null);\n    pm.expect([\"idle\", \"cancelled\", \"canceled\"], \"status\").to.include(json.status);\n});\n\nconst cleanupRes = await cleanupAgentChat(chatId);\npm.test(\"Cleanup deletes the seeded chat\", function () {\n    pm.expect([200, 204]).to.include(cleanupRes.code);\n});\npm.environment.unset(\"agentApiChatId\");\npm.environment.unset(\"agentApiTurnId\");"]}}],"id":"3bc452e8-4ecb-4736-b43d-67750715fb89","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"turnId\": \"{{agentApiTurnId}}\"\n}","options":{"raw":{"language":"json"}}},"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/cancel","urlObject":{"path":["api","agent","chats",":chatId","cancel"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[{"type":"any","value":"{{agentApiChatId}}","key":"chatId"}]}},"response":[],"_postman_id":"3bc452e8-4ecb-4736-b43d-67750715fb89"}],"id":"8bd11b27-2695-41e2-b7b7-342cda9d28b8","_postman_id":"8bd11b27-2695-41e2-b7b7-342cda9d28b8","description":""},{"name":"delete","item":[{"name":"Agent Delete Chat","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function createAgentChat(title) {\n    const res = await send({\n        url: agentBaseUrl() + \"/api/agent/chats/create\",\n        method: \"POST\",\n        header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({ title: title || (\"Postman \" + Date.now()) })\n        }\n    });\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error(\"Create chat failed: \" + (res && res.code) + \" \" + (res && res.text()));\n    }\n    return res.json();\n}\n\nasync function getAgentChat(chatId) {\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/get?page=1&size=50\",\n        method: \"GET\",\n        header: agentHeaders()\n    });\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nconst created = await createAgentChat(\"Postman Delete Chat\");\nconst chatId = created.chatId;\npm.environment.set(\"agentApiChatIdToDelete\", String(chatId));\n\nconst getRes = await getAgentChat(chatId);\nif (!getRes || getRes.code !== 200) {\n    throw new Error(\"Verify chat exists failed: \" + (getRes && getRes.code));\n}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function getAgentChat(chatId) {\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/get?page=1&size=50\",\n        method: \"GET\",\n        header: agentHeaders()\n    });\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"DeleteChatResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    pm.expect(json.chatId, \"chatId\").to.be.a(\"number\").and.eql(Number(pm.environment.get(\"agentApiChatIdToDelete\")));\n});\n\nconst chatId = pm.environment.get(\"agentApiChatIdToDelete\");\nconst getRes = await getAgentChat(chatId);\npm.test(\"Check: follow-up GET shows chat is gone\", function () {\n    pm.expect([404, 400]).to.include(getRes.code);\n});\npm.environment.unset(\"agentApiChatIdToDelete\");"]}}],"id":"91bdeb04-e2f2-4ec5-8d59-f499840de38b","request":{"auth":{"type":"noauth","isInherited":false},"method":"DELETE","header":[{"key":"Accept","value":"application/json"}],"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/delete","urlObject":{"path":["api","agent","chats",":chatId","delete"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[{"type":"any","value":"{{agentApiChatIdToDelete}}","key":"chatId"}]}},"response":[],"_postman_id":"91bdeb04-e2f2-4ec5-8d59-f499840de38b"}],"id":"afb925e6-3a9b-4f4f-a3fb-fc567cb83274","_postman_id":"afb925e6-3a9b-4f4f-a3fb-fc567cb83274","description":""},{"name":"files","item":[{"name":"getBySessionPath","item":[{"name":"Agent Get By Session Path","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\n// Same harvested chat family as Get Chat File when the env has a session path.\nconst chatId = pm.environment.get(\"agentApiChatIdForFiles\");\nconst sessionPath = pm.environment.get(\"agentApiSessionPath\");\nif (!chatId || !sessionPath) {\n    throw new Error(\"Set agentApiChatIdForFiles and agentApiSessionPath to a harvested session file\");\n}\npm.request.url.variables.upsert({ key: \"chatId\", value: String(chatId) });\npm.request.url.query.upsert({ key: \"path\", value: String(sessionPath) });"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(100);\n});\n\npm.test(\"Content-Type matches harvested file fixture\", function () {\n    const ctype = String(pm.response.headers.get(\"Content-Type\") || \"\");\n    const expectedPrefix =\n        pm.environment.get(\"agentApiSessionPathContentTypePrefix\") ||\n        pm.environment.get(\"agentApiFileGetContentTypePrefix\") ||\n        \"text/plain\";\n    const escaped = expectedPrefix.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n    pm.expect(ctype, \"Content-Type\").to.match(new RegExp(\"^\" + escaped, \"i\"));\n});\n\npm.test(\"Check: body contains harvested file marker\", function () {\n    const marker =\n        pm.environment.get(\"agentApiFileGetBodyMarker\") || \"Welcome to Our Store\";\n    pm.expect(pm.response.text(), \"body\").to.include(marker);\n});"]}}],"id":"343bf0a7-4476-42a8-993e-6bfdf69c45ad","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/files/getBySessionPath?path={{agentApiSessionPath}}","urlObject":{"path":["api","agent","chats",":chatId","files","getBySessionPath"],"host":["{{agentApiBaseUrl}}"],"query":[{"key":"path","value":"{{agentApiSessionPath}}"}],"variable":[{"type":"any","value":"{{agentApiChatIdForFiles}}","key":"chatId"}]}},"response":[],"_postman_id":"343bf0a7-4476-42a8-993e-6bfdf69c45ad"}],"id":"4102cc21-5b94-4663-97d2-24aecb78bf39","_postman_id":"4102cc21-5b94-4663-97d2-24aecb78bf39","description":""},{"name":"list","item":[{"name":"Agent List Chat Files","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function createAgentChat(title) {\n    const res = await send({\n        url: agentBaseUrl() + \"/api/agent/chats/create\",\n        method: \"POST\",\n        header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({ title: title || (\"Postman \" + Date.now()) })\n        }\n    });\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error(\"Create chat failed: \" + (res && res.code) + \" \" + (res && res.text()));\n    }\n    return res.json();\n}\n\nfunction buildFilesMultipart(boundary, filename) {\n    // ASCII-only valid PDF: Postman CLI UTF-8-encodes raw string bodies and corrupts PNG bytes.\n    const fileContent =\n        \"%PDF-1.4\\n\" +\n        \"1 0 obj\\n<< /Type /Catalog /Pages 2 0 R >>\\nendobj\\n\" +\n        \"2 0 obj\\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\\nendobj\\n\" +\n        \"3 0 obj\\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 144] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>\\nendobj\\n\" +\n        \"4 0 obj\\n<< /Length 44 >>\\nstream\\nBT /F1 24 Tf 100 100 Td (Hi) Tj ET\\nendstream\\nendobj\\n\" +\n        \"5 0 obj\\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\\nendobj\\n\" +\n        \"xref\\n0 6\\n0000000000 65535 f \\n0000000009 00000 n \\n0000000058 00000 n \\n0000000115 00000 n \\n0000000266 00000 n \\n0000000361 00000 n \\n\" +\n        \"trailer\\n<< /Size 6 /Root 1 0 R >>\\nstartxref\\n440\\n%%EOF\\n\";\n    return (\n        \"--\" + boundary + \"\\r\\n\" +\n        'Content-Disposition: form-data; name=\"Files\"; filename=\"' + filename + '\"\\r\\n' +\n        \"Content-Type: application/pdf\\r\\n\\r\\n\" +\n        fileContent +\n        \"\\r\\n--\" + boundary + \"--\\r\\n\"\n    );\n}\n\nasync function getAgentChat(chatId) {\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/get?page=1&size=50\",\n        method: \"GET\",\n        header: agentHeaders()\n    });\n}\n\nasync function waitForTurnStopped(chatId) {\n    // Cancel is asynchronous and delete answers 409 while the turn still runs.\n    for (let attempt = 1; attempt <= 8; attempt++) {\n        await new Promise(function (r) { setTimeout(r, 1000 * attempt); });\n        const stateRes = await getAgentChat(chatId);\n        if (stateRes && stateRes.code === 200 && stateRes.json().isTurnRunning === false) {\n            return;\n        }\n    }\n}\n\nasync function uploadTinyPdf(chatId) {\n    const maxAttempts = 3;\n    let lastRes = null;\n    for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n        const boundary = \"----AgentUpload\" + Date.now() + \"-\" + attempt;\n        lastRes = await send({\n            url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/files/upload\",\n            method: \"POST\",\n            header: agentHeaders({\n                \"Content-Type\": \"multipart/form-data; boundary=\" + boundary\n            }),\n            body: { mode: \"raw\", raw: buildFilesMultipart(boundary, \"tiny.pdf\") }\n        });\n        if (lastRes && lastRes.code === 200) {\n            return lastRes.json();\n        }\n        const retryable = lastRes && lastRes.code >= 500;\n        if (!retryable || attempt === maxAttempts) {\n            break;\n        }\n        console.log(\"uploadTinyPdf status=\" + lastRes.code + \" retry \" + attempt + \"/\" + maxAttempts);\n        await new Promise(function (r) { setTimeout(r, 1000 * attempt); });\n    }\n    throw new Error(\"Upload failed: \" + (lastRes && lastRes.code) + \" \" + (lastRes && lastRes.text()));\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nconst created = await createAgentChat(\"Postman List Files\");\nconst chatId = created.chatId;\npm.environment.set(\"agentApiChatId\", String(chatId));\nconst uploaded = await uploadTinyPdf(chatId);\nconst uploadId = uploaded.files[0].uploadId;\n// Pending uploads are not listed until attached via prompt UploadIds.\nconst boundary = \"----AgentListFilesPrompt\" + Date.now();\nconst prompt = pm.environment.get(\"agentApiPrompt\") || \"Reply with ok\";\nconst promptBody =\n    \"--\" + boundary + \"\\r\\n\" +\n    'Content-Disposition: form-data; name=\"Prompt\"\\r\\n\\r\\n' +\n    prompt + \"\\r\\n\" +\n    \"--\" + boundary + \"\\r\\n\" +\n    'Content-Disposition: form-data; name=\"UploadIds\"\\r\\n\\r\\n' +\n    uploadId + \"\\r\\n\" +\n    \"--\" + boundary + \"--\\r\\n\";\nconst promptRes = await send({\n    url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/prompt\",\n    method: \"POST\",\n    header: agentHeaders({\n        \"Content-Type\": \"multipart/form-data; boundary=\" + boundary\n    }),\n    body: { mode: \"raw\", raw: promptBody }\n});\nif (!promptRes || promptRes.code !== 200) {\n    throw new Error(\"Seed prompt with upload failed: \" + (promptRes && promptRes.code) + \" \" + (promptRes && promptRes.text()));\n}\nconst turnId = promptRes.json().turnId;\nawait send({\n    url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/cancel\",\n    method: \"POST\",\n    header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n    body: { mode: \"raw\", raw: JSON.stringify({ turnId: turnId }) }\n});\nawait waitForTurnStopped(chatId);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function deleteAgentChat(chatId) {\n    if (!chatId) return { code: 204 };\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/delete\",\n        method: \"DELETE\",\n        header: agentHeaders()\n    });\n}\n\nasync function cleanupAgentChat(chatId) {\n    let res = await deleteAgentChat(chatId);\n    if (res && res.code === 409) {\n        await new Promise(function (r) { setTimeout(r, 2000); });\n        res = await deleteAgentChat(chatId);\n    }\n    return res;\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"ListChatFilesResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json.files, \"files\").to.be.an(\"array\").and.have.lengthOf.at.least(1);\n    const file = json.files[0];\n    [\"artifactId\", \"originalFileName\"].forEach(function (key) {\n        pm.expect(file, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(file.artifactId, \"artifactId\").to.be.a(\"number\");\n    pm.expect(file.originalFileName, \"originalFileName\").to.be.a(\"string\").and.not.empty;\n});\n\npm.test(\"Check: seeded tiny.pdf is listed\", function () {\n    const files = pm.response.json().files;\n    const seeded = files.find(function (f) {\n        return f && f.originalFileName === \"tiny.pdf\";\n    });\n    pm.expect(seeded, \"tiny.pdf in files\").to.be.an(\"object\");\n    pm.expect(seeded.artifactId, \"tiny.pdf artifactId\").to.be.a(\"number\").and.above(0);\n});\n\nconst cleanupRes = await cleanupAgentChat(pm.environment.get(\"agentApiChatId\"));\npm.test(\"Cleanup deletes the seeded chat\", function () {\n    pm.expect([200, 204]).to.include(cleanupRes.code);\n});\npm.environment.unset(\"agentApiChatId\");"]}}],"id":"ec995f47-dfc9-4101-a403-2ae543ee1e7c","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/files/list","urlObject":{"path":["api","agent","chats",":chatId","files","list"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[{"type":"any","value":"{{agentApiChatId}}","key":"chatId"}]}},"response":[],"_postman_id":"ec995f47-dfc9-4101-a403-2ae543ee1e7c"}],"id":"bfeee03b-431a-48b9-a669-4bb78783ce00","_postman_id":"bfeee03b-431a-48b9-a669-4bb78783ce00","description":""},{"name":"upload","item":[{"name":"Agent Upload Chat Files","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function createAgentChat(title) {\n    const res = await send({\n        url: agentBaseUrl() + \"/api/agent/chats/create\",\n        method: \"POST\",\n        header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({ title: title || (\"Postman \" + Date.now()) })\n        }\n    });\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error(\"Create chat failed: \" + (res && res.code) + \" \" + (res && res.text()));\n    }\n    return res.json();\n}\n\nfunction buildFilesMultipart(boundary, filename) {\n    // ASCII-only valid PDF: Postman CLI UTF-8-encodes raw string bodies and corrupts PNG bytes.\n    const fileContent =\n        \"%PDF-1.4\\n\" +\n        \"1 0 obj\\n<< /Type /Catalog /Pages 2 0 R >>\\nendobj\\n\" +\n        \"2 0 obj\\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\\nendobj\\n\" +\n        \"3 0 obj\\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 144] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>\\nendobj\\n\" +\n        \"4 0 obj\\n<< /Length 44 >>\\nstream\\nBT /F1 24 Tf 100 100 Td (Hi) Tj ET\\nendstream\\nendobj\\n\" +\n        \"5 0 obj\\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\\nendobj\\n\" +\n        \"xref\\n0 6\\n0000000000 65535 f \\n0000000009 00000 n \\n0000000058 00000 n \\n0000000115 00000 n \\n0000000266 00000 n \\n0000000361 00000 n \\n\" +\n        \"trailer\\n<< /Size 6 /Root 1 0 R >>\\nstartxref\\n440\\n%%EOF\\n\";\n    return (\n        \"--\" + boundary + \"\\r\\n\" +\n        'Content-Disposition: form-data; name=\"Files\"; filename=\"' + filename + '\"\\r\\n' +\n        \"Content-Type: application/pdf\\r\\n\\r\\n\" +\n        fileContent +\n        \"\\r\\n--\" + boundary + \"--\\r\\n\"\n    );\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nconst created = await createAgentChat(\"Postman Upload Files\");\npm.environment.set(\"agentApiChatId\", String(created.chatId));\nconst boundary = \"----AgentUploadMain\" + Date.now();\nconst multipart = buildFilesMultipart(boundary, \"tiny.pdf\");\npm.request.headers.remove(\"Content-Type\");\npm.request.headers.upsert({\n    key: \"Content-Type\",\n    value: \"multipart/form-data; boundary=\" + boundary\n});\npm.request.body.update(multipart);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function deleteAgentChat(chatId) {\n    if (!chatId) return { code: 204 };\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/delete\",\n        method: \"DELETE\",\n        header: agentHeaders()\n    });\n}\n\nasync function cleanupAgentChat(chatId) {\n    let res = await deleteAgentChat(chatId);\n    if (res && res.code === 409) {\n        await new Promise(function (r) { setTimeout(r, 2000); });\n        res = await deleteAgentChat(chatId);\n    }\n    return res;\n}\n\n// Collection afterResponse runs first; skip asserts when a retry was queued.\nconst retryCounter = parseInt(pm.environment.get(\"retryCounter\"), 10);\nconst isRetryPending =\n    (pm.response.code < 200 || pm.response.code >= 300) &&\n    retryCounter === 2;\n\nif (isRetryPending) {\n    console.log(\n        \"Agent Upload Chat Files skipping asserts on retryable status=\" +\n        pm.response.code\n    );\n    const seededChatId = pm.environment.get(\"agentApiChatId\");\n    await cleanupAgentChat(seededChatId);\n    pm.environment.unset(\"agentApiChatId\");\n    pm.environment.unset(\"agentApiUploadId\");\n    return;\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"UploadChatFilesResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json.files, \"files\").to.be.an(\"array\").and.have.lengthOf.at.least(1);\n    const file = json.files[0];\n    pm.expect(file.uploadId, \"uploadId\").to.be.a(\"string\").and.not.empty;\n    pm.expect(file.fileSize, \"fileSize\").to.be.a(\"number\").and.above(0);\n    pm.expect(file.fileType, \"fileType\").to.be.a(\"string\");\n    pm.expect(file.uploadedAt, \"uploadedAt\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(file.uploadedAt)), \"uploadedAt parseable\").to.eql(false);\n    pm.environment.set(\"agentApiUploadId\", file.uploadId);\n});\n\nconst chatId = pm.environment.get(\"agentApiChatId\");\nconst uploadId = pm.response.json().files[0].uploadId;\nconst deleteUploadRes = await send({\n    url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/files/uploads/\" + encodeURIComponent(uploadId),\n    method: \"DELETE\",\n    header: agentHeaders()\n});\npm.test(\"Check: uploaded file can be deleted\", function () {\n    pm.expect([200, 204]).to.include(deleteUploadRes.code);\n});\n\nconst cleanupRes = await cleanupAgentChat(chatId);\npm.test(\"Cleanup deletes the seeded chat\", function () {\n    pm.expect([200, 204]).to.include(cleanupRes.code);\n});\npm.environment.unset(\"agentApiChatId\");\npm.environment.unset(\"agentApiUploadId\");"]}}],"id":"b8bebc63-1555-45b3-a99b-f9b3b8f70b0e","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Accept","value":"application/json"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{}","options":{"raw":{"language":"json"}}},"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/files/upload","urlObject":{"path":["api","agent","chats",":chatId","files","upload"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[{"type":"any","value":"{{agentApiChatId}}","key":"chatId"}]}},"response":[],"_postman_id":"b8bebc63-1555-45b3-a99b-f9b3b8f70b0e"}],"id":"3d2d690d-2727-440d-9aa2-9f560a14f6fb","_postman_id":"3d2d690d-2727-440d-9aa2-9f560a14f6fb","description":""},{"name":"uploads","item":[{"name":"{uploadId}","item":[{"name":"Agent Delete Chat Upload","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function createAgentChat(title) {\n    const res = await send({\n        url: agentBaseUrl() + \"/api/agent/chats/create\",\n        method: \"POST\",\n        header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({ title: title || (\"Postman \" + Date.now()) })\n        }\n    });\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error(\"Create chat failed: \" + (res && res.code) + \" \" + (res && res.text()));\n    }\n    return res.json();\n}\n\nfunction buildFilesMultipart(boundary, filename) {\n    // ASCII-only valid PDF: Postman CLI UTF-8-encodes raw string bodies and corrupts PNG bytes.\n    const fileContent =\n        \"%PDF-1.4\\n\" +\n        \"1 0 obj\\n<< /Type /Catalog /Pages 2 0 R >>\\nendobj\\n\" +\n        \"2 0 obj\\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\\nendobj\\n\" +\n        \"3 0 obj\\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 144] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>\\nendobj\\n\" +\n        \"4 0 obj\\n<< /Length 44 >>\\nstream\\nBT /F1 24 Tf 100 100 Td (Hi) Tj ET\\nendstream\\nendobj\\n\" +\n        \"5 0 obj\\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\\nendobj\\n\" +\n        \"xref\\n0 6\\n0000000000 65535 f \\n0000000009 00000 n \\n0000000058 00000 n \\n0000000115 00000 n \\n0000000266 00000 n \\n0000000361 00000 n \\n\" +\n        \"trailer\\n<< /Size 6 /Root 1 0 R >>\\nstartxref\\n440\\n%%EOF\\n\";\n    return (\n        \"--\" + boundary + \"\\r\\n\" +\n        'Content-Disposition: form-data; name=\"Files\"; filename=\"' + filename + '\"\\r\\n' +\n        \"Content-Type: application/pdf\\r\\n\\r\\n\" +\n        fileContent +\n        \"\\r\\n--\" + boundary + \"--\\r\\n\"\n    );\n}\n\nasync function uploadTinyPdf(chatId) {\n    const maxAttempts = 3;\n    let lastRes = null;\n    for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n        const boundary = \"----AgentUpload\" + Date.now() + \"-\" + attempt;\n        lastRes = await send({\n            url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/files/upload\",\n            method: \"POST\",\n            header: agentHeaders({\n                \"Content-Type\": \"multipart/form-data; boundary=\" + boundary\n            }),\n            body: { mode: \"raw\", raw: buildFilesMultipart(boundary, \"tiny.pdf\") }\n        });\n        if (lastRes && lastRes.code === 200) {\n            return lastRes.json();\n        }\n        const retryable = lastRes && lastRes.code >= 500;\n        if (!retryable || attempt === maxAttempts) {\n            break;\n        }\n        console.log(\"uploadTinyPdf status=\" + lastRes.code + \" retry \" + attempt + \"/\" + maxAttempts);\n        await new Promise(function (r) { setTimeout(r, 1000 * attempt); });\n    }\n    throw new Error(\"Upload failed: \" + (lastRes && lastRes.code) + \" \" + (lastRes && lastRes.text()));\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nconst created = await createAgentChat(\"Postman Delete Upload\");\nconst chatId = created.chatId;\npm.environment.set(\"agentApiChatId\", String(chatId));\nconst uploaded = await uploadTinyPdf(chatId);\nconst uploadId = uploaded.files[0].uploadId;\npm.environment.set(\"agentApiUploadIdToDelete\", uploadId);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function deleteAgentChat(chatId) {\n    if (!chatId) return { code: 204 };\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/delete\",\n        method: \"DELETE\",\n        header: agentHeaders()\n    });\n}\n\nasync function cleanupAgentChat(chatId) {\n    let res = await deleteAgentChat(chatId);\n    if (res && res.code === 409) {\n        await new Promise(function (r) { setTimeout(r, 2000); });\n        res = await deleteAgentChat(chatId);\n    }\n    return res;\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is empty\", function () {\n    pm.expect(pm.response.text().trim().length, \"empty body\").to.eql(0);\n});\n\nconst chatId = pm.environment.get(\"agentApiChatId\");\nconst uploadId = pm.environment.get(\"agentApiUploadIdToDelete\");\n// Pending uploads do not appear in files/list; prove delete by prompting with the dead id.\nconst promptBoundary = \"----AgentDeletedUploadPrompt\" + Date.now();\nconst promptBody =\n    \"--\" + promptBoundary + \"\\r\\n\" +\n    'Content-Disposition: form-data; name=\"Prompt\"\\r\\n\\r\\n' +\n    \"Reply with the single word ok\\r\\n\" +\n    \"--\" + promptBoundary + \"\\r\\n\" +\n    'Content-Disposition: form-data; name=\"UploadIds\"\\r\\n\\r\\n' +\n    uploadId + \"\\r\\n\" +\n    \"--\" + promptBoundary + \"--\\r\\n\";\nconst promptRes = await send({\n    url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/prompt\",\n    method: \"POST\",\n    header: agentHeaders({\n        \"Content-Type\": \"multipart/form-data; boundary=\" + promptBoundary\n    }),\n    body: { mode: \"raw\", raw: promptBody }\n});\npm.test(\"Check: prompt rejects deleted uploadId\", function () {\n    pm.expect(promptRes.code, \"prompt status\").to.eql(400);\n});\n\nconst cleanupRes = await cleanupAgentChat(chatId);\npm.test(\"Cleanup deletes the seeded chat\", function () {\n    pm.expect([200, 204]).to.include(cleanupRes.code);\n});\npm.environment.unset(\"agentApiChatId\");\npm.environment.unset(\"agentApiUploadIdToDelete\");"]}}],"id":"8f6f9200-ab6a-42be-9b43-db9f2453dede","request":{"auth":{"type":"noauth","isInherited":false},"method":"DELETE","header":[{"key":"Accept","value":"application/json"}],"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/files/uploads/:uploadId","urlObject":{"path":["api","agent","chats",":chatId","files","uploads",":uploadId"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[{"type":"any","value":"{{agentApiChatId}}","key":"chatId"},{"type":"any","value":"{{agentApiUploadIdToDelete}}","key":"uploadId"}]}},"response":[],"_postman_id":"8f6f9200-ab6a-42be-9b43-db9f2453dede"}],"id":"4fc1da6c-e9d3-488d-b4ef-64fdd290fb05","_postman_id":"4fc1da6c-e9d3-488d-b4ef-64fdd290fb05","description":""}],"id":"2e556c77-eb86-4631-ab4c-c463dd4d51d6","_postman_id":"2e556c77-eb86-4631-ab4c-c463dd4d51d6","description":""},{"name":"{artifactId}","item":[{"name":"get","item":[{"name":"Agent Get Chat File","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nconst chatId = pm.environment.get(\"agentApiChatIdForFiles\");\nconst artifactId = pm.environment.get(\"agentApiArtifactId\");\nif (!chatId || !artifactId) {\n    throw new Error(\"Set agentApiChatIdForFiles and agentApiArtifactId to a harvested chat file\");\n}\npm.request.url.variables.upsert({ key: \"chatId\", value: String(chatId) });\npm.request.url.variables.upsert({ key: \"artifactId\", value: String(artifactId) });"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(100);\n});\n\npm.test(\"Content-Type matches harvested file fixture\", function () {\n    const ctype = String(pm.response.headers.get(\"Content-Type\") || \"\");\n    const expectedPrefix =\n        pm.environment.get(\"agentApiFileGetContentTypePrefix\") || \"text/plain\";\n    const escaped = expectedPrefix.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n    pm.expect(ctype, \"Content-Type\").to.match(new RegExp(\"^\" + escaped, \"i\"));\n});\n\npm.test(\"Check: body contains harvested file marker\", function () {\n    const marker =\n        pm.environment.get(\"agentApiFileGetBodyMarker\") || \"Welcome to Our Store\";\n    pm.expect(pm.response.text(), \"body\").to.include(marker);\n});"]}}],"id":"ff630013-decb-4863-8d95-b69dbb3b1bfa","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/files/:artifactId/get","urlObject":{"path":["api","agent","chats",":chatId","files",":artifactId","get"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[{"type":"any","value":"{{agentApiChatIdForFiles}}","key":"chatId"},{"type":"any","value":"{{agentApiArtifactId}}","key":"artifactId"}]}},"response":[],"_postman_id":"ff630013-decb-4863-8d95-b69dbb3b1bfa"}],"id":"2a74ff03-fbdf-49e6-8e28-033ef1942d48","_postman_id":"2a74ff03-fbdf-49e6-8e28-033ef1942d48","description":""}],"id":"82904e93-a6d9-4be5-8238-2b116d80712f","_postman_id":"82904e93-a6d9-4be5-8238-2b116d80712f","description":""}],"id":"e7494896-46cd-4a2c-b219-ae0b634c3f40","_postman_id":"e7494896-46cd-4a2c-b219-ae0b634c3f40","description":""},{"name":"get","item":[{"name":"Agent Get Chat","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function createAgentChat(title) {\n    const res = await send({\n        url: agentBaseUrl() + \"/api/agent/chats/create\",\n        method: \"POST\",\n        header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({ title: title || (\"Postman \" + Date.now()) })\n        }\n    });\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error(\"Create chat failed: \" + (res && res.code) + \" \" + (res && res.text()));\n    }\n    return res.json();\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nconst created = await createAgentChat(\"Postman Get Chat\");\npm.environment.set(\"agentApiChatId\", String(created.chatId));\npm.environment.set(\"agentApiChatTitle\", created.title || \"Postman Get Chat\");"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function deleteAgentChat(chatId) {\n    if (!chatId) return { code: 204 };\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/delete\",\n        method: \"DELETE\",\n        header: agentHeaders()\n    });\n}\n\nasync function cleanupAgentChat(chatId) {\n    let res = await deleteAgentChat(chatId);\n    if (res && res.code === 409) {\n        await new Promise(function (r) { setTimeout(r, 2000); });\n        res = await deleteAgentChat(chatId);\n    }\n    return res;\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"GetChatResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    [\"chatId\", \"siteId\", \"isPinned\", \"createdAt\", \"isTurnRunning\", \"status\", \"history\", \"hasMore\"].forEach(function (key) {\n        pm.expect(json, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(json.chatId, \"chatId\").to.be.a(\"number\").and.eql(Number(pm.environment.get(\"agentApiChatId\")));\n    pm.expect(json.siteId, \"siteId\").to.be.a(\"number\").and.above(0);\n    pm.expect(json.isPinned, \"isPinned\").to.be.a(\"boolean\");\n    pm.expect(json.createdAt, \"createdAt\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(json.createdAt)), \"createdAt parseable\").to.eql(false);\n    pm.expect(json.isTurnRunning, \"isTurnRunning\").to.be.a(\"boolean\");\n    pm.expect(json.status, \"status\").to.be.a(\"string\");\n    pm.expect(json.history, \"history\").to.be.an(\"array\");\n    pm.expect(json.hasMore, \"hasMore\").to.be.a(\"boolean\");\n});\n\npm.test(\"Check: GET echoes created chat\", function () {\n    const json = pm.response.json();\n    pm.expect(json.chatId, \"chatId\").to.eql(Number(pm.environment.get(\"agentApiChatId\")));\n    pm.expect(json.title, \"title\").to.eql(pm.environment.get(\"agentApiChatTitle\"));\n});\n\npm.test(\"Check: fresh chat is idle with no pending interaction\", function () {\n    const json = pm.response.json();\n    pm.expect(json.isTurnRunning, \"isTurnRunning\").to.eql(false);\n    pm.expect(json.status, \"status\").to.eql(\"idle\");\n    pm.expect(json.pendingInteraction, \"pendingInteraction\").to.eql(null);\n    pm.expect(json.runningTurnId, \"runningTurnId\").to.eql(null);\n});\n\nconst cleanupRes = await cleanupAgentChat(pm.environment.get(\"agentApiChatId\"));\npm.test(\"Cleanup deletes the seeded chat\", function () {\n    pm.expect([200, 204]).to.include(cleanupRes.code);\n});\npm.environment.unset(\"agentApiChatId\");\npm.environment.unset(\"agentApiChatTitle\");"]}}],"id":"5d80c5cf-71d0-447d-b16d-77fc42033f58","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/get?page={{agentApiPage}}&size={{agentApiSize}}","urlObject":{"path":["api","agent","chats",":chatId","get"],"host":["{{agentApiBaseUrl}}"],"query":[{"key":"page","value":"{{agentApiPage}}"},{"key":"size","value":"{{agentApiSize}}"}],"variable":[{"type":"any","value":"{{agentApiChatId}}","key":"chatId"}]}},"response":[],"_postman_id":"5d80c5cf-71d0-447d-b16d-77fc42033f58"}],"id":"5c09b6cd-fb83-4b34-9a28-b8e0c4387bde","_postman_id":"5c09b6cd-fb83-4b34-9a28-b8e0c4387bde","description":""},{"name":"prompt","item":[{"name":"Agent Prompt","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function createAgentChat(title) {\n    const res = await send({\n        url: agentBaseUrl() + \"/api/agent/chats/create\",\n        method: \"POST\",\n        header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({ title: title || (\"Postman \" + Date.now()) })\n        }\n    });\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error(\"Create chat failed: \" + (res && res.code) + \" \" + (res && res.text()));\n    }\n    return res.json();\n}\n\nfunction buildFilesMultipart(boundary, filename) {\n    // ASCII-only valid PDF: Postman CLI UTF-8-encodes raw string bodies and corrupts PNG bytes.\n    const fileContent =\n        \"%PDF-1.4\\n\" +\n        \"1 0 obj\\n<< /Type /Catalog /Pages 2 0 R >>\\nendobj\\n\" +\n        \"2 0 obj\\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\\nendobj\\n\" +\n        \"3 0 obj\\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 144] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>\\nendobj\\n\" +\n        \"4 0 obj\\n<< /Length 44 >>\\nstream\\nBT /F1 24 Tf 100 100 Td (Hi) Tj ET\\nendstream\\nendobj\\n\" +\n        \"5 0 obj\\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\\nendobj\\n\" +\n        \"xref\\n0 6\\n0000000000 65535 f \\n0000000009 00000 n \\n0000000058 00000 n \\n0000000115 00000 n \\n0000000266 00000 n \\n0000000361 00000 n \\n\" +\n        \"trailer\\n<< /Size 6 /Root 1 0 R >>\\nstartxref\\n440\\n%%EOF\\n\";\n    return (\n        \"--\" + boundary + \"\\r\\n\" +\n        'Content-Disposition: form-data; name=\"Files\"; filename=\"' + filename + '\"\\r\\n' +\n        \"Content-Type: application/pdf\\r\\n\\r\\n\" +\n        fileContent +\n        \"\\r\\n--\" + boundary + \"--\\r\\n\"\n    );\n}\n\nasync function uploadTinyPdf(chatId) {\n    const maxAttempts = 3;\n    let lastRes = null;\n    for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n        const boundary = \"----AgentUpload\" + Date.now() + \"-\" + attempt;\n        lastRes = await send({\n            url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/files/upload\",\n            method: \"POST\",\n            header: agentHeaders({\n                \"Content-Type\": \"multipart/form-data; boundary=\" + boundary\n            }),\n            body: { mode: \"raw\", raw: buildFilesMultipart(boundary, \"tiny.pdf\") }\n        });\n        if (lastRes && lastRes.code === 200) {\n            return lastRes.json();\n        }\n        const retryable = lastRes && lastRes.code >= 500;\n        if (!retryable || attempt === maxAttempts) {\n            break;\n        }\n        console.log(\"uploadTinyPdf status=\" + lastRes.code + \" retry \" + attempt + \"/\" + maxAttempts);\n        await new Promise(function (r) { setTimeout(r, 1000 * attempt); });\n    }\n    throw new Error(\"Upload failed: \" + (lastRes && lastRes.code) + \" \" + (lastRes && lastRes.text()));\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nconst created = await createAgentChat(\"Postman Prompt With Upload\");\nconst chatId = created.chatId;\npm.environment.set(\"agentApiChatId\", String(chatId));\n\nconst uploaded = await uploadTinyPdf(chatId);\nconst uploadId = uploaded.files[0].uploadId;\npm.environment.set(\"agentApiUploadId\", uploadId);\n\nconst prompt = pm.environment.get(\"agentApiPrompt\") || \"Reply with the single word ok\";\nconst boundary = \"----AgentPromptUpload\" + Date.now();\nconst promptBody =\n    \"--\" + boundary + \"\\r\\n\" +\n    'Content-Disposition: form-data; name=\"Prompt\"\\r\\n\\r\\n' +\n    prompt + \"\\r\\n\" +\n    \"--\" + boundary + \"\\r\\n\" +\n    'Content-Disposition: form-data; name=\"UploadIds\"\\r\\n\\r\\n' +\n    uploadId + \"\\r\\n\" +\n    \"--\" + boundary + \"--\\r\\n\";\npm.request.headers.remove(\"Content-Type\");\npm.request.headers.upsert({\n    key: \"Content-Type\",\n    value: \"multipart/form-data; boundary=\" + boundary\n});\npm.request.body.update(promptBody);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function getAgentChat(chatId) {\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/get?page=1&size=50\",\n        method: \"GET\",\n        header: agentHeaders()\n    });\n}\n\nasync function deleteAgentChat(chatId) {\n    if (!chatId) return { code: 204 };\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/delete\",\n        method: \"DELETE\",\n        header: agentHeaders()\n    });\n}\n\nasync function cleanupAgentChat(chatId) {\n    let res = await deleteAgentChat(chatId);\n    if (res && res.code === 409) {\n        await new Promise(function (r) { setTimeout(r, 2000); });\n        res = await deleteAgentChat(chatId);\n    }\n    return res;\n}\n\n// Collection afterResponse runs first. On a retryable non-2xx it bumps\n// retryCounter to 2 and requeues this request — skip asserts on that attempt.\nconst retryCounter = parseInt(pm.environment.get(\"retryCounter\"), 10);\nconst isRetryPending =\n    (pm.response.code < 200 || pm.response.code >= 300) &&\n    retryCounter === 2;\n\nif (isRetryPending) {\n    console.log(\n        \"Agent Prompt skipping asserts on retryable status=\" +\n        pm.response.code +\n        \" retryCounter=\" +\n        retryCounter\n    );\n    const seededChatId = pm.environment.get(\"agentApiChatId\");\n    await cleanupAgentChat(seededChatId);\n    pm.environment.unset(\"agentApiChatId\");\n    pm.environment.unset(\"agentApiTurnId\");\n    pm.environment.unset(\"agentApiUploadId\");\n    return;\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"PromptAck shape with attached UploadIds\", function () {\n    const json = pm.response.json();\n    [\"chatId\", \"turnId\", \"userMessageId\", \"files\"].forEach(function (key) {\n        pm.expect(json, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(json.chatId, \"chatId\").to.be.a(\"number\").and.eql(Number(pm.environment.get(\"agentApiChatId\")));\n    pm.expect(json.turnId, \"turnId\").to.be.a(\"string\").and.not.empty;\n    pm.expect(json.userMessageId, \"userMessageId\").to.be.a(\"string\").and.not.empty;\n    pm.expect(json.files, \"files\").to.be.an(\"array\").and.have.lengthOf.at.least(1);\n    const file = json.files[0];\n    pm.expect(file.artifactId, \"artifactId\").to.be.a(\"number\");\n    pm.expect(file.originalFileName, \"originalFileName\").to.eql(\"tiny.pdf\");\n    pm.environment.set(\"agentApiTurnId\", json.turnId);\n    // Do not overwrite harvested agentApiArtifactId used by Get Chat File.\n});\n\nconst chatId = pm.environment.get(\"agentApiChatId\");\nconst ack = pm.response.json();\nconst turnId = ack.turnId;\nconst userMessageId = ack.userMessageId;\nconst expectedPrompt = pm.environment.get(\"agentApiPrompt\") || \"Reply with the single word ok\";\n\nconst getRes = await getAgentChat(chatId);\npm.test(\"Check: GET history contains prompted user message\", function () {\n    pm.expect(getRes.code).to.eql(200);\n    const json = getRes.json();\n    pm.expect(json.chatId, \"chatId\").to.eql(Number(chatId));\n    pm.expect(json.runningTurnId, \"runningTurnId\").to.eql(turnId);\n    const history = json.history || [];\n    const userMsg = history.find(function (m) {\n        return m && m.messageId === userMessageId;\n    });\n    pm.expect(userMsg, \"user message in history\").to.be.an(\"object\");\n    pm.expect(userMsg.role, \"role\").to.eql(\"user\");\n    pm.expect(userMsg.content, \"content\").to.eql(expectedPrompt);\n});\n\nawait send({\n    url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/cancel\",\n    method: \"POST\",\n    header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n    body: { mode: \"raw\", raw: JSON.stringify({ turnId: turnId }) }\n});\n// Cancel is asynchronous and delete answers 409 while the turn still runs, so wait for it to stop first.\nfor (let attempt = 1; attempt <= 8; attempt++) {\n    await new Promise(function (r) { setTimeout(r, 1000 * attempt); });\n    const stateRes = await getAgentChat(chatId);\n    if (stateRes && stateRes.code === 200 && stateRes.json().isTurnRunning === false) {\n        break;\n    }\n}\n\nconst cleanupRes = await cleanupAgentChat(chatId);\npm.test(\"Cleanup deletes the seeded chat\", function () {\n    pm.expect([200, 204]).to.include(cleanupRes.code);\n});\npm.environment.unset(\"agentApiChatId\");\npm.environment.unset(\"agentApiTurnId\");\npm.environment.unset(\"agentApiUploadId\");"]}}],"id":"435e0d13-492c-4a14-933a-ff9b51c26316","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Accept","value":"application/json"}],"body":{"mode":"formdata","formdata":[{"type":"text","key":"Prompt","value":"{{agentApiPrompt}}"}]},"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/prompt","urlObject":{"path":["api","agent","chats",":chatId","prompt"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[{"type":"any","value":"{{agentApiChatId}}","key":"chatId"}]}},"response":[],"_postman_id":"435e0d13-492c-4a14-933a-ff9b51c26316"}],"id":"84fd87e0-d7b3-499e-955a-498521730d8a","_postman_id":"84fd87e0-d7b3-499e-955a-498521730d8a","description":""},{"name":"submitInteraction","item":[{"name":"Agent Submit Interaction","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function createAgentChat(title) {\n    const res = await send({\n        url: agentBaseUrl() + \"/api/agent/chats/create\",\n        method: \"POST\",\n        header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({ title: title || (\"Postman \" + Date.now()) })\n        }\n    });\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error(\"Create chat failed: \" + (res && res.code) + \" \" + (res && res.text()));\n    }\n    return res.json();\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\n// Expected non-2xx: pin retryCounter so the collection afterResponse does not re-run us.\npm.environment.set(\"retryCounter\", 2);\n\n// Shallow coverage: no confirm card. Submit a fake id and expect \"no pending\".\nconst created = await createAgentChat(\"Postman Submit Interaction\");\nconst chatId = created.chatId;\npm.environment.set(\"agentApiChatId\", String(chatId));\npm.request.url.variables.upsert({ key: \"chatId\", value: String(chatId) });\npm.request.body.update(JSON.stringify({\n    interactionId: \"00000000-0000-0000-0000-000000000000\",\n    confirmed: true\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function deleteAgentChat(chatId) {\n    if (!chatId) return { code: 204 };\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/delete\",\n        method: \"DELETE\",\n        header: agentHeaders()\n    });\n}\n\nasync function cleanupAgentChat(chatId) {\n    let res = await deleteAgentChat(chatId);\n    if (res && res.code === 409) {\n        await new Promise(function (r) { setTimeout(r, 2000); });\n        res = await deleteAgentChat(chatId);\n    }\n    return res;\n}\n\nconst chatId = pm.environment.get(\"agentApiChatId\");\ntry {\n    pm.test(\"Status code is 409 when no pending interaction\", function () {\n        pm.response.to.have.status(409);\n    });\n\n    pm.test(\"Response body is not empty\", function () {\n        pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n    });\n\n    pm.test(\"Response is JSON\", function () {\n        pm.response.to.be.json;\n    });\n\n    pm.test(\"Check: message says no pending interaction\", function () {\n        const json = pm.response.json();\n        pm.expect(String(json.message || \"\"), \"message\").to.match(/no pending interaction/i);\n    });\n} finally {\n    const cleanupRes = await cleanupAgentChat(chatId);\n    pm.test(\"Cleanup deletes the seeded chat\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n    pm.environment.unset(\"agentApiChatId\");\n}"]}}],"id":"eb30f7b6-4c92-4aec-acb1-431a479a8794","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"interactionId\": \"00000000-0000-0000-0000-000000000000\",\n  \"confirmed\": true\n}","options":{"raw":{"language":"json"}}},"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/submitInteraction","urlObject":{"path":["api","agent","chats",":chatId","submitInteraction"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[{"type":"any","value":"{{agentApiChatId}}","key":"chatId"}]}},"response":[],"_postman_id":"eb30f7b6-4c92-4aec-acb1-431a479a8794"}],"id":"3b6ccf4f-2180-4d56-ab8d-1f47c5f5a3f8","_postman_id":"3b6ccf4f-2180-4d56-ab8d-1f47c5f5a3f8","description":""},{"name":"update","item":[{"name":"Agent Update Chat","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function createAgentChat(title) {\n    const res = await send({\n        url: agentBaseUrl() + \"/api/agent/chats/create\",\n        method: \"POST\",\n        header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({ title: title || (\"Postman \" + Date.now()) })\n        }\n    });\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error(\"Create chat failed: \" + (res && res.code) + \" \" + (res && res.text()));\n    }\n    return res.json();\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nconst created = await createAgentChat(\"Postman Update Chat\");\npm.environment.set(\"agentApiChatIdToUpdate\", String(created.chatId));\nconst updatedTitle = \"Postman Updated Chat \" + Date.now();\npm.environment.set(\"agentApiChatTitle\", updatedTitle);\npm.request.body.update(JSON.stringify({ title: updatedTitle, isPinned: false }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nasync function getAgentChat(chatId) {\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/get?page=1&size=50\",\n        method: \"GET\",\n        header: agentHeaders()\n    });\n}\n\nasync function deleteAgentChat(chatId) {\n    if (!chatId) return { code: 204 };\n    return send({\n        url: agentBaseUrl() + \"/api/agent/chats/\" + chatId + \"/delete\",\n        method: \"DELETE\",\n        header: agentHeaders()\n    });\n}\n\nasync function cleanupAgentChat(chatId) {\n    let res = await deleteAgentChat(chatId);\n    if (res && res.code === 409) {\n        await new Promise(function (r) { setTimeout(r, 2000); });\n        res = await deleteAgentChat(chatId);\n    }\n    return res;\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"UpdateChatResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    pm.expect(json.chatId, \"chatId\").to.be.a(\"number\").and.eql(Number(pm.environment.get(\"agentApiChatIdToUpdate\")));\n    pm.expect(json.isPinned, \"isPinned\").to.be.a(\"boolean\").and.eql(false);\n    pm.expect(json.title, \"title\").to.be.a(\"string\").and.eql(pm.environment.get(\"agentApiChatTitle\"));\n});\n\nconst chatId = pm.environment.get(\"agentApiChatIdToUpdate\");\nconst getRes = await getAgentChat(chatId);\npm.test(\"Check: GET returns updated chat\", function () {\n    pm.expect(getRes.code).to.eql(200);\n    const got = getRes.json();\n    pm.expect(got.chatId, \"chatId\").to.eql(Number(chatId));\n    pm.expect(got.title, \"title\").to.eql(pm.environment.get(\"agentApiChatTitle\"));\n    pm.expect(got.isPinned, \"isPinned\").to.eql(false);\n});\n\nconst cleanupRes = await cleanupAgentChat(chatId);\npm.test(\"Cleanup deletes the seeded chat\", function () {\n    pm.expect([200, 204]).to.include(cleanupRes.code);\n});\npm.environment.unset(\"agentApiChatIdToUpdate\");\npm.environment.unset(\"agentApiChatTitle\");"]}}],"id":"98c7c367-7d63-4cc0-86db-a4e886c92489","request":{"auth":{"type":"noauth","isInherited":false},"method":"PATCH","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"title\": \"Postman Updated Chat\",\n  \"isPinned\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{agentApiBaseUrl}}/api/agent/chats/:chatId/update","urlObject":{"path":["api","agent","chats",":chatId","update"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[{"type":"any","value":"{{agentApiChatIdToUpdate}}","key":"chatId"}]}},"response":[],"_postman_id":"98c7c367-7d63-4cc0-86db-a4e886c92489"}],"id":"89defddc-5687-4201-8810-b855db8e5bf1","_postman_id":"89defddc-5687-4201-8810-b855db8e5bf1","description":""}],"id":"d9778e81-a5bd-4191-8bf4-4dc894acdc3c","_postman_id":"d9778e81-a5bd-4191-8bf4-4dc894acdc3c","description":""}],"id":"996db5f7-7b7e-46d1-a8ac-9538fe9892e0","_postman_id":"996db5f7-7b7e-46d1-a8ac-9538fe9892e0","description":""},{"name":"files","item":[{"name":"validateUploadedFiles","item":[{"name":"Agent Validate Uploaded Files","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});\n\nfunction buildFilesMultipart(boundary, filename) {\n    // ASCII-only valid PDF: Postman CLI UTF-8-encodes raw string bodies and corrupts PNG bytes.\n    const fileContent =\n        \"%PDF-1.4\\n\" +\n        \"1 0 obj\\n<< /Type /Catalog /Pages 2 0 R >>\\nendobj\\n\" +\n        \"2 0 obj\\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\\nendobj\\n\" +\n        \"3 0 obj\\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 300 144] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>\\nendobj\\n\" +\n        \"4 0 obj\\n<< /Length 44 >>\\nstream\\nBT /F1 24 Tf 100 100 Td (Hi) Tj ET\\nendstream\\nendobj\\n\" +\n        \"5 0 obj\\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\\nendobj\\n\" +\n        \"xref\\n0 6\\n0000000000 65535 f \\n0000000009 00000 n \\n0000000058 00000 n \\n0000000115 00000 n \\n0000000266 00000 n \\n0000000361 00000 n \\n\" +\n        \"trailer\\n<< /Size 6 /Root 1 0 R >>\\nstartxref\\n440\\n%%EOF\\n\";\n    return (\n        \"--\" + boundary + \"\\r\\n\" +\n        'Content-Disposition: form-data; name=\"Files\"; filename=\"' + filename + '\"\\r\\n' +\n        \"Content-Type: application/pdf\\r\\n\\r\\n\" +\n        fileContent +\n        \"\\r\\n--\" + boundary + \"--\\r\\n\"\n    );\n}\n\nconst boundary = \"----AgentValidate\" + Date.now();\nconst multipart = buildFilesMultipart(boundary, \"tiny.pdf\");\npm.request.headers.remove(\"Content-Type\");\npm.request.headers.upsert({\n    key: \"Content-Type\",\n    value: \"multipart/form-data; boundary=\" + boundary\n});\npm.request.body.update(multipart);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["// Collection afterResponse runs first; skip asserts when a retry was queued.\nconst retryCounter = parseInt(pm.environment.get(\"retryCounter\"), 10);\nconst isRetryPending =\n    (pm.response.code < 200 || pm.response.code >= 300) &&\n    retryCounter === 2;\n\nif (isRetryPending) {\n    console.log(\n        \"Agent Validate Uploaded Files skipping asserts on retryable status=\" +\n        pm.response.code\n    );\n    return;\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"ValidateUploadedFilesResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json.files, \"files\").to.be.an(\"array\").and.have.lengthOf.at.least(1);\n    const file = json.files[0];\n    pm.expect(file.originalFileName, \"originalFileName\").to.eql(\"tiny.pdf\");\n    pm.expect(file.mimeType, \"mimeType\").to.eql(\"application/pdf\");\n    pm.expect(file.fileSizeBytes, \"fileSizeBytes\").to.be.a(\"number\").and.above(0);\n});"]}}],"id":"c8e0d5c0-e14a-4610-934c-e7d60ff634ba","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Accept","value":"application/json"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{}","options":{"raw":{"language":"json"}}},"url":"{{agentApiBaseUrl}}/api/agent/files/validateUploadedFiles","urlObject":{"path":["api","agent","files","validateUploadedFiles"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c8e0d5c0-e14a-4610-934c-e7d60ff634ba"}],"id":"f23a1186-8d5d-48d4-8ccc-3d875c9bad71","_postman_id":"f23a1186-8d5d-48d4-8ccc-3d875c9bad71","description":""}],"id":"be0bcfc5-fc02-48c5-b80e-dbf97706047f","_postman_id":"be0bcfc5-fc02-48c5-b80e-dbf97706047f","description":""},{"name":"memoryBanks","item":[{"name":"content","item":[{"name":"Agent Get Memory Bank Content","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.request.addHeader({\n    key: \"Authorization\",\n    value: \"Bearer \" + pm.environment.get(\"agentApiCookie\")\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["// Collection afterResponse runs first; skip asserts when a retry was queued.\nif (\n    (pm.response.code < 200 || pm.response.code >= 300) &&\n    Number(pm.environment.get(\"retryCounter\")) === 2\n) {\n    console.log(\n        \"Agent Get Memory Bank Content skipping asserts on retryable status=\" +\n        pm.response.code +\n        \" retryCounter=2\"\n    );\n    return;\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"MemoryBankContentResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    pm.expect(json, \"missing content\").to.have.property(\"content\");\n    pm.expect(json.content, \"content\").to.be.a(\"string\");\n});"]}}],"id":"cd49ef96-6d90-4d83-b5c8-5fdd0d41934a","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{agentApiBaseUrl}}/api/agent/memoryBanks/content","urlObject":{"path":["api","agent","memoryBanks","content"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"cd49ef96-6d90-4d83-b5c8-5fdd0d41934a"},{"name":"Agent Replace Memory Bank Content","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: agentAuthHeader()\n});\n\n// Snapshot existing content so the test can restore after replace.\nconst before = await send({\n    url: agentBaseUrl() + \"/api/agent/memoryBanks/content\",\n    method: \"GET\",\n    header: agentHeaders()\n});\nif (!before || before.code !== 200) {\n    throw new Error(\n        \"GET memoryBanks/content failed: \" +\n        (before && before.code) +\n        \" \" +\n        (before && before.text())\n    );\n}\nconst beforeJson = before.json() || {};\npm.environment.set(\n    \"agentApiMemoryContentBackup\",\n    typeof beforeJson.content === \"string\" ? beforeJson.content : \"\"\n);\n\nconst seed =\n    (pm.environment.get(\"agentApiMemorySeedContent\") || \"Postman memory bank seed\") +\n    \" \" +\n    Date.now();\npm.environment.set(\"agentApiMemorySeedContentRun\", seed);\npm.request.body.update(JSON.stringify({ content: seed }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\nconst seed = pm.environment.get(\"agentApiMemorySeedContentRun\");\nconst backup = pm.environment.get(\"agentApiMemoryContentBackup\");\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"MemoryBankContentResponse shape after replace\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    pm.expect(json, \"missing content\").to.have.property(\"content\");\n    pm.expect(json.content, \"content\").to.be.a(\"string\").and.eql(seed);\n});\n\nconst getRes = await send({\n    url: agentBaseUrl() + \"/api/agent/memoryBanks/content\",\n    method: \"GET\",\n    header: agentHeaders()\n});\npm.test(\"Check: GET echoes replaced content\", function () {\n    pm.expect(getRes.code, \"GET status\").to.eql(200);\n    const json = getRes.json() || {};\n    pm.expect(json.content, \"GET content\").to.eql(seed);\n});\n\nconst restoreRes = await send({\n    url: agentBaseUrl() + \"/api/agent/memoryBanks/content\",\n    method: \"PUT\",\n    header: agentHeaders({ \"Content-Type\": \"application/json\" }),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({ content: backup == null ? \"\" : backup })\n    }\n});\npm.test(\"Cleanup restores previous memory bank content\", function () {\n    pm.expect(restoreRes.code, \"restore status\").to.eql(200);\n    const json = restoreRes.json() || {};\n    pm.expect(json.content, \"restored content\").to.eql(backup == null ? \"\" : backup);\n});\n\npm.environment.unset(\"agentApiMemorySeedContentRun\");\npm.environment.unset(\"agentApiMemoryContentBackup\");"]}}],"id":"49999953-df45-47d3-aaa1-f8d304ed725a","request":{"auth":{"type":"noauth","isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"content\": \"{{agentApiMemorySeedContent}}\"\n}","options":{"raw":{"language":"json"}}},"url":"{{agentApiBaseUrl}}/api/agent/memoryBanks/content","urlObject":{"path":["api","agent","memoryBanks","content"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"49999953-df45-47d3-aaa1-f8d304ed725a"}],"id":"0ab19b10-5332-4907-90a4-1ba5ba7916ce","_postman_id":"0ab19b10-5332-4907-90a4-1ba5ba7916ce","description":""},{"name":"dream","item":[{"name":"Agent Dream Memories","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\npm.request.addHeader({\n    key: \"Authorization\",\n    value: agentAuthHeader()\n});\n\n// Snapshot stored bank so we can prove dream(content=...) does not mutate it.\nconst before = await send({\n    url: agentBaseUrl() + \"/api/agent/memoryBanks/content\",\n    method: \"GET\",\n    header: agentHeaders()\n});\nif (!before || before.code !== 200) {\n    throw new Error(\n        \"GET memoryBanks/content failed: \" +\n        (before && before.code) +\n        \" \" +\n        (before && before.text())\n    );\n}\nconst beforeJson = before.json() || {};\npm.environment.set(\n    \"agentApiMemoryContentBeforeDream\",\n    typeof beforeJson.content === \"string\" ? beforeJson.content : \"\"\n);\n\nconst marker = \"PostmanDreamMarker=\" + Date.now();\nconst ephemeral =\n    \"Temp memory for Postman dream test only.\\nBrand: Luna candles.\\n\";\nconst prompt =\n    'Add a single line at the end exactly: \"' + marker + '\"';\n\npm.environment.set(\"agentApiMemoryDreamMarker\", marker);\npm.environment.set(\"agentApiMemoryDreamPrompt\", prompt);\npm.environment.set(\"agentApiMemoryDreamContent\", ephemeral);\npm.request.body.update(\n    JSON.stringify({ userPrompt: prompt, content: ephemeral })\n);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction agentAuthHeader() {\n    return \"Bearer \" + pm.environment.get(\"agentApiCookie\");\n}\n\nfunction agentBaseUrl() {\n    return pm.environment.get(\"agentApiBaseUrl\");\n}\n\nfunction agentHeaders(extra) {\n    return Object.assign({\n        Authorization: agentAuthHeader(),\n        Accept: \"application/json\"\n    }, extra || {});\n}\n\n// Collection afterResponse runs first; skip asserts when a retry was queued.\nif (\n    (pm.response.code < 200 || pm.response.code >= 300) &&\n    Number(pm.environment.get(\"retryCounter\")) === 2\n) {\n    console.log(\n        \"Agent Dream Memories skipping asserts on retryable status=\" +\n        pm.response.code +\n        \" retryCounter=2\"\n    );\n    return;\n}\n\nconst marker = pm.environment.get(\"agentApiMemoryDreamMarker\");\nconst beforeContent = pm.environment.get(\"agentApiMemoryContentBeforeDream\");\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is not empty\", function () {\n    pm.expect(pm.response.text().length, \"body length\").to.be.above(0);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"DreamMemoriesResponse shape\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    [\"summary\", \"isChanged\", \"content\"].forEach(function (key) {\n        pm.expect(json, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(json.summary, \"summary\").to.be.a(\"string\").and.not.empty;\n    pm.expect(json.isChanged, \"isChanged\").to.be.a(\"boolean\").and.eql(true);\n    pm.expect(json.content, \"content\").to.be.a(\"string\");\n    pm.expect(json.content.indexOf(marker) >= 0, \"dream content has marker\").to.eql(true);\n});\n\nconst getRes = await send({\n    url: agentBaseUrl() + \"/api/agent/memoryBanks/content\",\n    method: \"GET\",\n    header: agentHeaders()\n});\npm.test(\"Check: stored memory bank was not mutated by dream(content)\", function () {\n    pm.expect(getRes.code, \"GET status\").to.eql(200);\n    const json = getRes.json() || {};\n    pm.expect(json.content, \"stored content\").to.eql(beforeContent);\n});\n\npm.environment.unset(\"agentApiMemoryDreamMarker\");\npm.environment.unset(\"agentApiMemoryDreamPrompt\");\npm.environment.unset(\"agentApiMemoryDreamContent\");\npm.environment.unset(\"agentApiMemoryContentBeforeDream\");"]}}],"id":"4cd5c3f5-7f06-43d0-9b76-e7871b05cbff","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"userPrompt\": \"{{agentApiMemoryDreamPrompt}}\",\n  \"content\": \"{{agentApiMemoryDreamContent}}\"\n}","options":{"raw":{"language":"json"}}},"url":"{{agentApiBaseUrl}}/api/agent/memoryBanks/dream","urlObject":{"path":["api","agent","memoryBanks","dream"],"host":["{{agentApiBaseUrl}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"4cd5c3f5-7f06-43d0-9b76-e7871b05cbff"}],"id":"0bcef888-f884-4f29-9eff-fcaa9bd772b8","_postman_id":"0bcef888-f884-4f29-9eff-fcaa9bd772b8","description":""}],"id":"4b49a836-9ac8-4251-b598-f7089b1f4bcf","_postman_id":"4b49a836-9ac8-4251-b598-f7089b1f4bcf","description":""}],"id":"7b7c0033-6521-4c7e-9916-ab91e261611a","_postman_id":"7b7c0033-6521-4c7e-9916-ab91e261611a","description":""},{"name":"Smoove.Api","item":[{"name":"account","item":[{"name":"customFields","item":[{"name":"Account Get Custom Fields","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'customFields length').to.be.at.least(1);\n    json.forEach(function (item, index) {\n        const label = 'item[' + index + ']';\n        pm.expect(item, label).to.be.an('object');\n        pm.expect(item, label + ' missing id').to.have.property('id');\n        pm.expect(item, label + ' missing name').to.have.property('name');\n        pm.expect(item, label + ' missing type').to.have.property('type');\n        pm.expect(item, label + ' missing dataType').to.have.property('dataType');\n        pm.expect(item, label + ' missing groupId').to.have.property('groupId');\n        pm.expect(item, label + ' missing position').to.have.property('position');\n        pm.expect(item, label + ' missing serialNumber').to.have.property('serialNumber');\n        pm.expect(item, label + ' missing mapId').to.have.property('mapId');\n        pm.expect(item.id, label + '.id').to.be.a('number');\n        pm.expect(item.name, label + '.name').to.be.a('string');\n        pm.expect(item.type, label + '.type').to.be.a('string');\n        pm.expect(item.dataType, label + '.dataType').to.be.a('string');\n        pm.expect(item.groupId, label + '.groupId').to.be.a('number');\n        pm.expect(item.position, label + '.position').to.be.a('number');\n        pm.expect(item.serialNumber, label + '.serialNumber').to.be.a('number');\n        pm.expect(item.mapId, label + '.mapId').to.be.a('string');\n        if (item.options !== undefined) {\n            pm.expect(item.options, label + '.options').to.be.an('array');\n            item.options.forEach(function (entry, i) {\n                pm.expect(entry, label + '.options[' + i + ']').to.be.a('string');\n            });\n        }\n        if (item.defaultValue !== undefined) {\n            pm.expect(item.defaultValue, label + '.defaultValue').to.be.a('boolean');\n        }\n    });\n});\n\npm.test('Response has expected values', function () {\n    const json = pm.response.json();\n    const item = json[0];\n    pm.expect(item.id, 'id').to.be.above(0);\n    pm.expect(item.groupId, 'groupId').to.be.above(0);\n    pm.expect(item.position, 'position').to.be.at.least(0);\n    pm.expect(item.serialNumber, 'serialNumber').to.be.at.least(0);\n    pm.expect(item.name, 'name').to.be.a('string').and.not.empty;\n    pm.expect(item.type, 'type').to.be.a('string').and.not.empty;\n    pm.expect(item.dataType, 'dataType').to.be.a('string').and.not.empty;\n    pm.expect(item.mapId, 'mapId').to.be.a('string').and.not.empty;\n});"]}}],"id":"6bb23aeb-3118-4bbb-8eac-8072440cfa1e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/account/customFields","urlObject":{"path":["api","v1","account","customFields"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6bb23aeb-3118-4bbb-8eac-8072440cfa1e"}],"id":"83a4f296-5717-46f3-a824-78aabf8e6ca3","_postman_id":"83a4f296-5717-46f3-a824-78aabf8e6ca3","description":""},{"name":"customField","item":[{"name":"{id}","item":[{"name":"Account Delete Extra Field","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst groupId = Number(pm.environment.get(\"smooveApiCustomFieldGroupId\"));\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/account/customField\",\n    method: \"PUT\",\n    header: {\n        \"Cookie\": `jvlpsi=${cookie};`,\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\"\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            name: \"Postman Delete CF \" + suffix,\n            type: \"contacts\",\n            dataType: \"text\",\n            groupId: groupId,\n            position: 0,\n            serialNumber: 0,\n            mapId: \"pm\" + String(Date.now()).slice(-6)\n        })\n    }\n});\npm.expect(createRes.code, \"create custom field status\").to.eql(200);\nconst fieldId = createRes.json().id;\npm.expect(fieldId, \"created custom field id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiCustomFieldId\", String(fieldId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst deletedId = Number(pm.environment.get(\"smooveApiCustomFieldId\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/account/customFields\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test('Deleted custom field is gone from the list', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    const fields = listRes.json();\n    pm.expect(fields, 'customFields').to.be.an('array');\n    const stillThere = fields.some(function (f) { return Number(f.id) === deletedId; });\n    pm.expect(stillThere, 'field still listed after delete').to.eql(false);\n});\n\npm.environment.unset(\"smooveApiCustomFieldId\");"]}}],"id":"c5a6701c-37e1-48e2-902c-7aa648588dc4","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[],"url":"{{smooveApiBaseURL}}/api/v1/account/customField/{{smooveApiCustomFieldId}}","urlObject":{"path":["api","v1","account","customField","{{smooveApiCustomFieldId}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c5a6701c-37e1-48e2-902c-7aa648588dc4"}],"id":"8a544e64-2534-44e5-ae46-a6dd13bdaf9b","_postman_id":"8a544e64-2534-44e5-ae46-a6dd13bdaf9b","description":""},{"name":"Account Put Extra Field","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst groupId = Number(pm.environment.get(\"smooveApiCustomFieldGroupId\"));\nconst name = \"Postman CF \" + suffix;\npm.environment.set(\"smooveApiCreatedCustomFieldName\", name);\npm.environment.set(\"smooveApiCreatedCustomFieldGroupId\", String(groupId));\npm.request.body.update(JSON.stringify({\n    name: name,\n    type: \"contacts\",\n    dataType: \"text\",\n    groupId: groupId,\n    position: 0,\n    serialNumber: 0,\n    mapId: \"pm\" + String(Date.now()).slice(-6)\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedName = pm.environment.get(\"smooveApiCreatedCustomFieldName\");\nconst expectedGroupId = Number(pm.environment.get(\"smooveApiCreatedCustomFieldGroupId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'name', 'type', 'dataType', 'groupId', 'position', 'serialNumber', 'mapId'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.name, 'name').to.be.a('string');\n    pm.expect(json.type, 'type').to.be.a('string');\n    pm.expect(json.dataType, 'dataType').to.be.a('string');\n    pm.expect(json.groupId, 'groupId').to.be.a('number');\n    pm.expect(json.position, 'position').to.be.a('number');\n    pm.expect(json.serialNumber, 'serialNumber').to.be.a('number');\n    pm.expect(json.mapId, 'mapId').to.be.a('string');\n});\n\npm.test('Created custom field matches request and has assigned ids', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.name, 'name').to.eql(expectedName);\n    pm.expect(json.type, 'type').to.eql('contacts');\n    pm.expect(json.dataType, 'dataType').to.eql('text');\n    pm.expect(json.groupId, 'groupId').to.eql(expectedGroupId);\n    pm.expect(json.mapId, 'mapId').to.not.equal('');\n    pm.expect(json.position, 'position').to.be.at.least(0);\n    pm.expect(json.serialNumber, 'serialNumber').to.be.at.least(0);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const id = pm.response.json() && pm.response.json().id;\n    if (!id) return;\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/account/customField/\" + id,\n        method: \"DELETE\",\n        header: { \"Cookie\": `jvlpsi=${cookie};` }\n    });\n    pm.test(\"Cleanup: custom field deleted\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n}\n\nawait cleanUp();\n\npm.environment.unset(\"smooveApiCreatedCustomFieldName\");\npm.environment.unset(\"smooveApiCreatedCustomFieldGroupId\");"]}}],"id":"496d1e44-b998-41dd-9b32-122fb5119687","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/account/customField","urlObject":{"path":["api","v1","account","customField"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"496d1e44-b998-41dd-9b32-122fb5119687"}],"id":"8164ee99-8627-410f-867c-9f6d62a5d5c8","_postman_id":"8164ee99-8627-410f-867c-9f6d62a5d5c8","description":""},{"name":"test-mail","item":[],"id":"6f6cb196-d20e-48ac-a8a6-548722d428a8","_postman_id":"6f6cb196-d20e-48ac-a8a6-548722d428a8","description":""},{"name":"moveCustomField","item":[{"name":"{groupId}","item":[{"name":"{position}","item":[{"name":"Account Move Custom Field","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst fieldId = Number(pm.environment.get(\"smooveApiCustomFieldIdForMove\"));\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\npm.expect(fieldId, \"smooveApiCustomFieldIdForMove\").to.be.above(0);\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/account/customFields\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` }\n});\npm.expect(listRes.code, \"list custom fields\").to.eql(200);\nconst field = listRes.json().find(function (f) { return Number(f.id) === fieldId; });\npm.expect(field, \"fixture field\").to.be.an(\"object\");\n\nconst fromPosition = Number(field.position) || 0;\nconst toPosition = fromPosition === 1 ? 2 : 1;\nconst groupId = Number(field.groupId);\n\nconst moveRes = await send({\n    url: baseUrl + \"/api/v1/account/moveCustomField/\" + groupId + \"/\" + toPosition,\n    method: \"PUT\",\n    header: {\n        Cookie: `jvlpsi=${cookie};`,\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\"\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            id: fieldId,\n            name: field.name,\n            type: field.type || \"contacts\",\n            dataType: field.dataType || \"text\",\n            groupId: groupId,\n            position: toPosition,\n            serialNumber: field.serialNumber || 0\n        })\n    }\n});\npm.expect(moveRes.code, \"move custom field status\").to.eql(200);\n\npm.environment.set(\"smooveApiMovedCustomFieldToPosition\", String(toPosition));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const fieldId = Number(pm.environment.get(\"smooveApiCustomFieldIdForMove\"));\nconst toPosition = Number(pm.environment.get(\"smooveApiMovedCustomFieldToPosition\"));\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Moved custom field has the target position\", function () {\n    const fields = pm.response.json();\n    pm.expect(fields, \"customFields\").to.be.an(\"array\");\n    const moved = fields.find(function (f) { return Number(f.id) === fieldId; });\n    pm.expect(moved, \"moved field in list\").to.be.an(\"object\");\n    pm.expect(Number(moved.position), \"position after move\").to.eql(toPosition);\n});\n\npm.environment.unset(\"smooveApiMovedCustomFieldToPosition\");"]}}],"id":"e9925006-d7a3-416f-9a31-6ee7181daf85","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{smooveApiBaseURL}}/api/v1/account/customFields","urlObject":{"path":["api","v1","account","customFields"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e9925006-d7a3-416f-9a31-6ee7181daf85"}],"id":"f1655f8b-3460-41fc-9618-28c78d8eb1e5","_postman_id":"f1655f8b-3460-41fc-9618-28c78d8eb1e5","description":""}],"id":"75a790da-3508-45f9-876a-b50616837746","_postman_id":"75a790da-3508-45f9-876a-b50616837746","description":""}],"id":"1f2897ae-c5e1-47f8-a9f7-61e7036e2333","_postman_id":"1f2897ae-c5e1-47f8-a9f7-61e7036e2333","description":""},{"name":"customFieldGroups","item":[{"name":"Account Get Custom Field Groups","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'customFieldGroups length').to.be.at.least(1);\n    json.forEach(function (item, index) {\n        pm.expect(item, 'item[' + index + ']').to.be.an('object');\n        pm.expect(item, 'item[' + index + '] missing position').to.have.property('position');\n        pm.expect(item, 'item[' + index + '] missing id').to.have.property('id');\n        pm.expect(item, 'item[' + index + '] missing name').to.have.property('name');\n        pm.expect(item.position, 'item[' + index + '].position').to.be.a('number');\n        pm.expect(item.id, 'item[' + index + '].id').to.be.a('number');\n        pm.expect(item.name, 'item[' + index + '].name').to.be.a('string');\n    });\n});\n\npm.test('Response has expected values', function () {\n    const json = pm.response.json();\n    const item = json[0];\n    pm.expect(item.id, 'id').to.be.above(0);\n    pm.expect(item.position, 'position').to.be.at.least(0);\n    pm.expect(item.name, 'name').to.be.a('string').and.not.empty;\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}}],"id":"05d30f79-94cd-473e-a01e-c6d28b983b19","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/account/customFieldGroups","urlObject":{"path":["api","v1","account","customFieldGroups"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"05d30f79-94cd-473e-a01e-c6d28b983b19"}],"id":"7e7851b2-79e8-4627-92a7-de38989b9237","_postman_id":"7e7851b2-79e8-4627-92a7-de38989b9237","description":""},{"name":"customFieldGroup","item":[{"name":"{id}","item":[{"name":"Account Delete Extra Field Group","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction sleep(ms) {\n    return new Promise(function (resolve) {\n        setTimeout(resolve, ms);\n    });\n}\n\nasync function sendWithRetry(opts, attempts) {\n    let lastErr = null;\n    for (let i = 1; i <= attempts; i++) {\n        try {\n            return await send(opts);\n        } catch (err) {\n            lastErr = err;\n            if (i < attempts) await sleep(1000 * i);\n        }\n    }\n    throw lastErr;\n}\n\nconst createRes = await sendWithRetry({\n    url: baseUrl + \"/api/v1/account/customFieldGroup\",\n    method: \"PUT\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({ name: \"Postman Delete Group \" + Date.now() })\n    }\n}, 3);\npm.expect(createRes.code, \"create group status\").to.eql(200);\nconst groupId = createRes.json().id;\npm.expect(groupId, \"created group id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiCreatedGroupId\", String(groupId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction sleep(ms) {\n    return new Promise(function (resolve) {\n        setTimeout(resolve, ms);\n    });\n}\n\nasync function sendWithRetry(opts, attempts) {\n    let lastErr = null;\n    for (let i = 1; i <= attempts; i++) {\n        try {\n            return await send(opts);\n        } catch (err) {\n            lastErr = err;\n            if (i < attempts) await sleep(1000 * i);\n        }\n    }\n    throw lastErr;\n}\n\nconst deletedId = Number(pm.environment.get(\"smooveApiCreatedGroupId\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst listRes = await sendWithRetry({\n    url: baseUrl + \"/api/v1/account/customFieldGroups\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n}, 3);\n\npm.test('Deleted group is gone from the list', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    const groups = listRes.json();\n    pm.expect(groups, 'customFieldGroups').to.be.an('array');\n    const stillThere = groups.some(function (g) { return Number(g.id) === deletedId; });\n    pm.expect(stillThere, 'group still listed after delete').to.eql(false);\n});\n\npm.environment.unset(\"smooveApiCreatedGroupId\");"]}}],"id":"32e18cf1-d484-41d3-8e78-9d4b079fca90","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/account/customFieldGroup/{{smooveApiCreatedGroupId}}?action=Delete","urlObject":{"path":["api","v1","account","customFieldGroup","{{smooveApiCreatedGroupId}}"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"action","value":"Delete"}],"variable":[]}},"response":[],"_postman_id":"32e18cf1-d484-41d3-8e78-9d4b079fca90"}],"id":"ba01dcc4-0f9a-4175-a8bd-5eb7fe66b79d","_postman_id":"ba01dcc4-0f9a-4175-a8bd-5eb7fe66b79d","description":""},{"name":"Account Put Extra Field Group","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\n// New groups ignore body.position and get max(existing.position) + 1\nconst groupsRes = await send({\n    url: baseUrl + \"/api/v1/account/customFieldGroups\",\n    method: \"GET\",\n    header: {\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    }\n});\npm.expect(groupsRes.code, \"GET customFieldGroups status\").to.eql(200);\nconst groups = groupsRes.json();\npm.expect(groups, \"customFieldGroups\").to.be.an(\"array\");\n\nconst maxPosition = groups.reduce(function (max, g) {\n    const pos = Number(g && g.position);\n    return Number.isFinite(pos) && pos > max ? pos : max;\n}, 0);\nconst expectedPosition = maxPosition + 1;\nconst name = \"Postman Group \" + Date.now();\n\npm.environment.set(\"smooveApiExpectedCustomFieldGroupPosition\", String(expectedPosition));\npm.environment.set(\"smooveApiCreatedCustomFieldGroupName\", name);\npm.request.body.update(JSON.stringify({\n    position: expectedPosition,\n    name: name\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedPosition = Number(pm.environment.get(\"smooveApiExpectedCustomFieldGroupPosition\"));\nconst expectedName = pm.environment.get(\"smooveApiCreatedCustomFieldGroupName\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['position', 'id', 'name'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.position, 'position').to.be.a('number');\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.name, 'name').to.be.a('string');\n});\n\npm.test('Created group has expected name, id and position', function () {\n    const json = pm.response.json();\n    pm.expect(json.name, 'name').to.eql(expectedName);\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.position, 'position').to.eql(expectedPosition);\n});\n\nasync function cleanUp() {\n    const json = pm.response.json();\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    if (!json || !json.id) return;\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/account/customFieldGroup/\" + json.id + \"?action=Delete\",\n        method: \"DELETE\",\n        header: {\n            \"Cookie\": `jvlpsi=${cookie};`,\n            \"Accept\": \"application/json\"\n        }\n    });\n    pm.test(\"Cleanup: custom field group deleted successfully\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n}\n\nawait cleanUp();\n\npm.environment.unset(\"smooveApiExpectedCustomFieldGroupPosition\");\npm.environment.unset(\"smooveApiCreatedCustomFieldGroupName\");"]}}],"id":"eaacf162-f2fd-498f-ac0b-4eb5c249c7f7","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/account/customFieldGroup","urlObject":{"path":["api","v1","account","customFieldGroup"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"eaacf162-f2fd-498f-ac0b-4eb5c249c7f7"}],"id":"fa6797d2-483d-4a27-9aa6-69a02a19dabf","_postman_id":"fa6797d2-483d-4a27-9aa6-69a02a19dabf","description":""},{"name":"moveCustomFieldGroup","item":[{"name":"{position}","item":[{"name":"Account Move Custom Field Group","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction sleep(ms) {\n    return new Promise(function (resolve) {\n        setTimeout(resolve, ms);\n    });\n}\n\nasync function sendWithRetry(opts, attempts) {\n    let lastErr = null;\n    for (let i = 1; i <= attempts; i++) {\n        try {\n            return await send(opts);\n        } catch (err) {\n            lastErr = err;\n            if (i < attempts) await sleep(1000 * i);\n        }\n    }\n    throw lastErr;\n}\n\nconst createRes = await sendWithRetry({\n    url: baseUrl + \"/api/v1/account/customFieldGroup\",\n    method: \"PUT\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        Cookie: `jvlpsi=${cookie};`\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({ name: \"Postman Move Group \" + Date.now() })\n    }\n}, 3);\npm.expect(createRes.code, \"create group before move\").to.eql(200);\nconst group = createRes.json();\npm.expect(group.id, \"created group id\").to.be.above(0);\n\nconst groupsRes = await sendWithRetry({\n    url: baseUrl + \"/api/v1/account/customFieldGroups\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` }\n}, 3);\npm.expect(groupsRes.code, \"list groups\").to.eql(200);\nconst groups = groupsRes.json();\nconst maxPosition = groups.reduce(function (max, g) {\n    const pos = Number(g && g.position);\n    return Number.isFinite(pos) && pos > max ? pos : max;\n}, 0);\nconst toPos = Number(group.position) === 1 ? Math.max(maxPosition, 2) : 1;\n\nconst moveRes = await sendWithRetry({\n    url: baseUrl + \"/api/v1/account/moveCustomFieldGroup/\" + toPos,\n    method: \"PUT\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        Cookie: `jvlpsi=${cookie};`\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            position: toPos,\n            id: group.id,\n            name: group.name\n        })\n    }\n}, 4);\npm.expect(moveRes.code, \"move group status\").to.eql(200);\n\npm.environment.set(\"smooveApiMovedCustomFieldGroupId\", String(group.id));\npm.environment.set(\"smooveApiToCustomFieldGroupPosition\", String(toPos));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const groupId = Number(pm.environment.get(\"smooveApiMovedCustomFieldGroupId\"));\nconst toPos = Number(pm.environment.get(\"smooveApiToCustomFieldGroupPosition\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Moved group has the target position\", function () {\n    const groups = pm.response.json();\n    pm.expect(groups, \"customFieldGroups\").to.be.an(\"array\");\n    const moved = groups.find(function (g) { return Number(g.id) === groupId; });\n    pm.expect(moved, \"moved group in list\").to.be.an(\"object\");\n    pm.expect(moved.position, \"position after move\").to.eql(toPos);\n});\n\npm.sendRequest({\n    url: baseUrl + \"/api/v1/account/customFieldGroup/\" + groupId + \"?action=Delete\",\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + cookie + \";\", Accept: \"application/json\" }\n}, function () {});\n\n[\"smooveApiMovedCustomFieldGroupId\", \"smooveApiToCustomFieldGroupPosition\"].forEach(function (k) {\n    pm.environment.unset(k);\n});"]}}],"id":"823d25d1-e163-4073-ad60-9358dc182d6c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{smooveApiBaseURL}}/api/v1/account/customFieldGroups","urlObject":{"path":["api","v1","account","customFieldGroups"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"823d25d1-e163-4073-ad60-9358dc182d6c"}],"id":"6a5409ed-cd36-46aa-9d72-ab2051f80be9","_postman_id":"6a5409ed-cd36-46aa-9d72-ab2051f80be9","description":""}],"id":"7d664e01-528e-4807-bc2e-3f4a78840b85","_postman_id":"7d664e01-528e-4807-bc2e-3f4a78840b85","description":""},{"name":"error","item":[{"name":"Account Error","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 500', function () {\n    pm.response.to.have.status(500);\n});\n\npm.test('Error response is JSON with a message', function () {\n    pm.response.to.be.json;\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing message').to.have.property('message');\n    pm.expect(json.message, 'message').to.be.a('string').and.not.equal('');\n});"]}}],"id":"9ff70202-7e37-420f-b862-63756c02ec8e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/account/error","urlObject":{"path":["api","v1","account","error"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9ff70202-7e37-420f-b862-63756c02ec8e"}],"id":"c9ac7528-75d2-4fa2-8aab-d680381be83c","_postman_id":"c9ac7528-75d2-4fa2-8aab-d680381be83c","description":""},{"name":"preference","item":[{"name":"Account Get Preference","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst area = pm.environment.get(\"smooveApiPreferencesArea\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\n// Seed a known preference so GET is independent of collection order.\nconst preferred = {\n    chosenColumns: [\"id\", \"firstname\", \"lastname\", \"email\"],\n    sortColumn: \"email\",\n    sortDirection: \"desc\"\n};\nconst putRes = await send({\n    url: baseUrl + \"/api/v1/account/preference?area=\" + encodeURIComponent(area),\n    method: \"PUT\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    },\n    body: { mode: \"raw\", raw: JSON.stringify(preferred) }\n});\npm.expect(putRes.code, \"seed preference\").to.eql(200);\npm.environment.set(\"smooveApiExpectedPreferenceSortColumn\", preferred.sortColumn);\npm.environment.set(\"smooveApiExpectedPreferenceSortDirection\", preferred.sortDirection);\npm.environment.set(\"smooveApiExpectedPreferenceColumns\", preferred.chosenColumns.join(\",\"));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedSort = pm.environment.get(\"smooveApiExpectedPreferenceSortColumn\");\nconst expectedDir = pm.environment.get(\"smooveApiExpectedPreferenceSortDirection\");\nconst expectedCols = (pm.environment.get(\"smooveApiExpectedPreferenceColumns\") || \"\").split(\",\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a JSON preference object', function () {\n    const text = pm.response.text();\n    pm.expect(text, 'body').to.be.a('string').and.not.equal('');\n    const json = JSON.parse(text);\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing chosenColumns').to.have.property('chosenColumns');\n    pm.expect(json, 'missing sortColumn').to.have.property('sortColumn');\n    pm.expect(json, 'missing sortDirection').to.have.property('sortDirection');\n    pm.expect(json.chosenColumns, 'chosenColumns').to.be.an('array');\n    pm.expect(json.sortColumn, 'sortColumn').to.be.a('string');\n    pm.expect(json.sortDirection, 'sortDirection').to.be.a('string');\n});\n\npm.test('Preference matches the seeded values', function () {\n    const json = JSON.parse(pm.response.text());\n    pm.expect(json.sortColumn, 'sortColumn').to.eql(expectedSort);\n    pm.expect(json.sortDirection, 'sortDirection').to.eql(expectedDir);\n    pm.expect(json.chosenColumns, 'chosenColumns').to.eql(expectedCols);\n    pm.expect(json.chosenColumns.length, 'chosenColumns length').to.be.at.least(1);\n});\n\n[\"smooveApiExpectedPreferenceSortColumn\", \"smooveApiExpectedPreferenceSortDirection\", \"smooveApiExpectedPreferenceColumns\"].forEach(function (k) {\n    pm.environment.unset(k);\n});"]}}],"id":"d7d6ade9-c885-4811-a613-79850f04d7f2","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/account/preference?area={{smooveApiPreferencesArea}}","urlObject":{"path":["api","v1","account","preference"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"area","value":"{{smooveApiPreferencesArea}}"}],"variable":[]}},"response":[],"_postman_id":"d7d6ade9-c885-4811-a613-79850f04d7f2"},{"name":"Account Set Preference","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\nconst cols = [\"id\", \"firstname\", \"lastname\", \"email\", \"cellPhone\", \"company\", \"addedAt\"];\nlet idx = parseInt(pm.environment.get(\"smooveApiSortColumnIndex\") || \"0\", 10);\nif (Number.isNaN(idx) || idx < 0) idx = 0;\nconst sortColumn = cols[idx % cols.length];\nconst payload = {\n    chosenColumns: cols,\n    sortColumn: sortColumn,\n    sortDirection: \"desc\"\n};\n\npm.environment.set(\"smooveApiSortColumn\", sortColumn);\npm.environment.set(\"smooveApiExpectedSortColumn\", sortColumn);\npm.environment.set(\"smooveApiSortColumnIndex\", String(idx + 1));\npm.environment.set(\"smooveApiExpectedPreferencePayload\", JSON.stringify(payload));\npm.request.body.update(JSON.stringify(payload));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expected = JSON.parse(pm.environment.get(\"smooveApiExpectedPreferencePayload\") || \"{}\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst area = pm.environment.get(\"smooveApiPreferencesArea\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/account/preference?area=\" + encodeURIComponent(area),\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test('Saved preference can be read back', function () {\n    pm.expect(getRes.code, 'get preference status').to.eql(200);\n    let json;\n    try {\n        json = typeof getRes.json === 'function' ? getRes.json() : JSON.parse(getRes.text());\n    } catch (e) {\n        json = JSON.parse(getRes.text());\n    }\n    // Preference endpoints may return a JSON string payload.\n    if (typeof json === 'string') json = JSON.parse(json);\n    pm.expect(json).to.be.an('object');\n    pm.expect(json.sortColumn, 'sortColumn').to.eql(expected.sortColumn);\n    pm.expect(json.sortDirection, 'sortDirection').to.eql(expected.sortDirection);\n    pm.expect(json.chosenColumns, 'chosenColumns').to.be.an('array');\n    expected.chosenColumns.forEach(function (col) {\n        pm.expect(json.chosenColumns, 'chosenColumns includes ' + col).to.include(col);\n    });\n});\n\npm.environment.unset(\"smooveApiExpectedPreferencePayload\");"]}}],"id":"989630a1-9b76-48ec-a287-16698cbbb8f1","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/account/preference?area={{smooveApiPreferencesArea}}","urlObject":{"path":["api","v1","account","preference"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"area","value":"{{smooveApiPreferencesArea}}"}],"variable":[]}},"response":[],"_postman_id":"989630a1-9b76-48ec-a287-16698cbbb8f1"}],"id":"8ea0815b-7fa1-4abe-80b8-f6cac50ef84b","_postman_id":"8ea0815b-7fa1-4abe-80b8-f6cac50ef84b","description":""},{"name":"defaultPreference","item":[{"name":"Account Get Default Preference","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a string body', function () {\n    // Default preference may be empty for this area; body must still be a string.\n    const text = pm.response.text();\n    pm.expect(text == null ? '' : text, 'body').to.be.a('string');\n});\n\npm.test('Non-empty default preference is valid JSON object when present', function () {\n    const text = (pm.response.text() || '').trim();\n    if (!text || text === '\"\"' || text === 'null') return;\n    const json = JSON.parse(text);\n    pm.expect(json).to.be.an('object');\n    if (json.chosenColumns !== undefined) {\n        pm.expect(json.chosenColumns, 'chosenColumns').to.be.an('array');\n    }\n    if (json.sortColumn !== undefined) {\n        pm.expect(json.sortColumn, 'sortColumn').to.be.a('string').and.not.equal('');\n    }\n});"]}}],"id":"23ccf194-20f2-44b1-bb48-0d0fcb4c5700","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/account/defaultPreference?area={{smooveApiPreferencesArea}}","urlObject":{"path":["api","v1","account","defaultPreference"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"area","value":"{{smooveApiPreferencesArea}}"}],"variable":[]}},"response":[],"_postman_id":"23ccf194-20f2-44b1-bb48-0d0fcb4c5700"}],"id":"e5f2d7c7-b3d6-4c2e-95cc-68bb816c4be7","_postman_id":"e5f2d7c7-b3d6-4c2e-95cc-68bb816c4be7","description":""},{"name":"users","item":[{"name":"{administratorId}","item":[{"name":"Account Delete Account User","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseURL = pm.environment.get(\"smooveApiBaseURL\");\nconst siteId = Number(pm.environment.get(\"smooveApiSiteId\"));\nconst suffix = String(Date.now()) + Math.random().toString(36).slice(2, 6);\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst createResponse = await send({\n    url: baseURL + \"/api/v1/account/users?accountSiteId=\" + siteId,\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Cookie\": \"jvlpsi=\" + cookie + \";\"\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            administratorId: 0,\n            nickName: \"TestUser_Delete\",\n            preferredLanguage: \"en\",\n            requireMfa: false,\n            sessionTimeOut: 30,\n            externalProviderSignupOrigin: \"\",\n            cellphone: \"\",\n            isMainAdministrator: false,\n            userName: \"test_user_\" + suffix,\n            email: \"testuser_\" + suffix + \"@mailtest.com\",\n            password: \"Test@1234\",\n            role: \"None\",\n            dataAccountId: siteId,\n            permissions: {}\n        })\n    }\n});\npm.expect(createResponse.code, \"create user before delete\").to.eql(200);\nconst newUser = createResponse.json();\npm.expect(newUser.administratorId, \"administratorId\").to.be.above(0);\npm.environment.set(\"smooveApiAdministratorId\", String(newUser.administratorId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst deletedId = Number(pm.environment.get(\"smooveApiAdministratorId\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst siteId = pm.environment.get(\"smooveApiSiteId\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/account/users/\" + deletedId + \"?accountSiteId=\" + siteId,\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/account/users?accountSiteId=\" + siteId,\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test('Deleted user is removed from the account users list', function () {\n    pm.expect(deletedId, 'deleted id').to.be.above(0);\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    const users = listRes.json();\n    pm.expect(users, 'users').to.be.an('array');\n    const stillListed = users.some(function (u) { return Number(u.administratorId) === deletedId; });\n    pm.expect(stillListed, 'user still in list after delete').to.eql(false);\n});\n\npm.test('Get-by-id after delete marks the account as detached', function () {\n    // API still returns 200 for get-by-id, but dataAccountId becomes 0.\n    pm.expect(getRes.code, 'get-after-delete status').to.eql(200);\n    const json = getRes.json();\n    pm.expect(json.administratorId, 'administratorId').to.eql(deletedId);\n    pm.expect(json.dataAccountId, 'dataAccountId after delete').to.eql(0);\n});\n\npm.environment.unset(\"smooveApiAdministratorId\");"]}}],"id":"2f090319-9bcf-49c9-9992-71b9f3bd802b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[],"url":"{{smooveApiBaseURL}}/api/v1/account/users/{{smooveApiAdministratorId}}?accountSiteId={{smooveApiSiteId}}","urlObject":{"path":["api","v1","account","users","{{smooveApiAdministratorId}}"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"accountSiteId","value":"{{smooveApiSiteId}}"}],"variable":[]}},"response":[],"_postman_id":"2f090319-9bcf-49c9-9992-71b9f3bd802b"},{"name":"Account Get Account User","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst siteId = pm.environment.get(\"smooveApiAccountSiteId\") || pm.environment.get(\"smooveApiSiteId\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/account/users?accountSiteId=\" + encodeURIComponent(siteId),\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.expect(listRes.code, \"list account users\").to.eql(200);\nconst users = listRes.json();\npm.expect(users, \"users\").to.be.an(\"array\").and.not.empty;\nconst userId = Number(users[0].administratorId);\npm.expect(userId, \"administratorId\").to.be.above(0);\npm.environment.set(\"smooveApiAccountUserIdToGet\", String(userId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedId = Number(pm.environment.get(\"smooveApiAccountUserIdToGet\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['administratorId', 'dataAccountId', 'requireMfa', 'sessionTimeOut', 'role', 'nickName', 'userName', 'email', 'preferredLanguage', 'isMainAdministrator', 'permissions'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.administratorId, 'administratorId').to.be.a('number');\n    pm.expect(json.dataAccountId, 'dataAccountId').to.be.a('number');\n    pm.expect(json.requireMfa, 'requireMfa').to.be.a('boolean');\n    pm.expect(json.sessionTimeOut, 'sessionTimeOut').to.be.a('number');\n    pm.expect(json.role, 'role').to.be.a('string');\n    pm.expect(json.nickName, 'nickName').to.be.a('string');\n    pm.expect(json.userName, 'userName').to.be.a('string');\n    pm.expect(json.email, 'email').to.be.a('string');\n    pm.expect(json.preferredLanguage, 'preferredLanguage').to.be.a('string');\n    pm.expect(json.isMainAdministrator, 'isMainAdministrator').to.be.a('boolean');\n    pm.expect(json.permissions, 'permissions').to.be.an('object');\n});\n\npm.test('Returned user matches the requested id', function () {\n    const json = pm.response.json();\n    pm.expect(json.administratorId, 'administratorId').to.eql(expectedId);\n    pm.expect(json.userName, 'userName').to.not.equal('');\n    pm.expect(json.email, 'email').to.include('@');\n    pm.expect(json.role, 'role').to.not.equal('');\n    pm.expect(json.preferredLanguage, 'preferredLanguage').to.not.equal('');\n});\n\npm.environment.unset(\"smooveApiAccountUserIdToGet\");"]}}],"id":"4ba7171e-67de-422c-85e0-d89348710687","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/account/users/:administratorId?accountSiteId={{smooveApiAccountSiteId}}","urlObject":{"path":["api","v1","account","users",":administratorId"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"accountSiteId","value":"{{smooveApiAccountSiteId}}"}],"variable":[{"type":"any","value":"{{smooveApiAccountUserIdToGet}}","key":"administratorId"}]}},"response":[],"_postman_id":"4ba7171e-67de-422c-85e0-d89348710687"}],"id":"7b396190-0c0b-4bc3-bbe2-c4331dc000b8","_postman_id":"7b396190-0c0b-4bc3-bbe2-c4331dc000b8","description":""},{"name":"Account Get Account Users","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'users length').to.be.at.least(1);\n    json.forEach(function (item, index) {\n        const label = 'users[' + index + ']';\n        pm.expect(item, label).to.be.an('object');\n        ['administratorId', 'dataAccountId', 'requireMfa', 'sessionTimeOut', 'role', 'nickName', 'userName', 'email', 'preferredLanguage', 'isMainAdministrator'].forEach(function (key) {\n            pm.expect(item, label + ' missing ' + key).to.have.property(key);\n        });\n        pm.expect(item.administratorId, label + '.administratorId').to.be.a('number');\n        pm.expect(item.dataAccountId, label + '.dataAccountId').to.be.a('number');\n        pm.expect(item.requireMfa, label + '.requireMfa').to.be.a('boolean');\n        pm.expect(item.sessionTimeOut, label + '.sessionTimeOut').to.be.a('number');\n        pm.expect(item.role, label + '.role').to.be.a('string');\n        pm.expect(item.nickName, label + '.nickName').to.be.a('string');\n        pm.expect(item.userName, label + '.userName').to.be.a('string');\n        pm.expect(item.email, label + '.email').to.be.a('string');\n        pm.expect(item.preferredLanguage, label + '.preferredLanguage').to.be.a('string');\n        pm.expect(item.isMainAdministrator, label + '.isMainAdministrator').to.be.a('boolean');\n    });\n});\n\npm.test('Users have real identity values', function () {\n    const json = pm.response.json();\n    const item = json[0];\n    pm.expect(item.administratorId, 'administratorId').to.be.above(0);\n    pm.expect(item.dataAccountId, 'dataAccountId').to.be.above(0);\n    pm.expect(item.userName, 'userName').to.not.equal('');\n    pm.expect(item.email, 'email').to.include('@');\n    pm.expect(item.preferredLanguage, 'preferredLanguage').to.not.equal('');\n    pm.expect(item.role, 'role').to.not.equal('');\n    const ids = json.map(function (u) { return u.administratorId; });\n    pm.expect(new Set(ids).size, 'unique administratorIds').to.eql(ids.length);\n});"]}}],"id":"56faa845-3f53-4a34-b3a5-14fe6e9bb6ba","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/account/users?accountSiteId={{smooveApiSiteId}}","urlObject":{"path":["api","v1","account","users"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"accountSiteId","value":"{{smooveApiSiteId}}"}],"variable":[]}},"response":[],"_postman_id":"56faa845-3f53-4a34-b3a5-14fe6e9bb6ba"},{"name":"Account Add Account User","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst suffix = String(Date.now()) + Math.random().toString(36).slice(2, 6);\nconst siteId = Number(pm.environment.get(\"smooveApiSiteId\"));\nconst payload = {\n    administratorId: 0,\n    nickName: \"TestUser_Postman\",\n    preferredLanguage: \"en\",\n    requireMfa: false,\n    sessionTimeOut: 30,\n    externalProviderSignupOrigin: \"\",\n    cellphone: \"\",\n    isMainAdministrator: false,\n    userName: \"test_user_\" + suffix,\n    email: \"testuser_\" + suffix + \"@mailtest.com\",\n    password: \"Test@1234\",\n    role: \"None\",\n    dataAccountId: siteId,\n    permissions: {}\n};\npm.environment.set(\"smooveApiCreatedUserName\", payload.userName);\npm.environment.set(\"smooveApiCreatedUserEmail\", payload.email);\npm.request.body.update(JSON.stringify(payload));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedUserName = pm.environment.get(\"smooveApiCreatedUserName\");\nconst expectedEmail = pm.environment.get(\"smooveApiCreatedUserEmail\");\nconst expectedSiteId = Number(pm.environment.get(\"smooveApiSiteId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['administratorId', 'dataAccountId', 'requireMfa', 'sessionTimeOut', 'role', 'nickName', 'userName', 'email', 'preferredLanguage', 'externalProviderSignupOrigin', 'cellphone', 'isMainAdministrator', 'permissions'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.administratorId, 'administratorId').to.be.a('number');\n    pm.expect(json.dataAccountId, 'dataAccountId').to.be.a('number');\n    pm.expect(json.requireMfa, 'requireMfa').to.be.a('boolean');\n    pm.expect(json.sessionTimeOut, 'sessionTimeOut').to.be.a('number');\n    pm.expect(json.role, 'role').to.be.a('string');\n    pm.expect(json.nickName, 'nickName').to.be.a('string');\n    pm.expect(json.userName, 'userName').to.be.a('string');\n    pm.expect(json.email, 'email').to.be.a('string');\n    pm.expect(json.preferredLanguage, 'preferredLanguage').to.be.a('string');\n    pm.expect(json.externalProviderSignupOrigin, 'externalProviderSignupOrigin').to.be.a('string');\n    pm.expect(json.cellphone, 'cellphone').to.be.a('string');\n    pm.expect(json.isMainAdministrator, 'isMainAdministrator').to.be.a('boolean');\n    pm.expect(json.permissions, 'permissions').to.be.an('object');\n});\n\npm.test('Created user echoes the request identity', function () {\n    const json = pm.response.json();\n    pm.expect(json.administratorId, 'administratorId').to.be.above(0);\n    pm.expect(json.userName, 'userName').to.eql(expectedUserName);\n    pm.expect(json.email, 'email').to.eql(expectedEmail);\n    pm.expect(json.nickName, 'nickName').to.eql('TestUser_Postman');\n    pm.expect(json.requireMfa, 'requireMfa').to.eql(false);\n    pm.expect(json.sessionTimeOut, 'sessionTimeOut').to.eql(30);\n    pm.expect(json.role, 'role').to.eql('None');\n    pm.expect(json.isMainAdministrator, 'isMainAdministrator').to.eql(false);\n    pm.expect(json.dataAccountId, 'dataAccountId').to.eql(expectedSiteId);\n    pm.expect(json.preferredLanguage, 'preferredLanguage').to.not.equal('');\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const siteId = pm.environment.get(\"smooveApiSiteId\");\n    const adminId = pm.response.json() && pm.response.json().administratorId;\n    if (!adminId) {\n        pm.test(\"Cleanup skipped: could not resolve administrator id\", function () {\n            pm.expect.fail(\"Missing administratorId for cleanup\");\n        });\n        return;\n    }\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/account/users/\" + adminId + \"?accountSiteId=\" + siteId,\n        method: \"DELETE\",\n        header: {\n            \"Cookie\": `jvlpsi=${cookie};`,\n            \"Accept\": \"application/json\"\n        }\n    });\n    pm.test(\"Cleanup: account user deleted successfully\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n}\n\nawait cleanUp();\n\npm.environment.unset(\"smooveApiCreatedUserName\");\npm.environment.unset(\"smooveApiCreatedUserEmail\");"]}}],"id":"e8c38bfe-566c-4cb8-b6be-5a7049bf35ef","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"administratorId\": 0,\n  \"nickName\": \"TestUser_1\",\n  \"preferredLanguage\": \"en\",\n  \"requireMfa\": false,\n  \"sessionTimeOut\": 30,\n  \"externalProviderSignupOrigin\": \"\",\n  \"cellphone\": \"\",\n  \"isMainAdministrator\": false,\n  \"userName\": \"test_user_placeholder\",\n  \"email\": \"testuser_placeholder@mailtest.com\",\n  \"password\": \"Test@1234\",\n  \"role\": \"None\",\n  \"dataAccountId\": 0,\n  \"permissions\": {}\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/account/users?accountSiteId={{smooveApiSiteId}}","urlObject":{"path":["api","v1","account","users"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"accountSiteId","value":"{{smooveApiSiteId}}"}],"variable":[]}},"response":[],"_postman_id":"e8c38bfe-566c-4cb8-b6be-5a7049bf35ef"},{"name":"Account Update Account User","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseURL = pm.environment.get(\"smooveApiBaseURL\");\nconst siteId = Number(pm.environment.get(\"smooveApiSiteId\"));\nconst suffix = String(Date.now()) + Math.random().toString(36).slice(2, 6);\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst createResponse = await send({\n    url: baseURL + \"/api/v1/account/users?accountSiteId=\" + siteId,\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Cookie\": \"jvlpsi=\" + cookie + \";\"\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            administratorId: 0,\n            nickName: \"TestUser_Update\",\n            preferredLanguage: \"en\",\n            requireMfa: false,\n            sessionTimeOut: 30,\n            externalProviderSignupOrigin: \"\",\n            cellphone: \"\",\n            isMainAdministrator: false,\n            userName: \"test_user_\" + suffix,\n            email: \"testuser_\" + suffix + \"@mailtest.com\",\n            password: \"Test@1234\",\n            role: \"None\",\n            dataAccountId: siteId,\n            permissions: {}\n        })\n    }\n});\npm.expect(createResponse.code, \"create user before update\").to.eql(200);\nconst newUser = createResponse.json();\npm.expect(newUser.administratorId, \"created administratorId\").to.be.above(0);\n\nconst updatedNickName = \"UpdatedUser_\" + suffix;\nconst updatedCellphone = \"0501234567\";\npm.environment.set(\"smooveApiAdministratorId\", String(newUser.administratorId));\npm.environment.set(\"smooveApiUpdatedUserNickName\", updatedNickName);\npm.environment.set(\"smooveApiUpdatedUserCellphone\", updatedCellphone);\npm.environment.set(\"smooveApiUpdatedUserName\", newUser.userName);\npm.environment.set(\"smooveApiUpdatedUserEmail\", newUser.email);\n\npm.request.body.update(JSON.stringify({\n    administratorId: newUser.administratorId,\n    dataAccountId: newUser.dataAccountId,\n    nickName: updatedNickName,\n    userName: newUser.userName,\n    email: newUser.email,\n    password: \"Test@12345\",\n    preferredLanguage: \"en\",\n    requireMfa: false,\n    sessionTimeOut: 60,\n    externalProviderSignupOrigin: \"\",\n    cellphone: updatedCellphone,\n    isMainAdministrator: false,\n    role: \"None\",\n    permissions: {}\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedId = Number(pm.environment.get(\"smooveApiAdministratorId\"));\nconst expectedNick = pm.environment.get(\"smooveApiUpdatedUserNickName\");\nconst expectedPhone = pm.environment.get(\"smooveApiUpdatedUserCellphone\");\nconst expectedUserName = pm.environment.get(\"smooveApiUpdatedUserName\");\nconst expectedEmail = pm.environment.get(\"smooveApiUpdatedUserEmail\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['administratorId', 'dataAccountId', 'requireMfa', 'sessionTimeOut', 'role', 'nickName', 'userName', 'email', 'preferredLanguage', 'externalProviderSignupOrigin', 'cellphone', 'isMainAdministrator', 'permissions'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.administratorId, 'administratorId').to.be.a('number');\n    pm.expect(json.dataAccountId, 'dataAccountId').to.be.a('number');\n    pm.expect(json.requireMfa, 'requireMfa').to.be.a('boolean');\n    pm.expect(json.sessionTimeOut, 'sessionTimeOut').to.be.a('number');\n    pm.expect(json.role, 'role').to.be.a('string');\n    pm.expect(json.nickName, 'nickName').to.be.a('string');\n    pm.expect(json.userName, 'userName').to.be.a('string');\n    pm.expect(json.email, 'email').to.be.a('string');\n    pm.expect(json.preferredLanguage, 'preferredLanguage').to.be.a('string');\n    pm.expect(json.externalProviderSignupOrigin, 'externalProviderSignupOrigin').to.be.a('string');\n    pm.expect(json.cellphone, 'cellphone').to.be.a('string');\n    pm.expect(json.isMainAdministrator, 'isMainAdministrator').to.be.a('boolean');\n    pm.expect(json.permissions, 'permissions').to.be.an('object');\n});\n\npm.test('Updated user reflects changed nickName and cellphone', function () {\n    const json = pm.response.json();\n    pm.expect(json.administratorId, 'administratorId').to.eql(expectedId);\n    pm.expect(json.nickName, 'nickName').to.eql(expectedNick);\n    pm.expect(json.cellphone, 'cellphone').to.eql(expectedPhone);\n    pm.expect(json.userName, 'userName').to.eql(expectedUserName);\n    pm.expect(json.email, 'email').to.eql(expectedEmail);\n    pm.expect(json.role, 'role').to.eql('None');\n    pm.expect(json.isMainAdministrator, 'isMainAdministrator').to.eql(false);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const siteId = pm.environment.get(\"smooveApiSiteId\");\n    const adminId = pm.environment.get(\"smooveApiAdministratorId\");\n    if (!adminId) {\n        pm.test(\"Cleanup skipped: could not resolve administrator id\", function () {\n            pm.expect.fail(\"Missing administratorId for cleanup\");\n        });\n        return;\n    }\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/account/users/\" + adminId + \"?accountSiteId=\" + siteId,\n        method: \"DELETE\",\n        header: {\n            \"Cookie\": `jvlpsi=${cookie};`,\n            \"Accept\": \"application/json\"\n        }\n    });\n    pm.test(\"Cleanup: account user deleted successfully\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n}\n\nawait cleanUp();\n\n[\"smooveApiUpdatedUserNickName\", \"smooveApiUpdatedUserCellphone\", \"smooveApiUpdatedUserName\", \"smooveApiUpdatedUserEmail\"].forEach(function (k) {\n    pm.environment.unset(k);\n});"]}}],"id":"215cb65b-d2aa-4936-8741-4eaefe1b926c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/account/users?accountSiteId={{smooveApiSiteId}}","urlObject":{"path":["api","v1","account","users"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"accountSiteId","value":"{{smooveApiSiteId}}"}],"variable":[]}},"response":[],"_postman_id":"215cb65b-d2aa-4936-8741-4eaefe1b926c"}],"id":"7a14a267-06a8-4926-88dd-4b6a772efd82","_postman_id":"7a14a267-06a8-4926-88dd-4b6a772efd82","description":""},{"name":"quotaDetails","item":[{"name":"{feature}","item":[{"name":"Account Get Quota Details - Available","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['availableAccountPlanType', 'availableAsUpsale', 'availableOnUpgrade', 'isLimitReached', 'isLimitExceeded', 'availableUnits', 'limit', 'used', 'isUnlimited', 'isAvailable', 'availableAccountPlanName'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.availableAccountPlanType, 'availableAccountPlanType').to.be.a('string');\n    pm.expect(json.availableAsUpsale, 'availableAsUpsale').to.be.a('boolean');\n    pm.expect(json.availableOnUpgrade, 'availableOnUpgrade').to.be.a('boolean');\n    pm.expect(json.isLimitReached, 'isLimitReached').to.be.a('boolean');\n    pm.expect(json.isLimitExceeded, 'isLimitExceeded').to.be.a('boolean');\n    pm.expect(json.availableUnits, 'availableUnits').to.be.a('number');\n    pm.expect(json.limit, 'limit').to.be.a('number');\n    pm.expect(json.used, 'used').to.be.a('number');\n    pm.expect(json.isUnlimited, 'isUnlimited').to.be.a('boolean');\n    pm.expect(json.isAvailable, 'isAvailable').to.be.a('boolean');\n    pm.expect(json.availableAccountPlanName, 'availableAccountPlanName').to.be.a('string');\n});\n\npm.test('Feature is available with consistent quota values', function () {\n    const json = pm.response.json();\n    pm.expect(json.isAvailable, 'isAvailable').to.eql(true);\n    pm.expect(json.used, 'used').to.be.at.least(0);\n    pm.expect(json.limit, 'limit').to.be.at.least(0);\n    pm.expect(json.availableUnits, 'availableUnits').to.be.at.least(0);\n    pm.expect(json.availableAccountPlanType, 'availableAccountPlanType').to.not.equal('');\n    pm.expect(json.availableAccountPlanName, 'availableAccountPlanName').to.not.equal('');\n    if (json.isUnlimited) {\n        pm.expect(json.isLimitReached, 'isLimitReached when unlimited').to.eql(false);\n        pm.expect(json.isLimitExceeded, 'isLimitExceeded when unlimited').to.eql(false);\n    } else {\n        pm.expect(json.availableUnits, 'availableUnits').to.eql(json.limit - json.used);\n    }\n});"]}}],"id":"727a1641-5650-4699-9caa-288bec186adb","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/account/quotaDetails/{{smooveApiFeatureAvailable}}","urlObject":{"path":["api","v1","account","quotaDetails","{{smooveApiFeatureAvailable}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"727a1641-5650-4699-9caa-288bec186adb"},{"name":"Account Get Quota Details - Not available","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['availableAccountPlanType', 'availableAsUpsale', 'availableOnUpgrade', 'isLimitReached', 'isLimitExceeded', 'availableUnits', 'limit', 'used', 'isUnlimited', 'isAvailable', 'availableAccountPlanName'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.availableAccountPlanType, 'availableAccountPlanType').to.be.a('string');\n    pm.expect(json.availableAsUpsale, 'availableAsUpsale').to.be.a('boolean');\n    pm.expect(json.availableOnUpgrade, 'availableOnUpgrade').to.be.a('boolean');\n    pm.expect(json.isLimitReached, 'isLimitReached').to.be.a('boolean');\n    pm.expect(json.isLimitExceeded, 'isLimitExceeded').to.be.a('boolean');\n    pm.expect(json.availableUnits, 'availableUnits').to.be.a('number');\n    pm.expect(json.limit, 'limit').to.be.a('number');\n    pm.expect(json.used, 'used').to.be.a('number');\n    pm.expect(json.isUnlimited, 'isUnlimited').to.be.a('boolean');\n    pm.expect(json.isAvailable, 'isAvailable').to.be.a('boolean');\n    pm.expect(json.availableAccountPlanName, 'availableAccountPlanName').to.be.a('string');\n});\n\npm.test('Feature is not available', function () {\n    const json = pm.response.json();\n    pm.expect(json.isAvailable, 'isAvailable').to.eql(false);\n    pm.expect(json.isUnlimited, 'isUnlimited').to.eql(false);\n    pm.expect(json.limit, 'limit').to.eql(0);\n    pm.expect(json.availableUnits, 'availableUnits').to.eql(0);\n    pm.expect(json.used, 'used').to.be.at.least(0);\n});"]}}],"id":"349cbf5f-ce67-4a43-9f1c-fe4bdce20e88","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/account/quotaDetails/{{smooveApiFeatureNotAvailable}}","urlObject":{"path":["api","v1","account","quotaDetails","{{smooveApiFeatureNotAvailable}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"349cbf5f-ce67-4a43-9f1c-fe4bdce20e88"}],"id":"85e2c44b-cfc9-4279-bf6a-6f7752a7dd70","_postman_id":"85e2c44b-cfc9-4279-bf6a-6f7752a7dd70","description":""}],"id":"8abe00f6-d60d-4c51-8c8a-8ca723caf33a","_postman_id":"8abe00f6-d60d-4c51-8c8a-8ca723caf33a","description":""},{"name":"isAllowedToCreateAnotherList","item":[{"name":"Account Is Allowed To Create Another List","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a boolean', function () {\n    // No fixed true/false expected for this account; type is the contract.\n    pm.expect(pm.response.json()).to.be.a('boolean');\n});"]}}],"id":"8996818a-6e9e-4ad0-aa31-78cf0cba3b6b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/account/isAllowedToCreateAnotherList","urlObject":{"path":["api","v1","account","isAllowedToCreateAnotherList"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8996818a-6e9e-4ad0-aa31-78cf0cba3b6b"}],"id":"bff74ca7-5926-4ce6-ae34-97c030db721d","_postman_id":"bff74ca7-5926-4ce6-ae34-97c030db721d","description":""},{"name":"isAllowedToAddAnotherCustomField","item":[{"name":"Account Is Allowed To Add Another Custom Field","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a boolean', function () {\n    // No fixed true/false expected for this account; type is the contract.\n    pm.expect(pm.response.json()).to.be.a('boolean');\n});"]}}],"id":"1a778374-ff27-4142-a767-239ead6a4d0c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/account/isAllowedToAddAnotherCustomField","urlObject":{"path":["api","v1","account","isAllowedToAddAnotherCustomField"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"1a778374-ff27-4142-a767-239ead6a4d0c"}],"id":"8d17eee3-6bd2-4ad8-8a63-3df77a680d26","_postman_id":"8d17eee3-6bd2-4ad8-8a63-3df77a680d26","description":""},{"name":"Account Get Account Info","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    const s = json.settings;\n    const nullableString = function (value, label) {\n        pm.expect(value == null || typeof value === 'string', label).to.equal(true);\n    };\n    const parseableDate = function (value, label) {\n        if (!value) return;\n        pm.expect(Number.isNaN(Date.parse(value)), label + ' should be a parseable date').to.equal(false);\n    };\n\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing lists').to.have.property('lists');\n    pm.expect(json, 'missing extraFields').to.have.property('extraFields');\n    pm.expect(json, 'missing extraFieldGroups').to.have.property('extraFieldGroups');\n    pm.expect(json, 'missing settings').to.have.property('settings');\n    pm.expect(json.lists, 'lists').to.be.an('array');\n    pm.expect(json.extraFields, 'extraFields').to.be.an('array');\n    pm.expect(json.extraFieldGroups, 'extraFieldGroups').to.be.an('array');\n    pm.expect(s, 'settings').to.be.an('object');\n\n    if (json.lists.length) {\n        const list = json.lists[0];\n        pm.expect(list.isActive, 'isActive').to.be.a('boolean');\n        pm.expect(list.contactsCount, 'contactsCount').to.be.a('number');\n        pm.expect(list.isPublic, 'isPublic').to.be.a('boolean');\n        pm.expect(list.isPortal, 'isPortal').to.be.a('boolean');\n        pm.expect(list.isDynamic, 'isDynamic').to.be.a('boolean');\n        pm.expect(list.isEvaluationInProgress, 'isEvaluationInProgress').to.be.a('boolean');\n        pm.expect(list.allowRegistration, 'allowRegistration').to.be.a('boolean');\n        pm.expect(list.id, 'id').to.be.a('number');\n        pm.expect(list.name, 'name').to.be.a('string');\n        nullableString(list.description, 'description');\n        nullableString(list.publicName, 'publicName');\n        nullableString(list.publicDescription, 'publicDescription');\n        nullableString(list.lastEvaluatedAt, 'lastEvaluatedAt');\n        parseableDate(list.lastEvaluatedAt, 'lastEvaluatedAt');\n        nullableString(list.groupFilterCondition, 'groupFilterCondition');\n        nullableString(list.createdAt, 'createdAt');\n        parseableDate(list.createdAt, 'createdAt');\n        nullableString(list.updatedAt, 'updatedAt');\n        parseableDate(list.updatedAt, 'updatedAt');\n    }\n\n    if (json.extraFields.length) {\n        const field = json.extraFields[0];\n        pm.expect(field.serialNumber, 'serialNumber').to.be.a('number');\n        pm.expect(field.id, 'id').to.be.a('number');\n        pm.expect(field.name, 'name').to.be.a('string');\n        pm.expect(field.type, 'type').to.be.a('string');\n        pm.expect(field.dataType, 'dataType').to.be.a('string');\n        pm.expect(field.options == null || Array.isArray(field.options), 'options').to.equal(true);\n        pm.expect(field.defaultValue == null || typeof field.defaultValue === 'boolean', 'defaultValue').to.equal(true);\n        pm.expect(field.groupId, 'groupId').to.be.a('number');\n        pm.expect(field.position, 'position').to.be.a('number');\n        pm.expect(field.mapId, 'mapId').to.be.a('string');\n    }\n\n    if (json.extraFieldGroups.length) {\n        const group = json.extraFieldGroups[0];\n        pm.expect(group.position, 'position').to.be.a('number');\n        pm.expect(group.id, 'id').to.be.a('number');\n        pm.expect(group.name, 'name').to.be.a('string');\n    }\n\n    pm.expect(s.id, 'id').to.be.a('number');\n    pm.expect(s.siteId, 'siteId').to.be.a('number');\n    pm.expect(s.mainSiteId, 'mainSiteId').to.be.a('number');\n    pm.expect(s.mainSiteIdParsed, 'mainSiteIdParsed').to.be.a('number');\n    pm.expect(s.resellerId, 'resellerId').to.be.a('number');\n    pm.expect(s.maxContacts, 'maxContacts').to.be.a('number');\n    pm.expect(s.importOptInRequired, 'importOptInRequired').to.be.a('boolean');\n    pm.expect(s.isExternalIdEnabled, 'isExternalIdEnabled').to.be.a('boolean');\n    pm.expect(s.isPortalPasswordRequired, 'isPortalPasswordRequired').to.be.a('boolean');\n    pm.expect(s.portalState, 'portalState').to.be.a('number');\n    pm.expect(s.planType, 'planType').to.be.a('string').and.not.empty;\n    pm.expect(s.dateCreated, 'dateCreated').to.be.a('string');\n    parseableDate(s.dateCreated, 'dateCreated');\n    pm.expect(s.landingPagesQuota, 'landingPagesQuota').to.be.a('number');\n    pm.expect(s.embeddedFormsQuota, 'embeddedFormsQuota').to.be.a('number');\n    pm.expect(s.smartphoneCampaignQuota, 'smartphoneCampaignQuota').to.be.a('number');\n    pm.expect(s.popupsQuota, 'popupsQuota').to.be.a('number');\n    pm.expect(s.formsQuota, 'formsQuota').to.be.a('number');\n    pm.expect(s.allowPermanentDeletion, 'allowPermanentDeletion').to.be.a('boolean');\n    pm.expect(s.smsApiProvider, 'smsApiProvider').to.be.a('number');\n    pm.expect(s.mainAdministratorId, 'mainAdministratorId').to.be.a('number');\n    pm.expect(s.isMainAdministrator, 'isMainAdministrator').to.be.a('boolean');\n    pm.expect(s.automationsQuota, 'automationsQuota').to.be.a('number');\n    pm.expect(s.categoriesQuota, 'categoriesQuota').to.be.a('number');\n    pm.expect(s.isFreemiumSubscription, 'isFreemiumSubscription').to.be.a('boolean');\n    pm.expect(s.isGlobalAdminRole, 'isGlobalAdminRole').to.be.a('boolean');\n    nullableString(s.name, 'name');\n    nullableString(s.notifyMail, 'notifyMail');\n    nullableString(s.locale, 'locale');\n    nullableString(s.pingOnUnsubscriptions, 'pingOnUnsubscriptions');\n    nullableString(s.pingOnNewSubscriptions, 'pingOnNewSubscriptions');\n    nullableString(s.pingOnResubscriptions, 'pingOnResubscriptions');\n    nullableString(s.omnichannelApiProviderKey, 'omnichannelApiProviderKey');\n    nullableString(s.omnichannelVirtualNumber, 'omnichannelVirtualNumber');\n    if (s.administrators !== undefined) {\n        pm.expect(s.administrators, 'administrators').to.be.an('array');\n    }\n    nullableString(s.firstName, 'firstName');\n    nullableString(s.lastName, 'lastName');\n    if (s.accountsSharingQuota !== undefined) {\n        pm.expect(s.accountsSharingQuota, 'accountsSharingQuota').to.be.an('array');\n    }\n    nullableString(s.username, 'username');\n    nullableString(s.email, 'email');\n    nullableString(s.phone, 'phone');\n    nullableString(s.company, 'company');\n    nullableString(s.timezone, 'timezone');\n    nullableString(s.ip, 'ip');\n    nullableString(s.country, 'country');\n    nullableString(s.culture, 'culture');\n});\n\npm.test('Account settings match the authenticated site', function () {\n    const json = pm.response.json();\n    const expectedSiteId = Number(pm.environment.get(\"smooveApiAccountSiteId\") || pm.environment.get(\"smooveApiSiteId\"));\n    pm.expect(json.settings.siteId, 'settings.siteId').to.eql(expectedSiteId);\n    pm.expect(json.settings.id, 'settings.id').to.be.above(0);\n    pm.expect(json.settings.mainAdministratorId, 'mainAdministratorId').to.be.above(0);\n    pm.expect(json.extraFields.length, 'extraFields length').to.be.at.least(1);\n    pm.expect(json.extraFieldGroups.length, 'extraFieldGroups length').to.be.at.least(1);\n});"]}}],"id":"b1845da4-af2f-4579-87a8-207c8dc7f267","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/account","urlObject":{"path":["api","v1","account"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"b1845da4-af2f-4579-87a8-207c8dc7f267"}],"id":"d35cbd7f-a4d8-4c9c-81a1-f1a85dcca8af","_postman_id":"d35cbd7f-a4d8-4c9c-81a1-f1a85dcca8af","description":""},{"name":"affiliates","item":[{"name":"payments","item":[{"name":"Affiliate Get Affiliates Payments","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    // Always present (nullable summary fields freeAccounts/payingAccounts/paymentDate/totalAmount are omitted when null)\n    ['servicePayments', 'affiliatePayments', 'accounts'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.an('array');\n    });\n});\n\npm.test('Payment collections are consistent when populated', function () {\n    const json = pm.response.json();\n\n    if (Object.prototype.hasOwnProperty.call(json, 'freeAccounts')) {\n        pm.expect(json.freeAccounts, 'freeAccounts').to.be.a('number').and.at.least(0);\n    }\n    if (Object.prototype.hasOwnProperty.call(json, 'payingAccounts')) {\n        pm.expect(json.payingAccounts, 'payingAccounts').to.be.a('number').and.at.least(0);\n    }\n    if (Object.prototype.hasOwnProperty.call(json, 'totalAmount')) {\n        pm.expect(json.totalAmount, 'totalAmount').to.be.a('number');\n    }\n    if (Object.prototype.hasOwnProperty.call(json, 'paymentDate') && json.paymentDate != null) {\n        pm.expect(json.paymentDate, 'paymentDate').to.be.a('string');\n        pm.expect(Number.isNaN(Date.parse(json.paymentDate)), 'paymentDate parseable').to.equal(false);\n    }\n\n    if (json.servicePayments.length) {\n        const sp = json.servicePayments[0];\n        ['commissionRate', 'isMonthlyService', 'amount', 'currency'].forEach(function (key) {\n            pm.expect(sp, 'servicePayments[0] missing ' + key).to.have.property(key);\n        });\n        pm.expect(sp.commissionRate, 'commissionRate').to.be.a('number');\n        pm.expect(sp.isMonthlyService, 'isMonthlyService').to.be.a('boolean');\n        pm.expect(sp.amount, 'amount').to.be.a('number');\n        pm.expect(sp.currency, 'currency').to.be.a('string').and.not.empty;\n    }\n\n    if (json.affiliatePayments.length) {\n        const ap = json.affiliatePayments[0];\n        ['siteId', 'amount'].forEach(function (key) {\n            pm.expect(ap, 'affiliatePayments[0] missing ' + key).to.have.property(key);\n        });\n        pm.expect(ap.siteId, 'siteId').to.be.a('number').and.above(0);\n        pm.expect(ap.amount, 'amount').to.be.a('number');\n    }\n\n    if (json.accounts.length) {\n        const account = json.accounts[0];\n        ['siteId', 'isActive', 'maxContacts', 'customerId', 'createdAt', 'userName', 'email'].forEach(function (key) {\n            pm.expect(account, 'accounts[0] missing ' + key).to.have.property(key);\n        });\n        pm.expect(account.siteId, 'siteId').to.be.a('number').and.above(0);\n        pm.expect(account.isActive, 'isActive').to.be.a('boolean');\n        pm.expect(account.maxContacts, 'maxContacts').to.be.a('number');\n        pm.expect(account.customerId, 'customerId').to.be.a('number');\n        pm.expect(account.createdAt, 'createdAt').to.be.a('string').and.not.empty;\n        pm.expect(account.userName, 'userName').to.be.a('string').and.not.empty;\n        pm.expect(account.email, 'email').to.be.a('string');\n    }\n\n    // Empty affiliate account still returns the three collections as arrays\n    pm.expect(json.servicePayments, 'servicePayments').to.be.an('array');\n    pm.expect(json.affiliatePayments, 'affiliatePayments').to.be.an('array');\n    pm.expect(json.accounts, 'accounts').to.be.an('array');\n});"]}}],"id":"8fe93e35-1264-4674-af5e-e5736525871a","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/affiliates/payments?AffiliateStatus=3&Page=1&PageSize=50","urlObject":{"path":["api","v1","affiliates","payments"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"AffiliateStatus","value":"3"},{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"8fe93e35-1264-4674-af5e-e5736525871a"}],"id":"b6678a25-0708-46dd-975b-39a0b5bcad45","_postman_id":"b6678a25-0708-46dd-975b-39a0b5bcad45","description":""},{"name":"accounts-for-affiliator","item":[{"name":"Affiliate Get Accounts For Affiliator","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination echoes request Page and PageSize', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.pages, 'pages').to.be.at.least(1);\n    pm.expect(json.rows, 'rows').to.eql(json.results.length);\n});\n\npm.test('Result items have required fields when present', function () {\n    const json = pm.response.json();\n    if (!json.results.length) {\n        return;\n    }\n    const item = json.results[0];\n    ['siteId', 'isActive', 'createdAt', 'userName', 'email'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.siteId, 'siteId').to.be.a('number').and.above(0);\n    pm.expect(item.isActive, 'isActive').to.be.a('boolean');\n    pm.expect(item.createdAt, 'createdAt').to.be.a('string').and.not.empty;\n    pm.expect(Number.isNaN(Date.parse(item.createdAt)), 'createdAt parseable').to.equal(false);\n    pm.expect(item.userName, 'userName').to.be.a('string').and.not.empty;\n    pm.expect(item.email, 'email').to.be.a('string');\n});"]}}],"id":"b6674e25-e334-4392-af5a-5a0390c176d6","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/affiliates/accounts-for-affiliator?AffiliateStatus=3&Page=1&PageSize=50","urlObject":{"path":["api","v1","affiliates","accounts-for-affiliator"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"AffiliateStatus","value":"3"},{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"b6674e25-e334-4392-af5a-5a0390c176d6"}],"id":"6b6fefdb-824e-459d-a367-e8ac9e6ed834","_postman_id":"6b6fefdb-824e-459d-a367-e8ac9e6ed834","description":""},{"name":"count","item":[{"name":"Affiliate Get Affiliates Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a finite non-negative integer count', function () {\n    const value = pm.response.json();\n    pm.expect(value, 'count').to.be.a('number');\n    pm.expect(Number.isFinite(value), 'count is finite').to.equal(true);\n    pm.expect(Number.isInteger(value), 'count is integer').to.equal(true);\n    pm.expect(value, 'count').to.be.at.least(0);\n});"]}}],"id":"d8fd51bf-8519-41a7-9f23-614d9c1cf26d","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/affiliates/count","urlObject":{"path":["api","v1","affiliates","count"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d8fd51bf-8519-41a7-9f23-614d9c1cf26d"}],"id":"fad3afca-c275-42a0-b1bc-2f4aa54efa88","_postman_id":"fad3afca-c275-42a0-b1bc-2f4aa54efa88","description":""}],"id":"d054fba4-e3db-485e-a810-e01bd5d61152","_postman_id":"d054fba4-e3db-485e-a810-e01bd5d61152","description":""},{"name":"ai","item":[{"name":"promptGenAiText","item":[{"name":"Ai Prompt Gen Ai Text","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}\nlet apiKey = pm.environment.get(\"apiKey\");\nif (!apiKey) {\n    apiKey = pm.environment.get(\"smooveApiKey\");\n    if (apiKey) {\n        pm.request.upsertHeader({ key: \"apiKey\", value: apiKey });\n    }\n}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['assistantMessage', 'finishStatus'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.an('object');\n    });\n\n    pm.expect(json.finishStatus, 'finishStatus missing isSuccess').to.have.property('isSuccess');\n    pm.expect(json.finishStatus.isSuccess, 'finishStatus.isSuccess').to.be.a('boolean');\n\n    ['role', 'content', 'genAiUsage', 'outputFiles'].forEach(function (key) {\n        pm.expect(json.assistantMessage, 'assistantMessage missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.assistantMessage.role, 'role').to.be.a('string');\n    pm.expect(json.assistantMessage.content, 'content').to.be.a('string');\n    pm.expect(json.assistantMessage.genAiUsage, 'genAiUsage').to.be.an('object');\n    pm.expect(json.assistantMessage.outputFiles, 'outputFiles').to.be.an('array');\n\n    pm.expect(json.assistantMessage.genAiUsage, 'genAiUsage missing modelId').to.have.property('modelId');\n    pm.expect(json.assistantMessage.genAiUsage.modelId, 'modelId').to.be.a('string');\n});\n\npm.test('GenAI text result is successful and echoes model', function () {\n    const json = pm.response.json();\n    pm.expect(json.finishStatus.isSuccess, 'finishStatus.isSuccess').to.equal(true);\n    pm.expect(json.assistantMessage.role, 'role').to.eql('assistant');\n    pm.expect(json.assistantMessage.content, 'content').to.have.lengthOf.at.least(1);\n    pm.expect(json.assistantMessage.genAiUsage.modelId, 'modelId').to.eql(pm.environment.get('smooveApiAiModelId'));\n});"]}}],"id":"f9e3ced6-6cae-45b2-ae45-d4917adf5db5","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"systemMessage\": {\n    \"role\": \"system\",\n    \"content\": \"You are a helpful assistant. Reply briefly and clearly.\"\n  },\n  \"userMessage\": {\n    \"role\": \"user\",\n    \"content\": \"Write a one-sentence welcome message for a new email-marketing subscriber.\"\n  },\n  \"history\": [],\n  \"provider\": \"{{smooveApiAiProvider}}\",\n  \"modelId\": \"{{smooveApiAiModelId}}\",\n  \"responseFormat\": {\n    \"type\": \"text\"\n  },\n  \"tools\": [],\n  \"attachments\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/ai/promptGenAiText","urlObject":{"path":["api","v1","ai","promptGenAiText"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f9e3ced6-6cae-45b2-ae45-d4917adf5db5"}],"id":"1e60d08f-0cd4-493a-b524-3902c9fe3e21","_postman_id":"1e60d08f-0cd4-493a-b524-3902c9fe3e21","description":""},{"name":"promptGenAiTextStream","item":[{"name":"Ai Prompt Gen Ai Text Stream","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}\nlet apiKey = pm.environment.get(\"apiKey\");\nif (!apiKey) {\n    apiKey = pm.environment.get(\"smooveApiKey\");\n    if (apiKey) {\n        pm.request.upsertHeader({ key: \"apiKey\", value: apiKey });\n    }\n}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction sleep(ms) {\n    return new Promise(function (resolve) {\n        setTimeout(resolve, ms);\n    });\n}\n\nfunction parseSse(text) {\n    const deltas = [];\n    let done = false;\n    let errorMessage = null;\n\n    String(text || \"\").split(/\\n/).forEach(function (line) {\n        const trimmed = line.trim();\n        if (!trimmed.startsWith(\"data:\")) return;\n        const payload = trimmed.slice(5).trim();\n        if (!payload) return;\n        try {\n            const evt = JSON.parse(payload);\n            if (typeof evt.delta === \"string\") {\n                deltas.push(evt.delta);\n            }\n            if (evt.done === true) {\n                done = true;\n            }\n            if (evt.error != null && String(evt.error).trim() !== \"\") {\n                errorMessage = String(evt.error);\n            }\n        } catch (e) {\n            // ignore non-JSON SSE lines\n        }\n    });\n\n    return {\n        deltas: deltas,\n        combined: deltas.join(\"\"),\n        done: done,\n        errorMessage: errorMessage\n    };\n}\n\nfunction isTransientAiError(message) {\n    const m = String(message || \"\").toLowerCase();\n    return (\n        m.indexOf(\"currently\") !== -1 ||\n        m.indexOf(\"overloaded\") !== -1 ||\n        m.indexOf(\"rate\") !== -1 ||\n        m.indexOf(\"timeout\") !== -1 ||\n        m.indexOf(\"temporar\") !== -1 ||\n        m.indexOf(\"busy\") !== -1 ||\n        m.indexOf(\"try again\") !== -1 ||\n        m.indexOf(\"incomplete json\") !== -1 ||\n        m.indexOf(\"segment\") !== -1\n    );\n}\n\nfunction isSuccessfulStream(parsed) {\n    return !!(parsed && !parsed.errorMessage && parsed.done && parsed.deltas.length && parsed.combined.length);\n}\n\nasync function callStream() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    let apiKey = pm.environment.get(\"apiKey\") || pm.environment.get(\"smooveApiKey\");\n    const headers = {\n        \"Content-Type\": \"application/json\",\n        Accept: \"text/event-stream\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    };\n    if (apiKey) headers.apiKey = apiKey;\n\n    return send({\n        url: baseUrl + \"/api/v1/ai/promptGenAiTextStream\",\n        method: \"POST\",\n        header: headers,\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({\n                systemMessage: {\n                    role: \"system\",\n                    content: \"You are a helpful assistant. Reply briefly and clearly.\"\n                },\n                userMessage: {\n                    role: \"user\",\n                    content: \"Write a one-sentence welcome message for a new email-marketing subscriber.\"\n                },\n                history: [],\n                provider: pm.environment.get(\"smooveApiAiProvider\"),\n                modelId: pm.environment.get(\"smooveApiAiModelId\"),\n                responseFormat: { type: \"text\" },\n                tools: [],\n                attachments: []\n            })\n        }\n    });\n}\n\nlet response = pm.response;\nlet parsed = parseSse(response.text());\nfor (let attempt = 1; attempt < 3 && !isSuccessfulStream(parsed); attempt++) {\n    if (parsed.errorMessage && !isTransientAiError(parsed.errorMessage)) break;\n    await sleep(1000 * attempt);\n    response = await callStream();\n    parsed = parseSse(response.text());\n}\n\npm.test('Status code is 200', function () {\n    pm.expect(response.code, \"status\").to.eql(200);\n});\n\npm.test('Response is a successful SSE GenAI text stream', function () {\n    pm.expect(response.text(), \"body\").to.be.a('string').and.not.empty;\n    pm.expect(parsed.errorMessage, \"sse error\").to.equal(null);\n    pm.expect(parsed.done, \"done event\").to.eql(true);\n    pm.expect(parsed.deltas.length, \"delta events\").to.be.at.least(1);\n    pm.expect(parsed.combined, \"combined delta text\").to.have.lengthOf.at.least(1);\n});"]}}],"id":"d687969d-17f9-4a71-8b72-48c80876c4fa","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/event-stream"}],"body":{"mode":"raw","raw":"{\n  \"systemMessage\": {\n    \"role\": \"system\",\n    \"content\": \"You are a helpful assistant. Reply briefly and clearly.\"\n  },\n  \"userMessage\": {\n    \"role\": \"user\",\n    \"content\": \"Write a one-sentence welcome message for a new email-marketing subscriber.\"\n  },\n  \"history\": [],\n  \"provider\": \"{{smooveApiAiProvider}}\",\n  \"modelId\": \"{{smooveApiAiModelId}}\",\n  \"responseFormat\": {\n    \"type\": \"text\"\n  },\n  \"tools\": [],\n  \"attachments\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/ai/promptGenAiTextStream","urlObject":{"path":["api","v1","ai","promptGenAiTextStream"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d687969d-17f9-4a71-8b72-48c80876c4fa"}],"id":"fd195496-40e6-44ab-9f29-0622c22bda17","_postman_id":"fd195496-40e6-44ab-9f29-0622c22bda17","description":""},{"name":"promptMagicWand","item":[{"name":"Ai Prompt Magic Wand","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\nlet apiKey = pm.environment.get(\"apiKey\");\nif (!apiKey) {\n    apiKey = pm.environment.get(\"smooveApiKey\");\n    if (apiKey) {\n        pm.request.upsertHeader({ key: \"apiKey\", value: apiKey });\n    }\n}\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction sleep(ms) {\n    return new Promise(function (resolve) {\n        setTimeout(resolve, ms);\n    });\n}\n\nfunction parseSse(text) {\n    const deltas = [];\n    let done = false;\n    let errorMessage = null;\n\n    String(text || \"\").split(/\\n/).forEach(function (line) {\n        const trimmed = line.trim();\n        if (!trimmed.startsWith(\"data:\")) return;\n        const payload = trimmed.slice(5).trim();\n        if (!payload) return;\n        try {\n            const evt = JSON.parse(payload);\n            if (typeof evt.delta === \"string\") {\n                deltas.push(evt.delta);\n            }\n            if (evt.done === true) {\n                done = true;\n            }\n            if (evt.error != null && String(evt.error).trim() !== \"\") {\n                errorMessage = String(evt.error);\n            }\n        } catch (e) {\n            // ignore non-JSON SSE lines\n        }\n    });\n\n    return {\n        deltas: deltas,\n        combined: deltas.join(\"\"),\n        done: done,\n        errorMessage: errorMessage\n    };\n}\n\nfunction isTransientAiError(message) {\n    const m = String(message || \"\").toLowerCase();\n    return (\n        m.indexOf(\"currently\") !== -1 ||\n        m.indexOf(\"overloaded\") !== -1 ||\n        m.indexOf(\"rate\") !== -1 ||\n        m.indexOf(\"timeout\") !== -1 ||\n        m.indexOf(\"temporar\") !== -1 ||\n        m.indexOf(\"busy\") !== -1 ||\n        m.indexOf(\"try again\") !== -1 ||\n        m.indexOf(\"incomplete json\") !== -1 ||\n        m.indexOf(\"segment\") !== -1\n    );\n}\n\nfunction isSuccessfulSpelling(parsed) {\n    if (!parsed || parsed.errorMessage) return false;\n    if (!parsed.done) return false;\n    if (!parsed.deltas.length) return false;\n    const lower = parsed.combined.toLowerCase();\n    return /hello/.test(lower) && /friend/.test(lower) && !/helo frend/.test(lower);\n}\n\nasync function callMagicWand() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    let apiKey = pm.environment.get(\"apiKey\") || pm.environment.get(\"smooveApiKey\");\n    const headers = {\n        \"Content-Type\": \"application/json\",\n        Accept: \"text/event-stream\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    };\n    if (apiKey) {\n        headers.apiKey = apiKey;\n    }\n\n    return send({\n        url: baseUrl + \"/api/v1/ai/promptMagicWand\",\n        method: \"POST\",\n        header: headers,\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({\n                text: \"Helo frend, welcome to our news letter!\",\n                actionType: \"Spelling\",\n                provider: Number(pm.environment.get(\"smooveApiAiMagicWandProvider\")),\n                elementType: \"paragraph\"\n            })\n        }\n    });\n}\n\n// Full-suite AI load often returns transient provider errors after earlier GenAI calls.\nlet response = pm.response;\nlet parsed = parseSse(response.text());\nconst maxAttempts = 4;\n\nfor (let attempt = 1; attempt < maxAttempts && !isSuccessfulSpelling(parsed); attempt++) {\n    // Retry on transient provider/stream errors, or when the stream is incomplete.\n    if (parsed.errorMessage && !isTransientAiError(parsed.errorMessage)) {\n        break;\n    }\n    await sleep(1500 * attempt);\n    response = await callMagicWand();\n    parsed = parseSse(response.text());\n}\n\npm.test(\"Status code is 200\", function () {\n    pm.expect(response.code, \"status\").to.eql(200);\n});\n\npm.test(\"Response is a successful SSE spelling correction stream\", function () {\n    pm.expect(response.text(), \"body\").to.be.a(\"string\").and.not.empty;\n    pm.expect(parsed.errorMessage, \"sse error\").to.equal(null);\n    pm.expect(parsed.done, \"done event\").to.eql(true);\n    pm.expect(parsed.deltas.length, \"delta events\").to.be.at.least(1);\n    pm.expect(parsed.combined, \"combined delta text\").to.have.lengthOf.at.least(1);\n    pm.expect(parsed.combined.toLowerCase(), \"corrected text\").to.match(/hello/);\n    pm.expect(parsed.combined.toLowerCase(), \"corrected text\").to.match(/friend/);\n    pm.expect(parsed.combined.toLowerCase(), \"corrected text\").to.not.match(/helo frend/);\n});"]}}],"id":"1bee6f34-948f-4c3c-9a5d-5af9103bf20b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/event-stream"}],"body":{"mode":"raw","raw":"{\n  \"text\": \"Helo frend, welcome to our news letter!\",\n  \"actionType\": \"Spelling\",\n  \"provider\": {{smooveApiAiMagicWandProvider}},\n  \"elementType\": \"paragraph\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/ai/promptMagicWand","urlObject":{"path":["api","v1","ai","promptMagicWand"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"1bee6f34-948f-4c3c-9a5d-5af9103bf20b"}],"id":"a7e7d698-e9a9-4809-bbb6-c0824211d4fb","_postman_id":"a7e7d698-e9a9-4809-bbb6-c0824211d4fb","description":""}],"id":"cc8eb397-85fe-4b4d-a189-31558064ee4a","_postman_id":"cc8eb397-85fe-4b4d-a189-31558064ee4a","description":""},{"name":"async-operations","item":[{"name":"status","item":[{"name":"{operationUuid}","item":[{"name":"Async Operations Get Status","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\n// Known-missing UUID: API returns Undefined without statusDesc/resultJson\nconst operationUuid = 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee';\npm.environment.set('smooveApiAsyncOperationUuid', operationUuid);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedUuid = pm.environment.get('smooveApiAsyncOperationUuid');\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing statusDetails').to.have.property('statusDetails');\n    pm.expect(json.statusDetails, 'statusDetails').to.be.an('object');\n    ['operationUuid', 'status'].forEach(function (key) {\n        pm.expect(json.statusDetails, 'statusDetails missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.statusDetails.operationUuid, 'operationUuid').to.be.a('string');\n    // Enum serializes as camelCase string (e.g. \"undefined\")\n    pm.expect(json.statusDetails.status, 'status').to.be.a('string').and.not.empty;\n});\n\npm.test('Unknown operation returns Undefined status for requested UUID', function () {\n    const json = pm.response.json();\n    pm.expect(json.statusDetails.operationUuid, 'operationUuid').to.eql(expectedUuid);\n    pm.expect(json.statusDetails.status, 'status').to.eql('undefined');\n    // statusDesc and resultJson are only populated when an operation exists / has a result blob\n    pm.expect(json.statusDetails.statusDesc, 'statusDesc').to.be.oneOf([undefined, null]);\n    pm.expect(json.resultJson, 'resultJson').to.be.oneOf([undefined, null]);\n});"]}}],"id":"36ec4fe3-3375-481f-908d-11b3d44a4f3f","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/async-operations/status/:operationUuid","urlObject":{"path":["api","v1","async-operations","status",":operationUuid"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiAsyncOperationUuid}}","key":"operationUuid"}]}},"response":[],"_postman_id":"36ec4fe3-3375-481f-908d-11b3d44a4f3f"}],"id":"e8c947b8-5d37-439f-9721-7ff00092435e","_postman_id":"e8c947b8-5d37-439f-9721-7ff00092435e","description":""}],"id":"2aa922e5-6bae-46e5-88ab-35fbfc51f96e","_postman_id":"2aa922e5-6bae-46e5-88ab-35fbfc51f96e","description":""}],"id":"acf75dc2-5d81-4e4b-a5e7-e9f0eeec4052","_postman_id":"acf75dc2-5d81-4e4b-a5e7-e9f0eeec4052","description":""},{"name":"blob","item":[{"name":"{fingerprint}","item":[{"name":"Blob Get Blob","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\n\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}\n\n// Sample-media upload is the only API write path into the blob store. The store is\n// content addressed, so a fixed payload keeps re-runs on the same fingerprint.\nconst blobContent = \"postman blob fixture\";\nconst boundary = \"----PostmanBlobFixtureBoundary\";\nconst multipartBody =\n    `--${boundary}\\r\\n` +\n    `Content-Disposition: form-data; name=\"file\"; filename=\"postman-blob-fixture.txt\"\\r\\n` +\n    `Content-Type: text/plain\\r\\n\\r\\n` +\n    `${blobContent}\\r\\n` +\n    `--${boundary}\\r\\n` +\n    `Content-Disposition: form-data; name=\"mediaType\"\\r\\n\\r\\n` +\n    `image\\r\\n` +\n    `--${boundary}--\\r\\n`;\n\nconst uploadRes = await new Promise(function (resolve, reject) {\n    pm.sendRequest({\n        url: baseUrl + \"/api/v1/omnichannelMessages/templates/sample-media\",\n        method: \"POST\",\n        header: {\n            Accept: \"application/json\",\n            \"Content-Type\": `multipart/form-data; boundary=${boundary}`,\n            apiKey: apiKey,\n            Cookie: cookie ? `jvlpsi=${cookie};` : undefined\n        },\n        body: { mode: \"raw\", raw: multipartBody }\n    }, function (err, res) {\n        if (err) reject(err);\n        else resolve(res);\n    });\n});\n\nlet fingerprint = \"\";\nif (uploadRes && uploadRes.code === 200) {\n    const uploaded = uploadRes.json() || {};\n    fingerprint = uploaded.fingerprint || \"\";\n}\n\npm.variables.set(\"smooveApiBlobUploadStatus\", String(uploadRes ? uploadRes.code : 0));\npm.variables.set(\"smooveApiBlobContent\", blobContent);\npm.environment.set(\"smooveApiBlobFingerprintUsed\", fingerprint);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Blob fixture was uploaded and returned a fingerprint', function () {\n    pm.expect(pm.variables.get(\"smooveApiBlobUploadStatus\"), 'sample media upload status').to.equal('200');\n    pm.expect(pm.environment.get(\"smooveApiBlobFingerprintUsed\"), 'fingerprint').to.be.a('string').and.not.empty;\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Blob is served as a binary stream', function () {\n    pm.expect(pm.response.headers.get('Content-Type'), 'Content-Type').to.include('application/octet-stream');\n});\n\npm.test('Blob body matches the uploaded content', function () {\n    pm.expect(pm.response.text()).to.equal(pm.variables.get(\"smooveApiBlobContent\"));\n});"]}}],"id":"6a449abd-8f68-4352-903b-94d6cd64f144","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveApiBaseURL}}/api/v1/blob/:fingerprint","urlObject":{"path":["api","v1","blob",":fingerprint"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiBlobFingerprintUsed}}","key":"fingerprint"}]}},"response":[],"_postman_id":"6a449abd-8f68-4352-903b-94d6cd64f144"}],"id":"486500e5-ab8b-4420-b5ac-2f088b589ef2","_postman_id":"486500e5-ab8b-4420-b5ac-2f088b589ef2","description":""}],"id":"9f1844e7-88a2-46a8-ae4c-9b8378dd11df","_postman_id":"9f1844e7-88a2-46a8-ae4c-9b8378dd11df","description":""},{"name":"business-journeys","item":[{"name":"active","item":[{"name":"Business Journeys Get Active","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\nconst authHeader = {\n    \"Content-Type\": \"application/json\",\n    Accept: \"application/json\",\n    Cookie: \"jvlpsi=\" + cookie + \";\",\n    apiKey: apiKey\n};\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: authHeader,\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: \"Postman Get Active \" + suffix,\n            name: \"postman-get-active-\" + suffix,\n            targetValue: 100,\n            targetDate: future.toISOString(),\n            activate: false\n        })\n    }\n});\npm.expect(createRes.code, \"create journey status\").to.eql(201);\nconst journeyId = Number(createRes.json().id);\npm.expect(journeyId, \"created journey id\").to.be.above(0);\n\nconst activateRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/activate\",\n    method: \"POST\",\n    header: authHeader\n});\npm.expect(activateRes.code, \"activate journey status\").to.eql(200);\n\npm.environment.set(\"smooveApiJourneyIdForGetActive\", String(journeyId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst journeyId = Number(pm.environment.get(\"smooveApiJourneyIdForGetActive\") || 0);\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['hasActiveJourney', 'activeCount'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.hasActiveJourney, 'hasActiveJourney').to.be.a('boolean');\n    pm.expect(json.activeCount, 'activeCount').to.be.a('number');\n});\n\npm.test('Account reports an active journey after seed activate', function () {\n    const json = pm.response.json();\n    pm.expect(json.hasActiveJourney, 'hasActiveJourney').to.eql(true);\n    pm.expect(json.activeCount, 'activeCount').to.be.above(0);\n});\n\nif (journeyId > 0) {\n    const delRes = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + journeyId,\n        method: \"DELETE\",\n        header: {\n            Accept: \"application/json\",\n            Cookie: \"jvlpsi=\" + cookie + \";\",\n            apiKey: apiKey\n        }\n    });\n    pm.test(\"Cleanup deletes seeded journey successfully\", function () {\n        pm.expect([200, 204, 404]).to.include(delRes.code);\n    });\n}\npm.environment.unset(\"smooveApiJourneyIdForGetActive\");"]}}],"id":"7002ba62-5202-41e1-8372-a014cd1c8b1e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/active","urlObject":{"path":["api","v1","business-journeys","active"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7002ba62-5202-41e1-8372-a014cd1c8b1e"}],"id":"1f113f20-3579-4e21-a8c4-09cfc4344334","_postman_id":"1f113f20-3579-4e21-a8c4-09cfc4344334","description":""},{"name":"definitions","item":[{"name":"Business Journeys Get Definitions","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response schema is non-empty array of definitions', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'definitions length').to.be.above(0);\n    const sample = json[0];\n    ['id', 'journeyType', 'audienceState', 'name', 'resourceKey', 'measurementStationKey', 'measurementMetric', 'automationKey'].forEach(function (key) {\n        pm.expect(sample, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(sample.id, 'id').to.be.a('number');\n    pm.expect(sample.journeyType, 'journeyType').to.be.a('string');\n    pm.expect(sample.audienceState, 'audienceState').to.be.a('number');\n    pm.expect(sample.name, 'name').to.be.a('string').and.not.equal('');\n    pm.expect(sample.resourceKey, 'resourceKey').to.be.a('string').and.not.equal('');\n    pm.expect(sample.measurementStationKey, 'measurementStationKey').to.be.a('string').and.not.equal('');\n    pm.expect(sample.measurementMetric, 'measurementMetric').to.be.a('string').and.not.equal('');\n    pm.expect(sample.automationKey, 'automationKey').to.be.a('string').and.not.equal('');\n});\n\npm.test('Lead-generation definition is present', function () {\n    const json = pm.response.json();\n    const leadGen = json.find(function (d) {\n        return d && String(d.journeyType) === 'generateNewLeads'\n            && String(d.automationKey) === 'businessJ-lead-generation';\n    });\n    pm.expect(leadGen, 'generateNewLeads definition').to.be.an('object');\n    pm.expect(Number(leadGen.id), 'id').to.be.a('number').and.above(0);\n    pm.expect(leadGen.journeyType, 'journeyType').to.eql('generateNewLeads');\n    pm.expect(leadGen.automationKey, 'automationKey').to.eql('businessJ-lead-generation');\n    pm.expect(leadGen.measurementStationKey, 'measurementStationKey').to.eql('LandingPage');\n    pm.expect(leadGen.measurementMetric, 'measurementMetric').to.eql('subscriptions');\n    pm.environment.set(\"smooveApiBusinessJourneyDefinitionId\", String(leadGen.id));\n    pm.environment.set(\"smooveApiJourneyStationKey\", String(leadGen.measurementStationKey));\n});"]}}],"id":"a980b996-1be3-4305-887a-c6139c5fa7b4","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/definitions","urlObject":{"path":["api","v1","business-journeys","definitions"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a980b996-1be3-4305-887a-c6139c5fa7b4"}],"id":"4f2e14c5-cd7c-42da-bba6-6439063391ea","_postman_id":"4f2e14c5-cd7c-42da-bba6-6439063391ea","description":""},{"name":"{journeyId}","item":[{"name":"duplicate","item":[{"name":"Business Journeys Duplicate","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\nconst targetDate = future.toISOString();\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\",\n        apiKey: apiKey\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: \"Postman duplicate source \" + suffix,\n            name: \"postman-dup-src-\" + suffix,\n            targetValue: 100,\n            targetDate: targetDate,\n            activate: false\n        })\n    }\n});\npm.expect(createRes.code, \"create journey status\").to.eql(201);\nconst createdId = Number(createRes.json().id);\npm.expect(createdId, \"created journey id\").to.be.above(0);\n\npm.environment.set(\"smooveApiJourneyIdToDuplicate\", String(createdId));\npm.environment.set(\"smooveApiJourneyDuplicateTargetDate\", targetDate);\npm.request.body.update(JSON.stringify({ targetDate: targetDate }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst sourceId = Number(pm.environment.get(\"smooveApiJourneyIdToDuplicate\") || 0);\nconst expectedTargetDate = pm.environment.get(\"smooveApiJourneyDuplicateTargetDate\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\nconst authHeader = {\n    Accept: \"application/json\",\n    Cookie: \"jvlpsi=\" + cookie + \";\",\n    apiKey: apiKey\n};\n\nconst jsonBody = pm.response.json();\nif (jsonBody && Number(jsonBody.id) > 0) {\n    pm.environment.set(\"smooveApiJourneyDuplicateId\", String(jsonBody.id));\n}\n\npm.test('Status code is 201', function () {\n    pm.response.to.have.status(201);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    // Duplicate responses omit targetValue when the API does not copy a numeric target.\n    ['id', 'siteId', 'journeyType', 'audienceState', 'status', 'title', 'name', 'currentValue', 'targetDate', 'currentStationKey', 'currentStepNumber', 'automationKey', 'progressPercent', 'measurementMetric', 'stations', 'createdAt', 'updatedAt'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.status, 'status').to.be.a('string');\n    pm.expect(json.title, 'title').to.be.a('string').and.not.equal('');\n    pm.expect(json.name, 'name').to.be.a('string').and.not.equal('');\n    pm.expect(json.targetDate, 'targetDate').to.be.a('string');\n    pm.expect(json.stations, 'stations').to.be.an('array');\n});\n\npm.test('Duplicated journey is a distinct copy of the source', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'duplicated id').to.be.above(0);\n    pm.expect(json.id, 'duplicated id differs from source').to.not.eql(sourceId);\n    // Duplicate status is draft or active depending on account active-journey state.\n    pm.expect(json.status, 'status').to.be.a('string').and.not.equal('');\n    pm.expect(json.journeyType, 'journeyType').to.eql('generateNewLeads');\n    pm.expect(json.automationKey, 'automationKey').to.eql('businessJ-lead-generation');\n    pm.expect(String(json.targetDate), 'targetDate').to.include(expectedTargetDate.slice(0, 10));\n    pm.expect(json.stations.length, 'stations length').to.be.above(0);\n});\n\nconst duplicatedId = Number(pm.environment.get(\"smooveApiJourneyDuplicateId\") || 0);\n\nasync function deleteJourney(id) {\n    if (!(id > 0)) return null;\n    return send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + id,\n        method: \"DELETE\",\n        header: authHeader\n    });\n}\n\nconst delDup = await deleteJourney(duplicatedId);\nconst delSrc = await deleteJourney(sourceId);\n\npm.test(\"Cleanup deletes duplicated and source journeys successfully\", function () {\n    if (delDup) pm.expect([200, 204, 404]).to.include(delDup.code);\n    if (delSrc) pm.expect([200, 204, 404]).to.include(delSrc.code);\n});\n\npm.environment.unset(\"smooveApiJourneyDuplicateId\");\npm.environment.unset(\"smooveApiJourneyIdToDuplicate\");\npm.environment.unset(\"smooveApiJourneyDuplicateTargetDate\");"]}}],"id":"8f15fafb-fd4d-4941-a875-a245a8fc4f48","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"targetDate\": \"2030-12-31T00:00:00Z\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/:journeyId/duplicate","urlObject":{"path":["api","v1","business-journeys",":journeyId","duplicate"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiJourneyIdToDuplicate}}","key":"journeyId"}]}},"response":[],"_postman_id":"8f15fafb-fd4d-4941-a875-a245a8fc4f48"}],"id":"ef82380e-dd0c-40cb-b651-b1c9f47af204","_postman_id":"ef82380e-dd0c-40cb-b651-b1c9f47af204","description":""},{"name":"activate","item":[{"name":"Business Journeys Activate","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\",\n        apiKey: apiKey\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: \"Postman activate source \" + suffix,\n            name: \"postman-activate-src-\" + suffix,\n            targetValue: 100,\n            targetDate: future.toISOString(),\n            activate: false\n        })\n    }\n});\npm.expect(createRes.code, \"create journey status\").to.eql(201);\nconst createdId = Number(createRes.json().id);\npm.expect(createdId, \"created journey id\").to.be.above(0);\npm.environment.set(\"smooveApiJourneyIdToActivate\", String(createdId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\nconst journeyId = Number(pm.environment.get(\"smooveApiJourneyIdToActivate\") || 0);\nconst authHeader = {\n    Accept: \"application/json\",\n    Cookie: \"jvlpsi=\" + cookie + \";\",\n    apiKey: apiKey\n};\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'siteId', 'journeyType', 'audienceState', 'status', 'title', 'name', 'targetValue', 'currentValue', 'targetDate', 'currentStationKey', 'currentStepNumber', 'automationKey', 'progressPercent', 'measurementMetric', 'stations', 'activatedAt', 'createdAt', 'updatedAt'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.status, 'status').to.be.a('string');\n    pm.expect(json.activatedAt, 'activatedAt').to.be.a('string').and.not.equal('');\n    pm.expect(json.stations, 'stations').to.be.an('array');\n});\n\npm.test('Activated journey has status active', function () {\n    const json = pm.response.json();\n    pm.expect(Number(json.id), 'id').to.eql(journeyId);\n    pm.expect(json.status, 'status').to.eql('active');\n});\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys/\" + journeyId,\n    method: \"GET\",\n    header: authHeader\n});\nconst activeRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys/active\",\n    method: \"GET\",\n    header: authHeader\n});\n\npm.test('Follow-up GET confirms journey is active', function () {\n    pm.expect(getRes.code, 'GET status').to.eql(200);\n    const json = getRes.json();\n    pm.expect(json.status, 'GET status field').to.eql('active');\n    pm.expect(activeRes.code, 'GET /active status').to.eql(200);\n    const active = activeRes.json();\n    pm.expect(active.hasActiveJourney, 'hasActiveJourney').to.eql(true);\n    pm.expect(active.activeCount, 'activeCount').to.be.above(0);\n});\n\nif (journeyId > 0) {\n    const delRes = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + journeyId,\n        method: \"DELETE\",\n        header: authHeader\n    });\n    pm.test(\"Cleanup deletes journey successfully\", function () {\n        pm.expect([200, 204, 404]).to.include(delRes.code);\n    });\n    pm.environment.unset(\"smooveApiJourneyIdToActivate\");\n}"]}}],"id":"e0fcb577-e64d-431f-a2c6-f2b5daf39bc5","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/:journeyId/activate","urlObject":{"path":["api","v1","business-journeys",":journeyId","activate"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiJourneyIdToActivate}}","key":"journeyId"}]}},"response":[],"_postman_id":"e0fcb577-e64d-431f-a2c6-f2b5daf39bc5"}],"id":"640d17f8-0197-45cc-9ef7-bb29d72bf91f","_postman_id":"640d17f8-0197-45cc-9ef7-bb29d72bf91f","description":""},{"name":"pause","item":[{"name":"Business Journeys Pause","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\nconst authHeader = {\n    \"Content-Type\": \"application/json\",\n    Accept: \"application/json\",\n    Cookie: \"jvlpsi=\" + cookie + \";\",\n    apiKey: apiKey\n};\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: authHeader,\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: \"Postman pause source \" + suffix,\n            name: \"postman-pause-src-\" + suffix,\n            targetValue: 100,\n            targetDate: future.toISOString(),\n            activate: false\n        })\n    }\n});\npm.expect(createRes.code, \"create journey status\").to.eql(201);\nconst createdId = Number(createRes.json().id);\npm.expect(createdId, \"created journey id\").to.be.above(0);\n\nconst activateRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys/\" + createdId + \"/activate\",\n    method: \"POST\",\n    header: authHeader\n});\npm.expect(activateRes.code, \"activate journey status\").to.eql(200);\n\npm.environment.set(\"smooveApiJourneyIdToPause\", String(createdId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\nconst journeyId = Number(pm.environment.get(\"smooveApiJourneyIdToPause\") || 0);\nconst authHeader = {\n    Accept: \"application/json\",\n    Cookie: \"jvlpsi=\" + cookie + \";\",\n    apiKey: apiKey\n};\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'siteId', 'journeyType', 'audienceState', 'status', 'title', 'name', 'targetValue', 'currentValue', 'targetDate', 'currentStationKey', 'currentStepNumber', 'automationKey', 'progressPercent', 'measurementMetric', 'stations', 'createdAt', 'updatedAt'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.status, 'status').to.be.a('string');\n    pm.expect(json.stations, 'stations').to.be.an('array');\n});\n\npm.test('Paused journey has status paused', function () {\n    const json = pm.response.json();\n    pm.expect(Number(json.id), 'id').to.eql(journeyId);\n    pm.expect(json.status, 'status').to.eql('paused');\n});\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys/\" + journeyId,\n    method: \"GET\",\n    header: authHeader\n});\n\npm.test('Follow-up GET confirms journey is paused', function () {\n    pm.expect(getRes.code, 'GET status').to.eql(200);\n    const json = getRes.json();\n    pm.expect(json.status, 'GET status field').to.eql('paused');\n});\n\nif (journeyId > 0) {\n    const delRes = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + journeyId,\n        method: \"DELETE\",\n        header: authHeader\n    });\n    pm.test(\"Cleanup deletes journey successfully\", function () {\n        pm.expect([200, 204, 404]).to.include(delRes.code);\n    });\n    pm.environment.unset(\"smooveApiJourneyIdToPause\");\n}"]}}],"id":"c2044176-3855-4199-a3b3-e170c1bfb280","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/:journeyId/pause","urlObject":{"path":["api","v1","business-journeys",":journeyId","pause"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiJourneyIdToPause}}","key":"journeyId"}]}},"response":[],"_postman_id":"c2044176-3855-4199-a3b3-e170c1bfb280"}],"id":"0b29a9d5-5530-4ae6-bf58-8b1ac4338a7a","_postman_id":"0b29a9d5-5530-4ae6-bf58-8b1ac4338a7a","description":""},{"name":"automation-context","item":[{"name":"Business Journeys Get Automation Context","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\",\n        apiKey: apiKey\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: \"Postman automation-context source \" + suffix,\n            name: \"postman-automation-context-src-\" + suffix,\n            targetValue: 100,\n            targetDate: future.toISOString(),\n            activate: false\n        })\n    }\n});\npm.expect(createRes.code, \"create journey status\").to.eql(201);\nconst createdId = Number(createRes.json().id);\npm.expect(createdId, \"created journey id\").to.be.above(0);\npm.environment.set(\"smooveApiJourneyIdForAutomationContext\", String(createdId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expectedId = Number(pm.environment.get(\"smooveApiJourneyIdForAutomationContext\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['businessJourneyId', 'currentStationKey', 'isDeleted', 'assets', 'missingRequiredStationKeys'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.businessJourneyId, 'businessJourneyId').to.be.a('number');\n    pm.expect(json.currentStationKey, 'currentStationKey').to.be.a('string');\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.assets, 'assets').to.be.an('array');\n    pm.expect(json.missingRequiredStationKeys, 'missingRequiredStationKeys').to.be.an('array');\n});\n\npm.test('Fresh journey still misses required station assets', function () {\n    const json = pm.response.json();\n    pm.expect(Number(json.businessJourneyId), 'businessJourneyId').to.eql(expectedId);\n    pm.expect(json.currentStationKey, 'currentStationKey').to.eql('List');\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n    pm.expect(json.missingRequiredStationKeys.length, 'missingRequiredStationKeys length').to.be.above(0);\n    pm.expect(json.missingRequiredStationKeys, 'missing List').to.include('List');\n    json.missingRequiredStationKeys.forEach(function (key) {\n        pm.expect(key, 'missingRequiredStationKeys item').to.be.a('string').and.not.equal('');\n    });\n    json.assets.forEach(function (asset) {\n        pm.expect(asset, 'asset').to.be.an('object');\n        pm.expect(asset.stationKey, 'asset.stationKey').to.be.a('string').and.not.equal('');\n        pm.expect(asset.stepNumber, 'asset.stepNumber').to.be.a('number');\n        pm.expect(asset.isCompleted, 'asset.isCompleted').to.be.a('boolean');\n    });\n});\n\nif (expectedId > 0) {\n    const delRes = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + expectedId,\n        method: \"DELETE\",\n        header: {\n            Accept: \"application/json\",\n            Cookie: \"jvlpsi=\" + cookie + \";\",\n            apiKey: apiKey\n        }\n    });\n    pm.test(\"Cleanup deletes journey successfully\", function () {\n        pm.expect([200, 204, 404]).to.include(delRes.code);\n    });\n    pm.environment.unset(\"smooveApiJourneyIdForAutomationContext\");\n}"]}}],"id":"c3933c9c-417f-4ed3-9d6d-b9371c43e8b7","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/:journeyId/automation-context","urlObject":{"path":["api","v1","business-journeys",":journeyId","automation-context"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiJourneyIdForAutomationContext}}","key":"journeyId"}]}},"response":[],"_postman_id":"c3933c9c-417f-4ed3-9d6d-b9371c43e8b7"}],"id":"b9e1f73e-600d-4ea1-b166-72b283d4a38a","_postman_id":"b9e1f73e-600d-4ea1-b166-72b283d4a38a","description":""},{"name":"automation-template","item":[{"name":"Business Journeys Create Automation Template","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction headers() {\n    return {\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\",\n        apiKey: apiKey\n    };\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\n\n// The API refuses to build an automation template until every required station asset is\n// connected and completed. Attach binds the asset; if the station is not auto-completed,\n// /complete finishes it. Build list -> landing page -> email in order.\nconst listName = \"postman-automation-template-list-\" + suffix;\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/lists\",\n    method: \"POST\",\n    header: headers(),\n    body: { mode: \"raw\", raw: JSON.stringify({ name: listName, description: \"temp list for automation template\" }) }\n});\npm.expect(listRes.code, \"create list status\").to.eql(200);\nconst listId = Number(listRes.json().id);\npm.expect(listId, \"created list id\").to.be.above(0);\npm.environment.set(\"smooveApiListIdForAutomationTemplate\", String(listId));\n\nconst landingPageName = \"Postman Automation Template LP \" + suffix;\nconst landingPageHtml =\n    \"<!DOCTYPE html><html><head><title>\" + landingPageName + \"</title></head><body>\" +\n    \"<form data-smoove-form=\\\"true\\\"><input type=\\\"email\\\" name=\\\"email\\\" />\" +\n    \"<button type=\\\"submit\\\">Send</button></form></body></html>\";\nconst lpRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration/save\",\n    method: \"POST\",\n    header: headers(),\n    body: { mode: \"raw\", raw: JSON.stringify({ id: 0, html: landingPageHtml, leadGenerationType: \"lp\", isDuplicate: false }) }\n});\npm.expect(lpRes.code, \"Smoove.Api create landing page status\").to.eql(200);\nconst landingPageId = Number(lpRes.json().id);\npm.expect(landingPageId, \"created landing page id\").to.be.above(0);\npm.environment.set(\"smooveApiLandingPageIdForAutomationTemplate\", String(landingPageId));\n\nconst emailName = \"Postman Automation Template Email \" + suffix;\nconst emailHtml =\n    \"<!DOCTYPE html><html><head><title>\" + emailName + \"</title></head>\" +\n    \"<body><p>Postman automation template email</p></body></html>\";\nconst emailRes = await send({\n    url: baseUrl + \"/api/v1/campaigns/save\",\n    method: \"POST\",\n    header: headers(),\n    body: { mode: \"raw\", raw: JSON.stringify({ id: 0, html: emailHtml, name: emailName, isDuplicate: false }) }\n});\npm.expect(emailRes.code, \"Smoove.Api create email status\").to.eql(200);\nconst emailId = Number(emailRes.json().id);\npm.expect(emailId, \"created email id\").to.be.above(0);\npm.environment.set(\"smooveApiEmailIdForAutomationTemplate\", String(emailId));\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: headers(),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: \"Postman automation-template source \" + suffix,\n            name: \"postman-automation-template-src-\" + suffix,\n            targetValue: 100,\n            targetDate: future.toISOString(),\n            activate: false\n        })\n    }\n});\npm.expect(createRes.code, \"create journey status\").to.eql(201);\nconst journeyId = Number(createRes.json().id);\npm.expect(journeyId, \"created journey id\").to.be.above(0);\npm.environment.set(\"smooveApiJourneyIdForAutomationTemplate\", String(journeyId));\n\nconst stations = [\n    { key: \"List\", stepNumber: 1, assetId: listId, assetName: listName },\n    { key: \"LandingPage\", stepNumber: 2, assetId: landingPageId, assetName: landingPageName },\n    { key: \"Email\", stepNumber: 3, assetId: emailId, assetName: emailName }\n];\nfor (const station of stations) {\n    const attachRes = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/stations/\" + station.key + \"/asset\",\n        method: \"PUT\",\n        header: headers(),\n        body: { mode: \"raw\", raw: JSON.stringify({ assetId: station.assetId, assetName: station.assetName, stepNumber: station.stepNumber }) }\n    });\n    pm.expect(attachRes.code, \"attach \" + station.key + \" asset status\").to.eql(200);\n    let attached = attachRes.json();\n    let attachedStation = ((attached && attached.stations) || []).find(function (s) {\n        return s && String(s.stationKey) === station.key;\n    });\n    pm.expect(attachedStation, station.key + \" station after attach\").to.be.an(\"object\");\n    pm.expect(Number(attachedStation.assetId), station.key + \" assetId after attach\").to.eql(Number(station.assetId));\n    // Attach may or may not auto-complete; finish via /complete when still open.\n    if (attachedStation.isCompleted !== true) {\n        const completeRes = await send({\n            url: baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/stations/\" + station.key + \"/complete\",\n            method: \"POST\",\n            header: headers(),\n            body: { mode: \"raw\", raw: JSON.stringify({ assetId: station.assetId, stepNumber: station.stepNumber }) }\n        });\n        pm.expect(completeRes.code, \"complete \" + station.key + \" status\").to.eql(200);\n        attached = completeRes.json();\n        attachedStation = ((attached && attached.stations) || []).find(function (s) {\n            return s && String(s.stationKey) === station.key;\n        });\n        pm.expect(attachedStation, station.key + \" station after complete\").to.be.an(\"object\");\n    }\n    pm.expect(attachedStation.isCompleted, station.key + \" isCompleted\").to.eql(true);\n}\n\nconst automationName = \"postman-automation-\" + suffix;\npm.environment.set(\"smooveApiAutomationNameForTemplate\", automationName);\npm.request.body.update(JSON.stringify({ automationName: automationName, language: \"en\" }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\nconst authHeader = {\n    \"Content-Type\": \"application/json\",\n    Accept: \"application/json\",\n    Cookie: \"jvlpsi=\" + cookie + \";\",\n    apiKey: apiKey\n};\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['businessJourneyId', 'automationId', 'automationKey', 'automationName', 'connectedAssets'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.businessJourneyId, 'businessJourneyId').to.be.a('number');\n    pm.expect(json.automationId, 'automationId').to.be.a('number');\n    pm.expect(json.automationKey, 'automationKey').to.be.a('string');\n    pm.expect(json.automationName, 'automationName').to.be.a('string');\n    pm.expect(json.connectedAssets, 'connectedAssets').to.be.an('array');\n});\n\npm.test('Response describes the created automation', function () {\n    const json = pm.response.json();\n    const expectedJourneyId = Number(pm.environment.get(\"smooveApiJourneyIdForAutomationTemplate\"));\n    const expectedName = pm.environment.get(\"smooveApiAutomationNameForTemplate\");\n    pm.expect(Number(json.businessJourneyId), 'businessJourneyId').to.eql(expectedJourneyId);\n    pm.expect(json.automationId, 'automationId').to.be.above(0);\n    pm.expect(json.automationKey, 'automationKey').to.not.equal('');\n    pm.expect(json.automationName, 'automationName').to.eql(expectedName);\n    pm.expect(json.connectedAssets.length, 'connectedAssets length').to.be.above(0);\n    const stationKeys = json.connectedAssets.map(function (a) { return String(a.stationKey); });\n    ['List', 'LandingPage', 'Email'].forEach(function (key) {\n        pm.expect(stationKeys, 'connectedAssets should include ' + key).to.include(key);\n    });\n    pm.environment.set(\"smooveApiAutomationIdForTemplate\", String(json.automationId));\n});\n\n// Cleanup, in dependency order: the journey must go first because the API refuses to delete\n// an automation while it is still attached to a business journey.\nconst automationId = Number(pm.environment.get(\"smooveApiAutomationIdForTemplate\") || 0);\nconst journeyId = Number(pm.environment.get(\"smooveApiJourneyIdForAutomationTemplate\") || 0);\nconst listId = Number(pm.environment.get(\"smooveApiListIdForAutomationTemplate\") || 0);\nconst landingPageId = Number(pm.environment.get(\"smooveApiLandingPageIdForAutomationTemplate\") || 0);\nconst emailId = Number(pm.environment.get(\"smooveApiEmailIdForAutomationTemplate\") || 0);\n\nconst cleanups = [];\nif (journeyId > 0) {\n    cleanups.push([\"journey\", await send({ url: baseUrl + \"/api/v1/business-journeys/\" + journeyId, method: \"DELETE\", header: authHeader })]);\n}\nif (automationId > 0) {\n    cleanups.push([\"automation\", await send({ url: baseUrl + \"/api/v1/bpmn\", method: \"DELETE\", header: authHeader, body: { mode: \"raw\", raw: JSON.stringify({ ids: [automationId] }) } })]);\n}\nif (listId > 0) {\n    cleanups.push([\"list\", await send({ url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\", method: \"DELETE\", header: authHeader })]);\n}\nif (landingPageId > 0) {\n    cleanups.push([\"landing page\", await send({ url: baseUrl + \"/api/v1/leadGeneration\", method: \"DELETE\", header: authHeader, body: { mode: \"raw\", raw: JSON.stringify({ ids: [landingPageId] }) } })]);\n}\nif (emailId > 0) {\n    cleanups.push([\"email\", await send({ url: baseUrl + \"/api/v1/campaigns\", method: \"DELETE\", header: authHeader, body: { mode: \"raw\", raw: JSON.stringify({ ids: [emailId] }) } })]);\n}\n\npm.test(\"Cleanup removes the automation, journey and its assets\", function () {\n    cleanups.forEach(function (entry) {\n        pm.expect([200, 201, 204], \"delete \" + entry[0]).to.include(entry[1].code);\n    });\n});\n\n[\"smooveApiAutomationIdForTemplate\", \"smooveApiAutomationNameForTemplate\", \"smooveApiJourneyIdForAutomationTemplate\",\n \"smooveApiListIdForAutomationTemplate\", \"smooveApiLandingPageIdForAutomationTemplate\", \"smooveApiEmailIdForAutomationTemplate\"\n].forEach(function (key) { pm.environment.unset(key); });"]}}],"id":"7e3616ad-cc3b-428f-9cf2-4f86eb1553b6","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"automationName\": \"postman-test-automation\",\n  \"language\": \"en\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/:journeyId/automation-template","urlObject":{"path":["api","v1","business-journeys",":journeyId","automation-template"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiJourneyIdForAutomationTemplate}}","key":"journeyId"}]}},"response":[],"_postman_id":"7e3616ad-cc3b-428f-9cf2-4f86eb1553b6"}],"id":"f5ff248a-4c83-4cc2-8ecf-35731fd6be9d","_postman_id":"f5ff248a-4c83-4cc2-8ecf-35731fd6be9d","description":""},{"name":"stations","item":[{"name":"{stationKey}","item":[{"name":"asset","item":[{"name":"Business Journeys Attach Station Asset","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction authHeader(extra) {\n    return Object.assign({\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\",\n        apiKey: apiKey\n    }, extra || {});\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\nconst listName = \"postman-journey-list-\" + suffix;\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/lists\",\n    method: \"POST\",\n    header: authHeader({ \"Content-Type\": \"application/json\" }),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            name: listName,\n            description: \"temp list for attach station asset\"\n        })\n    }\n});\npm.expect(listRes.code, \"create list status\").to.eql(200);\nconst listId = Number(listRes.json().id);\npm.expect(listId, \"created list id\").to.be.above(0);\npm.environment.set(\"smooveApiListIdForAttachAsset\", String(listId));\npm.environment.set(\"smooveApiListNameForAttachAsset\", listName);\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: authHeader({ \"Content-Type\": \"application/json\" }),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: \"Postman attach-asset source \" + suffix,\n            name: \"postman-attach-asset-src-\" + suffix,\n            targetValue: 100,\n            targetDate: future.toISOString(),\n            activate: false\n        })\n    }\n});\npm.expect(createRes.code, \"create journey status\").to.eql(201);\nconst journeyId = Number(createRes.json().id);\npm.expect(journeyId, \"created journey id\").to.be.above(0);\npm.environment.set(\"smooveApiJourneyIdForAttachAsset\", String(journeyId));\n\npm.request.body.update(JSON.stringify({\n    assetId: listId,\n    assetName: listName,\n    stepNumber: 1\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\nconst journeyId = Number(pm.environment.get(\"smooveApiJourneyIdForAttachAsset\") || 0);\nconst listId = Number(pm.environment.get(\"smooveApiListIdForAttachAsset\") || 0);\nconst listName = pm.environment.get(\"smooveApiListNameForAttachAsset\");\nconst authHeader = {\n    Accept: \"application/json\",\n    Cookie: \"jvlpsi=\" + cookie + \";\",\n    apiKey: apiKey\n};\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'siteId', 'journeyType', 'audienceState', 'status', 'title', 'name', 'targetValue', 'currentValue', 'targetDate', 'currentStationKey', 'currentStepNumber', 'automationKey', 'progressPercent', 'measurementMetric', 'stations', 'createdAt', 'updatedAt'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.stations, 'stations').to.be.an('array');\n});\n\n// Attach binds the asset; some environments also auto-complete the station. If not,\n// /complete with the same asset finishes the station so the shared end-state holds.\nlet journeyAfterAttach = pm.response.json();\nlet listStation = (journeyAfterAttach.stations || []).find(function (s) {\n    return s && String(s.stationKey) === \"List\";\n});\npm.test('List station has the attached asset', function () {\n    pm.expect(Number(journeyAfterAttach.id), 'id').to.eql(journeyId);\n    pm.expect(listStation, \"List station\").to.be.an('object');\n    pm.expect(Number(listStation.assetId), 'assetId').to.eql(listId);\n    pm.expect(listStation.assetName, 'assetName').to.eql(listName);\n    pm.expect(listStation.assetType, 'assetType').to.eql('list');\n});\n\nif (listStation && listStation.isCompleted !== true) {\n    const completeRes = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/stations/List/complete\",\n        method: \"POST\",\n        header: Object.assign({}, authHeader, { \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({ assetId: listId, stepNumber: 1 })\n        }\n    });\n    pm.test('List station complete after attach succeeds', function () {\n        pm.expect(completeRes.code, \"complete List status\").to.eql(200);\n    });\n    journeyAfterAttach = completeRes.json();\n    listStation = (journeyAfterAttach.stations || []).find(function (s) {\n        return s && String(s.stationKey) === \"List\";\n    });\n}\n\npm.test('List station is completed and journey advances', function () {\n    pm.expect(listStation, \"List station\").to.be.an('object');\n    pm.expect(listStation.isCompleted, 'List isCompleted').to.eql(true);\n    pm.expect(journeyAfterAttach.currentStationKey, 'currentStationKey advances past List').to.eql('LandingPage');\n});\n\nconst contextRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/automation-context\",\n    method: \"GET\",\n    header: authHeader\n});\n\npm.test('Automation context no longer misses List', function () {\n    pm.expect(contextRes.code, \"GET automation-context\").to.eql(200);\n    const json = contextRes.json();\n    pm.expect(json.missingRequiredStationKeys, 'missingRequiredStationKeys').to.be.an('array');\n    pm.expect(json.missingRequiredStationKeys, \"missingRequiredStationKeys should not include List\").to.not.include(\"List\");\n});\n\nlet delJourney = null;\nlet delList = null;\nif (journeyId > 0) {\n    delJourney = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + journeyId,\n        method: \"DELETE\",\n        header: authHeader\n    });\n    pm.environment.unset(\"smooveApiJourneyIdForAttachAsset\");\n}\nif (listId > 0) {\n    delList = await send({\n        url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\",\n        method: \"DELETE\",\n        header: authHeader\n    });\n    pm.environment.unset(\"smooveApiListIdForAttachAsset\");\n}\npm.environment.unset(\"smooveApiListNameForAttachAsset\");\n\npm.test(\"Cleanup deletes journey and list successfully\", function () {\n    if (delJourney) pm.expect([200, 204, 404]).to.include(delJourney.code);\n    if (delList) pm.expect([200, 204, 404]).to.include(delList.code);\n});"]}}],"id":"531f98b8-a0d2-4072-934a-ccc129094959","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"assetId\": 1,\n  \"assetName\": \"postman-test-asset\",\n  \"stepNumber\": 1\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/:journeyId/stations/:stationKey/asset","urlObject":{"path":["api","v1","business-journeys",":journeyId","stations",":stationKey","asset"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiJourneyIdForAttachAsset}}","key":"journeyId"},{"type":"any","value":"List","key":"stationKey"}]}},"response":[],"_postman_id":"531f98b8-a0d2-4072-934a-ccc129094959"}],"id":"6756de44-0f41-420d-84d2-4270f6432fc3","_postman_id":"6756de44-0f41-420d-84d2-4270f6432fc3","description":""},{"name":"complete","item":[{"name":"Business Journeys Complete Station","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction authHeader(extra) {\n    return Object.assign({\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\",\n        apiKey: apiKey\n    }, extra || {});\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/lists\",\n    method: \"POST\",\n    header: authHeader({ \"Content-Type\": \"application/json\" }),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            name: \"postman-complete-list-\" + suffix,\n            description: \"temp list for complete station\"\n        })\n    }\n});\npm.expect(listRes.code, \"create list status\").to.eql(200);\nconst listId = Number(listRes.json().id);\npm.expect(listId, \"created list id\").to.be.above(0);\npm.environment.set(\"smooveApiListIdForCompleteStation\", String(listId));\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: authHeader({ \"Content-Type\": \"application/json\" }),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: \"Postman complete-station source \" + suffix,\n            name: \"postman-complete-station-src-\" + suffix,\n            targetValue: 100,\n            targetDate: future.toISOString(),\n            activate: false\n        })\n    }\n});\npm.expect(createRes.code, \"create journey status\").to.eql(201);\nconst journeyId = Number(createRes.json().id);\npm.expect(journeyId, \"created journey id\").to.be.above(0);\npm.environment.set(\"smooveApiJourneyIdForCompleteStation\", String(journeyId));\n\n// Attaching an asset auto-completes the station. /complete still works when the asset\n// is supplied here without a prior attach — that is the contract this request covers.\npm.request.body.update(JSON.stringify({\n    assetId: listId,\n    stepNumber: 1\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\nconst journeyId = Number(pm.environment.get(\"smooveApiJourneyIdForCompleteStation\") || 0);\nconst listId = Number(pm.environment.get(\"smooveApiListIdForCompleteStation\") || 0);\nconst authHeader = {\n    Accept: \"application/json\",\n    Cookie: \"jvlpsi=\" + cookie + \";\",\n    apiKey: apiKey\n};\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'siteId', 'journeyType', 'audienceState', 'status', 'title', 'name', 'targetValue', 'currentValue', 'targetDate', 'currentStationKey', 'currentStepNumber', 'automationKey', 'progressPercent', 'measurementMetric', 'stations', 'createdAt', 'updatedAt'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.stations, 'stations').to.be.an('array');\n});\n\npm.test('List station is completed with the supplied asset', function () {\n    const json = pm.response.json();\n    pm.expect(Number(json.id), 'id').to.eql(journeyId);\n    const listStation = json.stations.find(function (s) {\n        return s && String(s.stationKey) === \"List\";\n    });\n    pm.expect(listStation, \"List station\").to.be.an('object');\n    pm.expect(listStation.isCompleted, 'List isCompleted').to.eql(true);\n    pm.expect(Number(listStation.assetId), 'assetId').to.eql(listId);\n});\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys/\" + journeyId,\n    method: \"GET\",\n    header: authHeader\n});\n\npm.test('Follow-up GET confirms List station is completed', function () {\n    pm.expect(getRes.code, \"GET journey after complete\").to.eql(200);\n    const json = getRes.json();\n    const listStation = (json.stations || []).find(function (s) {\n        return s && String(s.stationKey) === \"List\";\n    });\n    pm.expect(listStation, \"List station\").to.be.an('object');\n    pm.expect(listStation.isCompleted, \"List isCompleted\").to.eql(true);\n});\n\nlet delJourney = null;\nlet delList = null;\nif (journeyId > 0) {\n    delJourney = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + journeyId,\n        method: \"DELETE\",\n        header: authHeader\n    });\n    pm.environment.unset(\"smooveApiJourneyIdForCompleteStation\");\n}\nif (listId > 0) {\n    delList = await send({\n        url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\",\n        method: \"DELETE\",\n        header: authHeader\n    });\n    pm.environment.unset(\"smooveApiListIdForCompleteStation\");\n}\n\npm.test(\"Cleanup deletes journey and list successfully\", function () {\n    if (delJourney) pm.expect([200, 204, 404]).to.include(delJourney.code);\n    if (delList) pm.expect([200, 204, 404]).to.include(delList.code);\n});"]}}],"id":"1ded39a7-4876-4e47-bbe8-bc9c22a270bb","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"assetId\": 1,\n  \"stepNumber\": 1\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/:journeyId/stations/:stationKey/complete","urlObject":{"path":["api","v1","business-journeys",":journeyId","stations",":stationKey","complete"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiJourneyIdForCompleteStation}}","key":"journeyId"},{"type":"any","value":"List","key":"stationKey"}]}},"response":[],"_postman_id":"1ded39a7-4876-4e47-bbe8-bc9c22a270bb"}],"id":"0bd97970-9a52-45c1-8a8d-3a5a79c628c1","_postman_id":"0bd97970-9a52-45c1-8a8d-3a5a79c628c1","description":""}],"id":"44c1718b-b297-48dd-80b3-99fa5e8704a8","_postman_id":"44c1718b-b297-48dd-80b3-99fa5e8704a8","description":""}],"id":"4d9fe2a7-2c7e-4686-a7fa-6a7d414073e7","_postman_id":"4d9fe2a7-2c7e-4686-a7fa-6a7d414073e7","description":""},{"name":"Business Journeys Get By Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\nconst name = \"postman-get-by-id-\" + suffix;\nconst title = \"Postman Get By Id \" + suffix;\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\",\n        apiKey: apiKey\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: title,\n            name: name,\n            targetValue: 100,\n            targetDate: future.toISOString(),\n            activate: false\n        })\n    }\n});\npm.expect(createRes.code, \"create journey status\").to.eql(201);\nconst created = createRes.json();\nconst journeyId = Number(created.id);\npm.expect(journeyId, \"created journey id\").to.be.above(0);\npm.environment.set(\"smooveApiJourneyId\", String(journeyId));\npm.environment.set(\"smooveApiJourneyNameForGetById\", name);\npm.environment.set(\"smooveApiJourneyTitleForGetById\", title);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expectedId = Number(pm.environment.get(\"smooveApiJourneyId\"));\nconst expectedName = pm.environment.get(\"smooveApiJourneyNameForGetById\");\nconst expectedTitle = pm.environment.get(\"smooveApiJourneyTitleForGetById\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'siteId', 'journeyType', 'audienceState', 'status', 'title', 'name', 'targetValue', 'currentValue', 'targetDate', 'currentStationKey', 'currentStepNumber', 'automationKey', 'progressPercent', 'measurementMetric', 'stations', 'createdAt', 'updatedAt'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.siteId, 'siteId').to.be.a('number');\n    pm.expect(json.journeyType, 'journeyType').to.be.a('string');\n    pm.expect(json.audienceState, 'audienceState').to.be.a('number');\n    pm.expect(json.status, 'status').to.be.a('string');\n    pm.expect(json.title, 'title').to.be.a('string');\n    pm.expect(json.name, 'name').to.be.a('string');\n    pm.expect(json.targetValue, 'targetValue').to.be.a('number');\n    pm.expect(json.currentValue, 'currentValue').to.be.a('number');\n    pm.expect(json.targetDate, 'targetDate').to.be.a('string');\n    pm.expect(json.currentStationKey, 'currentStationKey').to.be.a('string');\n    pm.expect(json.currentStepNumber, 'currentStepNumber').to.be.a('number');\n    pm.expect(json.automationKey, 'automationKey').to.be.a('string');\n    pm.expect(json.progressPercent, 'progressPercent').to.be.a('number');\n    pm.expect(json.measurementMetric, 'measurementMetric').to.be.a('string');\n    pm.expect(json.stations, 'stations').to.be.an('array');\n    pm.expect(json.createdAt, 'createdAt').to.be.a('string');\n    pm.expect(json.updatedAt, 'updatedAt').to.be.a('string');\n});\n\npm.test('Journey identity matches the seeded request', function () {\n    const json = pm.response.json();\n    pm.expect(Number(json.id), 'id').to.eql(expectedId);\n    pm.expect(json.name, 'name').to.eql(expectedName);\n    pm.expect(json.title, 'title').to.eql(expectedTitle);\n    pm.expect(json.status, 'status').to.eql('draft');\n    pm.expect(json.currentStationKey, 'currentStationKey').to.not.equal('');\n    pm.expect(json.stations.length, 'stations length').to.be.above(0);\n    pm.environment.set(\"smooveApiJourneyStationKey\", String(json.currentStationKey));\n});\n\nif (expectedId > 0) {\n    const delRes = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + expectedId,\n        method: \"DELETE\",\n        header: {\n            Accept: \"application/json\",\n            Cookie: \"jvlpsi=\" + cookie + \";\",\n            apiKey: apiKey\n        }\n    });\n    pm.test(\"Cleanup deletes seeded journey successfully\", function () {\n        pm.expect([200, 204, 404]).to.include(delRes.code);\n    });\n}\npm.environment.unset(\"smooveApiJourneyNameForGetById\");\npm.environment.unset(\"smooveApiJourneyTitleForGetById\");"]}}],"id":"c12c80f5-73fc-42ff-aae9-0aa1602e60ad","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/:journeyId","urlObject":{"path":["api","v1","business-journeys",":journeyId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiJourneyId}}","key":"journeyId"}]}},"response":[],"_postman_id":"c12c80f5-73fc-42ff-aae9-0aa1602e60ad"},{"name":"Business Journeys Update","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\",\n        apiKey: apiKey\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: \"Postman update source \" + suffix,\n            name: \"postman-update-src-\" + suffix,\n            targetValue: 100,\n            targetDate: future.toISOString(),\n            activate: false\n        })\n    }\n});\npm.expect(createRes.code, \"create journey status\").to.eql(201);\nconst journeyId = Number(createRes.json().id);\npm.expect(journeyId, \"created journey id\").to.be.above(0);\npm.environment.set(\"smooveApiJourneyId\", String(journeyId));\n\nconst updateName = \"postman-updated-journey-\" + suffix;\nconst updateTitle = \"Postman updated journey \" + suffix;\nconst updateTargetValue = 150;\nconst updateTargetDate = future.toISOString();\npm.environment.set(\"smooveApiJourneyUpdateName\", updateName);\npm.environment.set(\"smooveApiJourneyUpdateTitle\", updateTitle);\npm.environment.set(\"smooveApiJourneyUpdateTargetValue\", String(updateTargetValue));\npm.request.body.update(JSON.stringify({\n    title: updateTitle,\n    name: updateName,\n    targetValue: updateTargetValue,\n    targetDate: updateTargetDate\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expectedId = Number(pm.environment.get(\"smooveApiJourneyId\"));\nconst expectedName = pm.environment.get(\"smooveApiJourneyUpdateName\");\nconst expectedTitle = pm.environment.get(\"smooveApiJourneyUpdateTitle\");\nconst expectedTargetValue = Number(pm.environment.get(\"smooveApiJourneyUpdateTargetValue\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'siteId', 'journeyType', 'audienceState', 'status', 'title', 'name', 'targetValue', 'currentValue', 'targetDate', 'currentStationKey', 'currentStepNumber', 'automationKey', 'progressPercent', 'measurementMetric', 'stations', 'createdAt', 'updatedAt'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.status, 'status').to.be.a('string');\n    pm.expect(json.title, 'title').to.be.a('string');\n    pm.expect(json.name, 'name').to.be.a('string');\n    pm.expect(json.targetValue, 'targetValue').to.be.a('number');\n    pm.expect(json.stations, 'stations').to.be.an('array');\n});\n\npm.test('Updated journey echoes request values', function () {\n    const json = pm.response.json();\n    pm.expect(Number(json.id), 'id').to.eql(expectedId);\n    pm.expect(json.name, 'name').to.eql(expectedName);\n    pm.expect(json.title, 'title').to.eql(expectedTitle);\n    pm.expect(json.targetValue, 'targetValue').to.eql(expectedTargetValue);\n});\n\nif (expectedId > 0) {\n    const delRes = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + expectedId,\n        method: \"DELETE\",\n        header: {\n            Accept: \"application/json\",\n            Cookie: \"jvlpsi=\" + cookie + \";\",\n            apiKey: apiKey\n        }\n    });\n    pm.test(\"Cleanup deletes seeded journey successfully\", function () {\n        pm.expect([200, 204, 404]).to.include(delRes.code);\n    });\n}\n[\"smooveApiJourneyUpdateName\", \"smooveApiJourneyUpdateTitle\", \"smooveApiJourneyUpdateTargetValue\"].forEach(function (k) {\n    pm.environment.unset(k);\n});"]}}],"id":"fe4f14ba-784e-4948-8223-5acecf6d8eb2","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"title\": \"Postman updated journey\",\n  \"name\": \"postman-updated-journey\",\n  \"targetValue\": 150,\n  \"targetDate\": \"2026-12-31T00:00:00Z\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/:journeyId","urlObject":{"path":["api","v1","business-journeys",":journeyId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiJourneyId}}","key":"journeyId"}]}},"response":[],"_postman_id":"fe4f14ba-784e-4948-8223-5acecf6d8eb2"},{"name":"Business Journeys Delete","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\",\n        apiKey: apiKey\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: \"Postman BJ Delete \" + suffix,\n            name: \"postman-bj-delete-\" + suffix,\n            targetValue: 100,\n            targetDate: future.toISOString(),\n            activate: false\n        })\n    }\n});\npm.expect([200, 201], \"create journey status\").to.include(createRes.code);\nconst created = createRes.json();\nconst journeyId = Number(created && (created.id || created.journeyId || created.businessJourneyId));\npm.expect(journeyId, \"created journey id\").to.be.above(0);\n\npm.environment.set(\"smooveApiJourneyIdToDelete\", String(journeyId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst deletedId = Number(pm.environment.get(\"smooveApiJourneyIdToDelete\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\nconst authHeader = {\n    Accept: \"application/json\",\n    Cookie: \"jvlpsi=\" + cookie + \";\",\n    apiKey: apiKey\n};\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys/\" + deletedId,\n    method: \"GET\",\n    header: authHeader\n});\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys?includeDeleted=false\",\n    method: \"GET\",\n    header: authHeader\n});\n\npm.test('Deleted journey is gone from live reads', function () {\n    pm.expect(getRes.code, 'GET by id after delete').to.eql(400);\n    let getJson = null;\n    try { getJson = getRes.json(); } catch (e) { getJson = null; }\n    pm.expect(getJson, 'delete error body').to.be.an('object');\n    pm.expect(String(getJson.message || ''), 'message').to.match(/deleted/i);\n\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    const journeys = listRes.json();\n    pm.expect(journeys, 'journeys').to.be.an('array');\n    const stillThere = journeys.some(function (j) { return Number(j.id) === deletedId; });\n    pm.expect(stillThere, 'journey still listed after delete').to.eql(false);\n});\n\npm.environment.unset(\"smooveApiJourneyIdToDelete\");"]}}],"id":"2b80bafc-6ece-42ea-8bcf-a85a2492a3dd","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/business-journeys/:journeyId","urlObject":{"path":["api","v1","business-journeys",":journeyId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiJourneyIdToDelete}}","key":"journeyId"}]}},"response":[],"_postman_id":"2b80bafc-6ece-42ea-8bcf-a85a2492a3dd"}],"id":"8115448f-568b-42b0-906d-68772f538991","_postman_id":"8115448f-568b-42b0-906d-68772f538991","description":""},{"name":"Business Journeys Create","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nlet body = {};\ntry { body = JSON.parse(pm.request.body.raw); } catch (e) { body = {}; }\nbody.businessJourneyDefinitionId = Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\"));\nbody.name = \"postman-test-journey-\" + suffix;\nbody.title = \"Postman test journey \" + suffix;\nbody.targetValue = 100;\nbody.activate = false;\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\nbody.targetDate = future.toISOString();\npm.environment.set(\"smooveApiJourneyCreateName\", body.name);\npm.environment.set(\"smooveApiJourneyCreateTitle\", body.title);\npm.environment.set(\"smooveApiJourneyCreateTargetValue\", String(body.targetValue));\npm.request.body.update(JSON.stringify(body));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expectedName = pm.environment.get(\"smooveApiJourneyCreateName\");\nconst expectedTitle = pm.environment.get(\"smooveApiJourneyCreateTitle\");\nconst expectedTargetValue = Number(pm.environment.get(\"smooveApiJourneyCreateTargetValue\"));\nconst expectedSiteId = Number(pm.environment.get(\"smooveApiSiteId\"));\n\npm.test('Status code is 201', function () {\n    pm.response.to.have.status(201);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'siteId', 'journeyType', 'audienceState', 'status', 'title', 'name', 'targetValue', 'currentValue', 'targetDate', 'currentStationKey', 'currentStepNumber', 'automationKey', 'progressPercent', 'measurementMetric', 'stations', 'createdAt', 'updatedAt'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.siteId, 'siteId').to.be.a('number');\n    pm.expect(json.journeyType, 'journeyType').to.be.a('string');\n    pm.expect(json.audienceState, 'audienceState').to.be.a('number');\n    pm.expect(json.status, 'status').to.be.a('string');\n    pm.expect(json.title, 'title').to.be.a('string');\n    pm.expect(json.name, 'name').to.be.a('string');\n    pm.expect(json.targetValue, 'targetValue').to.be.a('number');\n    pm.expect(json.currentValue, 'currentValue').to.be.a('number');\n    pm.expect(json.targetDate, 'targetDate').to.be.a('string');\n    pm.expect(json.currentStationKey, 'currentStationKey').to.be.a('string');\n    pm.expect(json.currentStepNumber, 'currentStepNumber').to.be.a('number');\n    pm.expect(json.automationKey, 'automationKey').to.be.a('string');\n    pm.expect(json.progressPercent, 'progressPercent').to.be.a('number');\n    pm.expect(json.measurementMetric, 'measurementMetric').to.be.a('string');\n    pm.expect(json.stations, 'stations').to.be.an('array');\n    pm.expect(json.createdAt, 'createdAt').to.be.a('string');\n    pm.expect(json.updatedAt, 'updatedAt').to.be.a('string');\n});\n\npm.test('Created journey echoes request and starts as draft', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.name, 'name').to.eql(expectedName);\n    pm.expect(json.title, 'title').to.eql(expectedTitle);\n    pm.expect(json.targetValue, 'targetValue').to.eql(expectedTargetValue);\n    pm.expect(json.status, 'status').to.eql('draft');\n    pm.expect(json.journeyType, 'journeyType').to.eql('generateNewLeads');\n    pm.expect(json.currentStationKey, 'currentStationKey').to.eql('List');\n    pm.expect(json.stations.length, 'stations length').to.be.above(0);\n    pm.expect(json.stations[0].stationKey, 'first stationKey').to.eql('List');\n    pm.expect(json.stations[0].isCompleted, 'List isCompleted').to.eql(false);\n    if (expectedSiteId > 0) {\n        pm.expect(json.siteId, 'siteId').to.eql(expectedSiteId);\n    }\n    pm.environment.set(\"smooveApiJourneyId\", String(json.id));\n    pm.environment.set(\"smooveApiJourneyStationKey\", String(json.currentStationKey));\n});\n\nconst journeyId = Number(pm.environment.get(\"smooveApiJourneyId\") || 0);\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\nif (journeyId > 0) {\n    const delRes = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + journeyId,\n        method: \"DELETE\",\n        header: {\n            Accept: \"application/json\",\n            Cookie: \"jvlpsi=\" + cookie + \";\",\n            apiKey: apiKey\n        }\n    });\n    pm.test(\"Cleanup deletes created journey successfully\", function () {\n        pm.expect([200, 204, 404]).to.include(delRes.code);\n    });\n}\n[\"smooveApiJourneyCreateName\", \"smooveApiJourneyCreateTitle\", \"smooveApiJourneyCreateTargetValue\"].forEach(function (k) {\n    pm.environment.unset(k);\n});"]}}],"id":"d4f53ba0-82ee-4bdf-bf7c-ebd530b80bb7","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"businessJourneyDefinitionId\": \"{{smooveApiBusinessJourneyDefinitionId}}\",\n  \"journeyType\": 1,\n  \"audienceState\": 0,\n  \"title\": \"Postman test journey\",\n  \"name\": \"postman-test-journey\",\n  \"targetValue\": 100,\n  \"targetDate\": \"2026-12-31T00:00:00Z\",\n  \"activate\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/business-journeys","urlObject":{"path":["api","v1","business-journeys"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d4f53ba0-82ee-4bdf-bf7c-ebd530b80bb7"},{"name":"Business Journeys Get All","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst future = new Date();\nfuture.setUTCFullYear(future.getUTCFullYear() + 1);\nconst name = \"postman-get-all-\" + suffix;\nconst title = \"Postman Get All \" + suffix;\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/business-journeys\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\",\n        apiKey: apiKey\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n            journeyType: 1,\n            audienceState: 0,\n            title: title,\n            name: name,\n            targetValue: 100,\n            targetDate: future.toISOString(),\n            activate: false\n        })\n    }\n});\npm.expect(createRes.code, \"create journey status\").to.eql(201);\nconst created = createRes.json();\npm.expect(created.id, \"created journey id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiJourneyIdForGetAll\", String(created.id));\npm.environment.set(\"smooveApiJourneyNameForGetAll\", name);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expectedId = Number(pm.environment.get(\"smooveApiJourneyIdForGetAll\"));\nconst expectedName = pm.environment.get(\"smooveApiJourneyNameForGetAll\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst apiKey = pm.environment.get(\"apiKey\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response schema is array of journeys', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'array length').to.be.above(0);\n    const sample = json[0];\n    // targetValue is omitted by the API when unset on older journeys — do not require it here.\n    ['id', 'siteId', 'journeyType', 'audienceState', 'status', 'title', 'name', 'currentValue', 'targetDate', 'currentStationKey', 'currentStepNumber', 'automationKey', 'progressPercent', 'measurementMetric', 'stations', 'createdAt', 'updatedAt'].forEach(function (key) {\n        pm.expect(sample, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(sample.id, 'id').to.be.a('number');\n    pm.expect(sample.status, 'status').to.be.a('string');\n    pm.expect(sample.name, 'name').to.be.a('string');\n    pm.expect(sample.stations, 'stations').to.be.an('array');\n});\n\npm.test('Seeded journey is present in the list', function () {\n    const json = pm.response.json();\n    const found = json.find(function (j) { return Number(j.id) === expectedId; });\n    pm.expect(found, 'seeded journey in list').to.be.an('object');\n    pm.expect(found.name, 'name').to.eql(expectedName);\n    pm.expect(found.status, 'status').to.eql('draft');\n    pm.expect(found.targetValue, 'seeded targetValue').to.eql(100);\n});\n\nif (expectedId > 0) {\n    const delRes = await send({\n        url: baseUrl + \"/api/v1/business-journeys/\" + expectedId,\n        method: \"DELETE\",\n        header: {\n            Accept: \"application/json\",\n            Cookie: \"jvlpsi=\" + cookie + \";\",\n            apiKey: apiKey\n        }\n    });\n    pm.test(\"Cleanup deletes seeded journey successfully\", function () {\n        pm.expect([200, 204, 404]).to.include(delRes.code);\n    });\n}\npm.environment.unset(\"smooveApiJourneyIdForGetAll\");\npm.environment.unset(\"smooveApiJourneyNameForGetAll\");"]}}],"id":"11c8c45c-0060-4a91-8f63-77fb3cddf235","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/business-journeys?includeDeleted=false","urlObject":{"path":["api","v1","business-journeys"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"includeDeleted","value":"false"}],"variable":[]}},"response":[],"_postman_id":"11c8c45c-0060-4a91-8f63-77fb3cddf235"}],"id":"65be87ed-a7f8-4c1e-b267-fe02b0f3a0fe","_postman_id":"65be87ed-a7f8-4c1e-b267-fe02b0f3a0fe","description":""},{"name":"campaigns","item":[{"name":"extended","item":[{"name":"Campaigns Get Campaigns Extended","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n    pm.expect(json, 'missing results').to.have.property('results');\n    pm.expect(json.results, 'results').to.be.an('array');\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.results.length, 'results length').to.be.at.least(1);\n    pm.expect(json.results.length, 'results within page').to.be.at.most(50);\n    pm.expect(json.rows, 'rows').to.be.at.least(json.results.length);\n});\n\npm.test('First result has all expected fields and types', function () {\n    const item = pm.response.json().results[0];\n    ['id', 'subject', 'status', 'sentDate', 'recipients', 'contentType', 'sentCount', 'bouncedCount', 'openedCount', 'clickedCount', 'snoozedCount', 'isAttachedToBusinessJourney', 'isUsedByActiveAutomation', 'openedRate', 'clickedRate', 'unknownCount'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number');\n    pm.expect(item.subject, 'subject').to.be.a('string');\n    pm.expect(item.status, 'status').to.be.a('string');\n    pm.expect(item.sentDate, 'sentDate').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.sentDate)), 'sentDate parseable').to.eql(false);\n    pm.expect(item.recipients, 'recipients').to.be.a('string');\n    pm.expect(item.contentType, 'contentType').to.be.a('string');\n    pm.expect(item.sentCount, 'sentCount').to.be.a('number');\n    pm.expect(item.bouncedCount, 'bouncedCount').to.be.a('number');\n    pm.expect(item.openedCount, 'openedCount').to.be.a('number');\n    pm.expect(item.clickedCount, 'clickedCount').to.be.a('number');\n    pm.expect(item.snoozedCount, 'snoozedCount').to.be.a('number');\n    pm.expect(item.isAttachedToBusinessJourney, 'isAttachedToBusinessJourney').to.be.a('boolean');\n    pm.expect(item.isUsedByActiveAutomation, 'isUsedByActiveAutomation').to.be.a('boolean');\n    pm.expect(item.openedRate, 'openedRate').to.be.a('number');\n    pm.expect(item.clickedRate, 'clickedRate').to.be.a('number');\n    pm.expect(item.unknownCount, 'unknownCount').to.be.a('number');\n});\n\npm.test('First extended campaign has real identity values', function () {\n    const item = pm.response.json().results[0];\n    pm.expect(item.id, 'id').to.be.above(0);\n    pm.expect(item.status, 'status').to.not.equal('');\n    pm.expect(item.contentType, 'contentType').to.not.equal('');\n    pm.expect(item.sentCount, 'sentCount').to.be.at.least(0);\n});"]}}],"id":"92eade5f-97c5-4998-b343-b4337a534886","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/campaigns/extended?IgnoreSiteId=true&IncludeStats=true&Page=1&PageSize=50","urlObject":{"path":["api","v1","campaigns","extended"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"IgnoreSiteId","value":"true"},{"key":"IncludeStats","value":"true"},{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"92eade5f-97c5-4998-b343-b4337a534886"}],"id":"5855d222-0a9b-4f96-8aa2-7d2b0cddba2b","_postman_id":"5855d222-0a9b-4f96-8aa2-7d2b0cddba2b","description":""},{"name":"{id}","item":[{"name":"Campaigns Get By Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nlet campaignId = Number(pm.environment.get(\"smooveApiCampaignId\") || 0);\nif (!(campaignId > 0)) {\n    const listRes = await send({\n        url: baseUrl + \"/api/v1/campaigns?Page=1&PageSize=1\",\n        method: \"GET\",\n        header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n    });\n    pm.expect(listRes.code, \"seed campaigns list\").to.eql(200);\n    campaignId = Number(listRes.json().results[0].id);\n    pm.environment.set(\"smooveApiCampaignId\", String(campaignId));\n}\n\npm.environment.set(\"smooveApiCampaignIdForGet\", String(campaignId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedId = Number(pm.environment.get(\"smooveApiCampaignIdForGet\") || pm.environment.get(\"smooveApiCampaignId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'subject', 'name', 'status', 'sentDate', 'recipients', 'contentType', 'bodyText', 'sentCount', 'bouncedCount', 'openedCount', 'clickedCount', 'snoozedCount', 'isAttachedToBusinessJourney', 'isUsedByActiveAutomation', 'openedRate', 'clickedRate', 'unknownCount'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.subject, 'subject').to.be.a('string');\n    pm.expect(json.name, 'name').to.be.a('string');\n    pm.expect(json.status, 'status').to.be.a('string');\n    pm.expect(json.sentDate, 'sentDate').to.be.a('string');\n    pm.expect(json.recipients, 'recipients').to.be.a('string');\n    pm.expect(json.contentType, 'contentType').to.be.a('string');\n    pm.expect(json.bodyText, 'bodyText').to.be.a('string');\n    pm.expect(json.sentCount, 'sentCount').to.be.a('number');\n    pm.expect(json.bouncedCount, 'bouncedCount').to.be.a('number');\n    pm.expect(json.openedCount, 'openedCount').to.be.a('number');\n    pm.expect(json.clickedCount, 'clickedCount').to.be.a('number');\n    pm.expect(json.snoozedCount, 'snoozedCount').to.be.a('number');\n    pm.expect(json.isAttachedToBusinessJourney, 'isAttachedToBusinessJourney').to.be.a('boolean');\n    pm.expect(json.isUsedByActiveAutomation, 'isUsedByActiveAutomation').to.be.a('boolean');\n    pm.expect(json.openedRate, 'openedRate').to.be.a('number');\n    pm.expect(json.clickedRate, 'clickedRate').to.be.a('number');\n    pm.expect(json.unknownCount, 'unknownCount').to.be.a('number');\n});\n\npm.test('Campaign id echoes the requested id', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.eql(expectedId);\n    pm.expect(json.status, 'status').to.not.equal('');\n    pm.expect(json.contentType, 'contentType').to.not.equal('');\n    pm.expect(json.bodyText, 'bodyText').to.not.equal('');\n    pm.expect(Number.isNaN(Date.parse(json.sentDate)), 'sentDate parseable').to.eql(false);\n});\n\npm.environment.unset(\"smooveApiCampaignIdForGet\");"]}}],"id":"0f6bf903-943e-42c9-b51f-0f8f2179b99b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/campaigns/:id","urlObject":{"path":["api","v1","campaigns",":id"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiCampaignId}}","key":"id"}]}},"response":[],"_postman_id":"0f6bf903-943e-42c9-b51f-0f8f2179b99b"}],"id":"11996c93-ac6f-4da8-8025-d52d32d9eb82","_postman_id":"11996c93-ac6f-4da8-8025-d52d32d9eb82","description":""},{"name":"slim","item":[{"name":"Campaigns Get Campaigns Slim","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n    pm.expect(json, 'missing results').to.have.property('results');\n    pm.expect(json.results, 'results').to.be.an('array');\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.results.length, 'results length').to.be.at.least(1);\n    pm.expect(json.results.length, 'results within page').to.be.at.most(50);\n    pm.expect(json.rows, 'rows').to.be.at.least(json.results.length);\n});\n\npm.test('First result has all expected fields and types', function () {\n    const item = pm.response.json().results[0];\n    ['id', 'subject'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number');\n    pm.expect(item.subject, 'subject').to.be.a('string');\n});\n\npm.test('First slim campaign has real identity values', function () {\n    const item = pm.response.json().results[0];\n    pm.expect(item.id, 'id').to.be.above(0);\n    pm.expect(Object.keys(item).sort(), 'slim keys').to.eql(['id', 'subject']);\n});"]}}],"id":"3717217a-00f4-4c41-9599-2243788f9507","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/campaigns/slim?IncludeStats=true&Page=1&PageSize=50","urlObject":{"path":["api","v1","campaigns","slim"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"IncludeStats","value":"true"},{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"3717217a-00f4-4c41-9599-2243788f9507"}],"id":"6a50dca6-a6b3-423c-96b3-fc4d6541be22","_postman_id":"6a50dca6-a6b3-423c-96b3-fc4d6541be22","description":""},{"name":"stats","item":[{"name":"Campaigns Get Campaigns Stats","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/campaigns?Page=1&PageSize=20&Status=sent&IncludeStats=true\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.expect(listRes.code, \"seed sent campaigns\").to.eql(200);\nconst sent = (listRes.json().results || []).find(function (c) { return Number(c.sentCount) > 0; }) || (listRes.json().results || [])[0];\npm.expect(sent, \"sent campaign for stats\").to.be.an(\"object\");\nconst campaignId = Number(sent.id);\npm.expect(campaignId, \"campaign id\").to.be.above(0);\npm.environment.set(\"smooveApiCampaignStatsId\", String(campaignId));\npm.environment.set(\"smooveApiCampaignStatsSentCount\", String(Number(sent.sentCount) || 0));\npm.request.body.update(JSON.stringify({ ids: [campaignId] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedId = Number(pm.environment.get(\"smooveApiCampaignStatsId\"));\nconst expectedSent = Number(pm.environment.get(\"smooveApiCampaignStatsSentCount\") || 0);\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'stats length').to.be.at.least(1);\n    const item = json.find(function (c) { return Number(c.id) === expectedId; }) || json[0];\n    ['id', 'sentCount', 'bouncedCount', 'openedCount', 'clickedCount', 'openedRate', 'clickedRate'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number');\n    pm.expect(item.sentCount, 'sentCount').to.be.a('number');\n    pm.expect(item.bouncedCount, 'bouncedCount').to.be.a('number');\n    pm.expect(item.openedCount, 'openedCount').to.be.a('number');\n    pm.expect(item.clickedCount, 'clickedCount').to.be.a('number');\n    pm.expect(item.openedRate, 'openedRate').to.be.a('number');\n    pm.expect(item.clickedRate, 'clickedRate').to.be.a('number');\n});\n\npm.test('Stats echo the requested campaign id', function () {\n    const json = pm.response.json();\n    const item = json.find(function (c) { return Number(c.id) === expectedId; }) || json[0];\n    pm.expect(item.id, 'id').to.eql(expectedId);\n    pm.expect(item.sentCount, 'sentCount').to.be.at.least(expectedSent > 0 ? 1 : 0);\n    pm.expect(item.bouncedCount, 'bouncedCount').to.be.at.least(0);\n    pm.expect(item.openedCount, 'openedCount').to.be.at.least(0);\n});\n\npm.environment.unset(\"smooveApiCampaignStatsId\");\npm.environment.unset(\"smooveApiCampaignStatsSentCount\");"]}}],"id":"498efcd3-e1ed-4990-a1eb-1bddb9b5d0f8","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/campaigns/stats","urlObject":{"path":["api","v1","campaigns","stats"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"498efcd3-e1ed-4990-a1eb-1bddb9b5d0f8"}],"id":"ff5f42e4-6c09-4fb6-9dad-44ce4b181dcc","_postman_id":"ff5f42e4-6c09-4fb6-9dad-44ce4b181dcc","description":""},{"name":"count","item":[{"name":"Campaigns Get Campaigns Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['active', 'deleted'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.active, 'active').to.be.a('number');\n    pm.expect(json.deleted, 'deleted').to.be.a('number');\n});\n\npm.test('Counts are non-negative integers', function () {\n    const json = pm.response.json();\n    ['active', 'deleted'].forEach(function (key) {\n        pm.expect(Number.isInteger(json[key]), key + ' integer').to.eql(true);\n        pm.expect(json[key], key).to.be.at.least(0);\n    });\n});"]}}],"id":"1220dda1-f4d0-415a-93dc-210e91d25ac0","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/campaigns/count?IgnoreSiteId=true&IncludeStats=true","urlObject":{"path":["api","v1","campaigns","count"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"IgnoreSiteId","value":"true"},{"key":"IncludeStats","value":"true"}],"variable":[]}},"response":[],"_postman_id":"1220dda1-f4d0-415a-93dc-210e91d25ac0"}],"id":"ca856be5-9187-4fe0-99f8-c72499c07c86","_postman_id":"ca856be5-9187-4fe0-99f8-c72499c07c86","description":""},{"name":"restore","item":[{"name":"Campaigns Restore","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst subject = \"Postman Campaign Restore \" + suffix;\n\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction headers() {\n    return {\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    };\n}\n\nconst html =\n    \"<!DOCTYPE html><html><head><title>\" + subject + \"</title></head>\" +\n    \"<body><p>Postman campaign restore</p></body></html>\";\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/campaigns/save\",\n    method: \"POST\",\n    header: headers(),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            id: 0,\n            html: html,\n            name: subject,\n            isDuplicate: false\n        })\n    }\n});\npm.expect(createRes.code, \"Smoove.Api create email status\").to.eql(200);\nconst campaignId = Number(createRes.json().id);\npm.expect(campaignId, \"created campaign id\").to.be.above(0);\n\nconst deleteRes = await send({\n    url: baseUrl + \"/api/v1/campaigns\",\n    method: \"DELETE\",\n    header: headers(),\n    body: { mode: \"raw\", raw: JSON.stringify({ ids: [campaignId] }) }\n});\npm.expect(deleteRes.code, \"soft-delete campaign status\").to.eql(200);\n\npm.environment.set(\"smooveApiCampaignIdToRestore\", String(campaignId));\npm.environment.set(\"smooveApiCampaignSubjectToRestore\", subject);\npm.request.body.update(JSON.stringify({ ids: [campaignId] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expectedId = Number(pm.environment.get(\"smooveApiCampaignIdToRestore\"));\nconst expectedSubject = pm.environment.get(\"smooveApiCampaignSubjectToRestore\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with restored campaign shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"array\");\n    pm.expect(json.length, \"restored campaigns length\").to.be.at.least(1);\n    const item = json.find(function (c) { return Number(c.id) === expectedId; }) || json[0];\n    ['id', 'subject', 'status'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, \"id\").to.be.a(\"number\");\n    pm.expect(item.subject, \"subject\").to.be.a(\"string\");\n    pm.expect(item.status, \"status\").to.be.a(\"string\");\n});\n\npm.test('Restored campaign echoes request and is saved', function () {\n    const json = pm.response.json();\n    const item = json.find(function (c) { return Number(c.id) === expectedId; }) || json[0];\n    pm.expect(item.id, \"id\").to.eql(expectedId);\n    pm.expect(item.subject, \"subject\").to.eql(expectedSubject);\n    pm.expect(String(item.status).toLowerCase(), \"status\").to.eql(\"saved\");\n});\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/campaigns/\" + expectedId,\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test('Follow-up GET shows campaign restored as saved', function () {\n    pm.expect(getRes.code, \"get-by-id status\").to.eql(200);\n    const json = getRes.json();\n    pm.expect(json.id, \"id\").to.eql(expectedId);\n    pm.expect(String(json.status).toLowerCase(), \"status\").to.eql(\"saved\");\n});\n\nconst cleanupRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/campaigns\",\n    method: \"DELETE\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    },\n    body: { mode: \"raw\", raw: JSON.stringify({ ids: [expectedId] }) }\n});\npm.test(\"Cleanup: restored campaign soft-deleted again\", function () {\n    pm.expect([200, 204]).to.include(cleanupRes.code);\n});\n\npm.environment.unset(\"smooveApiCampaignIdToRestore\");\npm.environment.unset(\"smooveApiCampaignSubjectToRestore\");"]}}],"id":"99591f7d-80d0-431a-a135-e018a8d6684e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/campaigns/restore","urlObject":{"path":["api","v1","campaigns","restore"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"99591f7d-80d0-431a-a135-e018a8d6684e"}],"id":"99cbab3a-1986-4531-87a7-7d9044c2efaa","_postman_id":"99cbab3a-1986-4531-87a7-7d9044c2efaa","description":""},{"name":"bouncedStatistics","item":[{"name":"Campaigns Get Bounced Statistics","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nlet campaignId = Number(pm.environment.get(\"smooveApiCampaignId\") || 0);\nif (!(campaignId > 0)) {\n    const listRes = await send({\n        url: baseUrl + \"/api/v1/campaigns?Page=1&PageSize=1&Status=sent\",\n        method: \"GET\",\n        header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n    });\n    campaignId = Number(listRes.json().results[0].id);\n}\npm.environment.set(\"smooveApiCampaignIdForBounce\", String(campaignId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n    pm.expect(json, 'missing results').to.have.property('results');\n    pm.expect(json.results, 'results').to.be.an('array');\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.results.length, 'results within page').to.be.at.most(json.size);\n    pm.expect(json.rows, 'rows').to.be.at.least(json.results.length);\n});\n\npm.test('Bounce result items have expected fields when present', function () {\n    const json = pm.response.json();\n    if (!json.results.length) {\n        pm.expect(Number(pm.environment.get(\"smooveApiCampaignIdForBounce\") || 0), 'queried campaign id').to.be.above(0);\n        return;\n    }\n    const item = json.results[0];\n    ['sent', 'hardBounce', 'softBounce', 'invalidAddress', 'bouncedRate', 'domain'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.sent, 'sent').to.be.a('number').and.at.least(0);\n    pm.expect(item.hardBounce, 'hardBounce').to.be.a('number').and.at.least(0);\n    pm.expect(item.softBounce, 'softBounce').to.be.a('number').and.at.least(0);\n    pm.expect(item.invalidAddress, 'invalidAddress').to.be.a('number').and.at.least(0);\n    pm.expect(item.bouncedRate, 'bouncedRate').to.be.a('number').and.at.least(0);\n    pm.expect(item.domain, 'domain').to.be.a('string').and.not.equal('');\n});\n\npm.environment.unset(\"smooveApiCampaignIdForBounce\");"]}}],"id":"8570a753-b024-422b-8e53-2f1bfbb1db23","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/campaigns/bouncedStatistics?CampaignId={{smooveApiCampaignIdForBounce}}&Page=1&PageSize=50","urlObject":{"path":["api","v1","campaigns","bouncedStatistics"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"CampaignId","value":"{{smooveApiCampaignIdForBounce}}"},{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"8570a753-b024-422b-8e53-2f1bfbb1db23"}],"id":"090c01f1-343c-42e4-a3a7-def942cae455","_postman_id":"090c01f1-343c-42e4-a3a7-def942cae455","description":""},{"name":"bpmn","item":[{"name":"stopped-transitions","item":[{"name":"Bpmn Get Stop Transitions","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\n// The admin API has no create-automation endpoint. A business journey builds one from a list,\n// a landing page and an email, so create all of them and keep the ids for the cleanup step.\nasync function createDisposableAutomation(label) {\n    const suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const future = new Date();\n    future.setUTCFullYear(future.getUTCFullYear() + 1);\n\n    const listName = \"postman_\" + label + \"_list_\" + suffix;\n    const listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: listName, description: \"temp\" });\n    pm.expect(listRes.code, \"create list\").to.eql(200);\n    const listId = listRes.json().id;\n    pm.environment.set(\"smooveApiBpmnSeedListId\", String(listId));\n\n    const landingPageRes = await call(\"POST\", baseUrl + \"/api/v1/leadGeneration/save\", {\n        id: 0,\n        html: \"<!DOCTYPE html><html><body><form data-smoove-form=\\\"true\\\"><input type=\\\"email\\\" name=\\\"email\\\" /><button type=\\\"submit\\\">Send</button></form></body></html>\",\n        leadGenerationType: \"lp\",\n        isDuplicate: false\n    });\n    pm.expect(landingPageRes.code, \"create landing page\").to.eql(200);\n    const landingPageId = Number(landingPageRes.json().id);\n    pm.environment.set(\"smooveApiBpmnSeedLandingPageId\", String(landingPageId));\n\n    const emailRes = await call(\"POST\", baseUrl + \"/api/v1/campaigns/save\", {\n        id: 0,\n        html: \"<!DOCTYPE html><html><body><p>Postman \" + label + \" email</p></body></html>\",\n        name: \"Postman \" + label + \" email\",\n        isDuplicate: false\n    });\n    pm.expect(emailRes.code, \"create email\").to.eql(200);\n    const emailId = Number(emailRes.json().id);\n    pm.environment.set(\"smooveApiBpmnSeedEmailId\", String(emailId));\n\n    const journeyRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys\", {\n        businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n        journeyType: 1,\n        audienceState: 0,\n        title: \"Postman bpmn-\" + label + \" source \" + suffix,\n        name: \"postman-bpmn-\" + label + \"-src-\" + suffix,\n        targetValue: 100,\n        targetDate: future.toISOString(),\n        activate: false\n    });\n    pm.expect(journeyRes.code, \"create journey\").to.eql(201);\n    const journeyId = Number(journeyRes.json().id);\n\n    const stations = [\n        { key: \"List\", stepNumber: 1, assetId: listId, assetName: listName },\n        { key: \"LandingPage\", stepNumber: 2, assetId: landingPageId, assetName: \"Postman LP \" + suffix },\n        { key: \"Email\", stepNumber: 3, assetId: emailId, assetName: \"Postman Email \" + suffix }\n    ];\n    for (const station of stations) {\n        const attachRes = await call(\"PUT\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/stations/\" + station.key + \"/asset\",\n            { assetId: station.assetId, assetName: station.assetName, stepNumber: station.stepNumber });\n        pm.expect(attachRes.code, \"attach \" + station.key).to.eql(200);\n        let journey = attachRes.json();\n        let attachedStation = ((journey && journey.stations) || []).find(function (s) {\n            return s && String(s.stationKey) === station.key;\n        });\n        pm.expect(attachedStation, station.key + \" after attach\").to.be.an(\"object\");\n        if (attachedStation.isCompleted !== true) {\n            const completeRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/stations/\" + station.key + \"/complete\",\n                { assetId: station.assetId, stepNumber: station.stepNumber });\n            pm.expect(completeRes.code, \"complete \" + station.key).to.eql(200);\n            journey = completeRes.json();\n            attachedStation = ((journey && journey.stations) || []).find(function (s) {\n                return s && String(s.stationKey) === station.key;\n            });\n            pm.expect(attachedStation, station.key + \" after complete\").to.be.an(\"object\");\n        }\n        pm.expect(attachedStation.isCompleted, station.key + \" isCompleted\").to.eql(true);\n    }\n\n    const automationName = \"postman-bpmn-\" + label + \"-\" + suffix;\n    const templateRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/automation-template\",\n        { automationName: automationName, language: \"en\" });\n    pm.expect(templateRes.code, \"create automation template\").to.eql(200);\n    const automationId = Number(templateRes.json().automationId);\n    pm.expect(automationId, \"automationId\").to.be.above(0);\n\n    // The journey must be detached before the automation can be soft-deleted.\n    const journeyDeleteRes = await call(\"DELETE\", baseUrl + \"/api/v1/business-journeys/\" + journeyId);\n    pm.expect(journeyDeleteRes.code, \"delete journey\").to.be.oneOf([200, 204]);\n\n    return { id: automationId, name: automationName };\n}\n\nconst automation = await createDisposableAutomation(\"stoptransitions\");\npm.environment.set(\"smooveApiBpmnStoppedTransitionsId\", String(automation.id));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\nasync function deleteBpmnSeeds() {\n    const listId = pm.environment.get(\"smooveApiBpmnSeedListId\");\n    const landingPageId = Number(pm.environment.get(\"smooveApiBpmnSeedLandingPageId\"));\n    const emailId = Number(pm.environment.get(\"smooveApiBpmnSeedEmailId\"));\n    return [\n        [\"automation\", await call(\"DELETE\", baseUrl + \"/api/v1/bpmn\", { ids: [Number(pm.environment.get(\"smooveApiBpmnStoppedTransitionsId\"))] })],\n        [\"list\", await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\")],\n        [\"landing page\", await call(\"DELETE\", baseUrl + \"/api/v1/leadGeneration\", { ids: [landingPageId] })],\n        [\"email\", await call(\"DELETE\", baseUrl + \"/api/v1/campaigns\", { ids: [emailId] })]\n    ];\n}\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n    pm.expect(json, 'missing results').to.have.property('results');\n    pm.expect(json.results, 'results').to.be.an('array');\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.results.length, 'results within page').to.be.at.most(50);\n    pm.expect(json.rows, 'rows').to.be.at.least(json.results.length);\n});\n\npm.test('Stopped-transition items have expected fields when present', function () {\n    const json = pm.response.json();\n    if (!json.results.length) {\n        pm.expect(Number(pm.environment.get(\"smooveApiBpmnStoppedTransitionsId\") || 0), 'queried bpmnId').to.be.above(0);\n        return;\n    }\n    const item = json.results[0];\n    ['id', 'bpmnId', 'contactId', 'blockedAt', 'bpmnName', 'email', 'cellPhone', 'firstname', 'lastname', 'elementId', 'elementName', 'elementType'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.bpmnId, 'bpmnId').to.be.a('number');\n    pm.expect(item.contactId, 'contactId').to.be.a('number');\n    pm.expect(item.blockedAt, 'blockedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.blockedAt)), 'blockedAt parseable').to.eql(false);\n    pm.expect(item.bpmnName, 'bpmnName').to.be.a('string');\n    pm.expect(item.email, 'email').to.be.a('string');\n    pm.expect(item.cellPhone, 'cellPhone').to.be.a('string');\n    pm.expect(item.firstname, 'firstname').to.be.a('string');\n    pm.expect(item.lastname, 'lastname').to.be.a('string');\n    pm.expect(item.elementId, 'elementId').to.be.a('string');\n    pm.expect(item.elementName, 'elementName').to.be.a('string');\n    pm.expect(item.elementType, 'elementType').to.be.a('string');\n});\n\npm.test('A new automation has no stopped transitions', function () {\n    const json = pm.response.json();\n    pm.expect(json.rows, 'rows').to.eql(0);\n    pm.expect(json.results, 'results').to.be.an('array').that.is.empty;\n});\n\nconst cleanup = await deleteBpmnSeeds();\npm.test(\"Cleanup: seeded automation, list, landing page and email deleted\", function () {\n    cleanup.forEach(function (entry) {\n        pm.expect(entry[1].code, \"delete \" + entry[0]).to.be.oneOf([200, 201, 204]);\n    });\n});\n[\"smooveApiBpmnStoppedTransitionsId\", \"smooveApiBpmnSeedListId\", \"smooveApiBpmnSeedLandingPageId\", \"smooveApiBpmnSeedEmailId\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"699b7bce-545b-4fc3-a1fc-93dfefa86c34","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/bpmn/stopped-transitions?bpmnId={{smooveApiBpmnStoppedTransitionsId}}&page=1&pageSize=50&sort=blockedAt&type=3","urlObject":{"path":["api","v1","bpmn","stopped-transitions"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"bpmnId","value":"{{smooveApiBpmnStoppedTransitionsId}}"},{"key":"page","value":"1"},{"key":"pageSize","value":"50"},{"key":"sort","value":"blockedAt"},{"key":"type","value":"3"}],"variable":[]}},"response":[],"_postman_id":"699b7bce-545b-4fc3-a1fc-93dfefa86c34"}],"id":"547e1106-6b7e-4e1c-97d4-45a8cb20e877","_postman_id":"547e1106-6b7e-4e1c-97d4-45a8cb20e877","description":""},{"name":"stop-actions","item":[{"name":"Bpmn Get Stop Contacts","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\n// The admin API has no create-automation endpoint. A business journey builds one from a list,\n// a landing page and an email, so create all of them and keep the ids for the cleanup step.\nasync function createDisposableAutomation(label) {\n    const suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const future = new Date();\n    future.setUTCFullYear(future.getUTCFullYear() + 1);\n\n    const listName = \"postman_\" + label + \"_list_\" + suffix;\n    const listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: listName, description: \"temp\" });\n    pm.expect(listRes.code, \"create list\").to.eql(200);\n    const listId = listRes.json().id;\n    pm.environment.set(\"smooveApiBpmnSeedListId\", String(listId));\n\n    const landingPageRes = await call(\"POST\", baseUrl + \"/api/v1/leadGeneration/save\", {\n        id: 0,\n        html: \"<!DOCTYPE html><html><body><form data-smoove-form=\\\"true\\\"><input type=\\\"email\\\" name=\\\"email\\\" /><button type=\\\"submit\\\">Send</button></form></body></html>\",\n        leadGenerationType: \"lp\",\n        isDuplicate: false\n    });\n    pm.expect(landingPageRes.code, \"create landing page\").to.eql(200);\n    const landingPageId = Number(landingPageRes.json().id);\n    pm.environment.set(\"smooveApiBpmnSeedLandingPageId\", String(landingPageId));\n\n    const emailRes = await call(\"POST\", baseUrl + \"/api/v1/campaigns/save\", {\n        id: 0,\n        html: \"<!DOCTYPE html><html><body><p>Postman \" + label + \" email</p></body></html>\",\n        name: \"Postman \" + label + \" email\",\n        isDuplicate: false\n    });\n    pm.expect(emailRes.code, \"create email\").to.eql(200);\n    const emailId = Number(emailRes.json().id);\n    pm.environment.set(\"smooveApiBpmnSeedEmailId\", String(emailId));\n\n    const journeyRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys\", {\n        businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n        journeyType: 1,\n        audienceState: 0,\n        title: \"Postman bpmn-\" + label + \" source \" + suffix,\n        name: \"postman-bpmn-\" + label + \"-src-\" + suffix,\n        targetValue: 100,\n        targetDate: future.toISOString(),\n        activate: false\n    });\n    pm.expect(journeyRes.code, \"create journey\").to.eql(201);\n    const journeyId = Number(journeyRes.json().id);\n\n    const stations = [\n        { key: \"List\", stepNumber: 1, assetId: listId, assetName: listName },\n        { key: \"LandingPage\", stepNumber: 2, assetId: landingPageId, assetName: \"Postman LP \" + suffix },\n        { key: \"Email\", stepNumber: 3, assetId: emailId, assetName: \"Postman Email \" + suffix }\n    ];\n    for (const station of stations) {\n        const attachRes = await call(\"PUT\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/stations/\" + station.key + \"/asset\",\n            { assetId: station.assetId, assetName: station.assetName, stepNumber: station.stepNumber });\n        pm.expect(attachRes.code, \"attach \" + station.key).to.eql(200);\n        let journey = attachRes.json();\n        let attachedStation = ((journey && journey.stations) || []).find(function (s) {\n            return s && String(s.stationKey) === station.key;\n        });\n        pm.expect(attachedStation, station.key + \" after attach\").to.be.an(\"object\");\n        if (attachedStation.isCompleted !== true) {\n            const completeRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/stations/\" + station.key + \"/complete\",\n                { assetId: station.assetId, stepNumber: station.stepNumber });\n            pm.expect(completeRes.code, \"complete \" + station.key).to.eql(200);\n            journey = completeRes.json();\n            attachedStation = ((journey && journey.stations) || []).find(function (s) {\n                return s && String(s.stationKey) === station.key;\n            });\n            pm.expect(attachedStation, station.key + \" after complete\").to.be.an(\"object\");\n        }\n        pm.expect(attachedStation.isCompleted, station.key + \" isCompleted\").to.eql(true);\n    }\n\n    const automationName = \"postman-bpmn-\" + label + \"-\" + suffix;\n    const templateRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/automation-template\",\n        { automationName: automationName, language: \"en\" });\n    pm.expect(templateRes.code, \"create automation template\").to.eql(200);\n    const automationId = Number(templateRes.json().automationId);\n    pm.expect(automationId, \"automationId\").to.be.above(0);\n\n    // The journey must be detached before the automation can be soft-deleted.\n    const journeyDeleteRes = await call(\"DELETE\", baseUrl + \"/api/v1/business-journeys/\" + journeyId);\n    pm.expect(journeyDeleteRes.code, \"delete journey\").to.be.oneOf([200, 204]);\n\n    return { id: automationId, name: automationName };\n}\n\nconst automation = await createDisposableAutomation(\"stopcontacts\");\npm.environment.set(\"smooveApiBpmnStopActionsId\", String(automation.id));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\nasync function deleteBpmnSeeds() {\n    const listId = pm.environment.get(\"smooveApiBpmnSeedListId\");\n    const landingPageId = Number(pm.environment.get(\"smooveApiBpmnSeedLandingPageId\"));\n    const emailId = Number(pm.environment.get(\"smooveApiBpmnSeedEmailId\"));\n    return [\n        [\"automation\", await call(\"DELETE\", baseUrl + \"/api/v1/bpmn\", { ids: [Number(pm.environment.get(\"smooveApiBpmnStopActionsId\"))] })],\n        [\"list\", await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\")],\n        [\"landing page\", await call(\"DELETE\", baseUrl + \"/api/v1/leadGeneration\", { ids: [landingPageId] })],\n        [\"email\", await call(\"DELETE\", baseUrl + \"/api/v1/campaigns\", { ids: [emailId] })]\n    ];\n}\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n    pm.expect(json, 'missing results').to.have.property('results');\n    pm.expect(json.results, 'results').to.be.an('array');\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.results.length, 'results within page').to.be.at.most(50);\n    pm.expect(json.rows, 'rows').to.be.at.least(json.results.length);\n});\n\npm.test('Stop-action items have expected fields when present', function () {\n    const json = pm.response.json();\n    if (!json.results.length) {\n        pm.expect(Number(pm.environment.get(\"smooveApiBpmnStopActionsId\") || 0), 'queried bpmnId').to.be.above(0);\n        return;\n    }\n    const item = json.results[0];\n    ['id', 'bpmnId', 'contactId', 'blockedAt', 'bpmnName', 'email', 'cellPhone', 'firstname', 'lastname'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.bpmnId, 'bpmnId').to.be.a('number');\n    pm.expect(item.contactId, 'contactId').to.be.a('number');\n    pm.expect(item.blockedAt, 'blockedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.blockedAt)), 'blockedAt parseable').to.eql(false);\n    pm.expect(item.bpmnName, 'bpmnName').to.be.a('string');\n    pm.expect(item.email, 'email').to.be.a('string');\n    pm.expect(item.cellPhone, 'cellPhone').to.be.a('string');\n    pm.expect(item.firstname, 'firstname').to.be.a('string');\n    pm.expect(item.lastname, 'lastname').to.be.a('string');\n});\n\npm.test('A new automation has no stopped contacts', function () {\n    const json = pm.response.json();\n    pm.expect(json.rows, 'rows').to.eql(0);\n    pm.expect(json.results, 'results').to.be.an('array').that.is.empty;\n});\n\nconst cleanup = await deleteBpmnSeeds();\npm.test(\"Cleanup: seeded automation, list, landing page and email deleted\", function () {\n    cleanup.forEach(function (entry) {\n        pm.expect(entry[1].code, \"delete \" + entry[0]).to.be.oneOf([200, 201, 204]);\n    });\n});\n[\"smooveApiBpmnStopActionsId\", \"smooveApiBpmnSeedListId\", \"smooveApiBpmnSeedLandingPageId\", \"smooveApiBpmnSeedEmailId\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"10aaa10a-7b83-4bb7-9216-42de1ebe6f8e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/bpmn/stop-actions?bpmnId={{smooveApiBpmnStopActionsId}}&page=1&pageSize=50&sort=blockedAt&status=2","urlObject":{"path":["api","v1","bpmn","stop-actions"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"bpmnId","value":"{{smooveApiBpmnStopActionsId}}"},{"key":"page","value":"1"},{"key":"pageSize","value":"50"},{"key":"sort","value":"blockedAt"},{"key":"status","value":"2"}],"variable":[]}},"response":[],"_postman_id":"10aaa10a-7b83-4bb7-9216-42de1ebe6f8e"}],"id":"f1dec679-8ec0-4590-b7f4-b6b8b7301b54","_postman_id":"f1dec679-8ec0-4590-b7f4-b6b8b7301b54","description":""},{"name":"deleted","item":[{"name":"Bpmn Get Deleted Bpmns","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n    pm.expect(json, 'missing results').to.have.property('results');\n    pm.expect(json.results, 'results').to.be.an('array');\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.results.length, 'results within page').to.be.at.most(50);\n    pm.expect(json.rows, 'rows').to.be.at.least(json.results.length);\n});\n\npm.test('First deleted bpmn has all expected fields when results exist', function () {\n    const json = pm.response.json();\n    if (!json.results.length) {\n        pm.expect(json.pages, 'pages when empty').to.eql(0);\n        return;\n    }\n    const item = json.results[0];\n    ['id', 'publishState', 'dateCreated', 'dateModified', 'name'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.publishState, 'publishState').to.be.oneOf(['deleted', 'draft', 'active', 'disabled']);\n    pm.expect(item.dateCreated, 'dateCreated').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.dateCreated)), 'dateCreated parseable').to.eql(false);\n    pm.expect(item.dateModified, 'dateModified').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.dateModified)), 'dateModified parseable').to.eql(false);\n    pm.expect(item.name, 'name').to.be.a('string');\n});"]}}],"id":"ccac643a-330f-4a3a-aa2e-a436a2bd8a3a","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/bpmn/deleted?Page=1&PageSize=50","urlObject":{"path":["api","v1","bpmn","deleted"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"ccac643a-330f-4a3a-aa2e-a436a2bd8a3a"}],"id":"c8e0100c-bb81-43e8-b6d2-1c044f543bb5","_postman_id":"c8e0100c-bb81-43e8-b6d2-1c044f543bb5","description":""},{"name":"count","item":[{"name":"Bpmn Get Bpmns Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const listRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/bpmn?Page=1&PageSize=1\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative integer count', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isInteger(value), 'integer').to.eql(true);\n    pm.expect(value, 'count').to.be.at.least(0);\n});\n\npm.test('Count equals the total rows of the bpmn list', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    pm.expect(pm.response.json(), 'count').to.eql(listRes.json().rows);\n});"]}}],"id":"f26cdd70-ffc3-4231-b520-9f56b7ce2908","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/bpmn/count","urlObject":{"path":["api","v1","bpmn","count"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f26cdd70-ffc3-4231-b520-9f56b7ce2908"}],"id":"8bf5c05c-25cc-4258-9e51-a233151c8b3b","_postman_id":"8bf5c05c-25cc-4258-9e51-a233151c8b3b","description":""},{"name":"deleted-count","item":[{"name":"Bpmn Get Deleted Bpmns Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const listRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/bpmn/deleted?Page=1&PageSize=1&PublishState=Deleted\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative integer count', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isInteger(value), 'integer').to.eql(true);\n    pm.expect(value, 'deleted-count').to.be.at.least(0);\n});\n\npm.test('Count equals the total rows of the deleted bpmn list', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    pm.expect(pm.response.json(), 'count').to.eql(listRes.json().rows);\n});"]}}],"id":"3ebefe79-d09e-4d0f-aa1a-48289f14ca64","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/bpmn/deleted-count","urlObject":{"path":["api","v1","bpmn","deleted-count"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3ebefe79-d09e-4d0f-aa1a-48289f14ca64"}],"id":"c0cbdea7-9006-43e7-a835-65fd277db001","_postman_id":"c0cbdea7-9006-43e7-a835-65fd277db001","description":""},{"name":"is-quota-reached","item":[{"name":"Bpmn Is Quota Reached","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a boolean', function () {\n    pm.expect(pm.response.json()).to.be.a('boolean');\n});\n\npm.test('Quota reached matches the expectation for this environment', function () {\n    pm.expect(pm.response.json(), 'is-quota-reached').to.eql(pm.environment.get('smooveApiExpectedBpmnQuotaReached') === 'true');\n});"]}}],"id":"9f485a2e-c680-4ced-9382-59560419b7b5","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/bpmn/is-quota-reached","urlObject":{"path":["api","v1","bpmn","is-quota-reached"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9f485a2e-c680-4ced-9382-59560419b7b5"}],"id":"21074069-4256-41c8-8969-ee38e0070ebd","_postman_id":"21074069-4256-41c8-8969-ee38e0070ebd","description":""},{"name":"{id}","item":[{"name":"restore","item":[{"name":"Bpmn Restore","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\n// The admin API has no create-automation endpoint. A business journey builds one from a list,\n// a landing page and an email, so create all of them and keep the ids for the cleanup step.\nasync function createDisposableAutomation(label) {\n    const suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const future = new Date();\n    future.setUTCFullYear(future.getUTCFullYear() + 1);\n\n    const listName = \"postman_\" + label + \"_list_\" + suffix;\n    const listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: listName, description: \"temp\" });\n    pm.expect(listRes.code, \"create list\").to.eql(200);\n    const listId = listRes.json().id;\n    pm.environment.set(\"smooveApiBpmnSeedListId\", String(listId));\n\n    const landingPageRes = await call(\"POST\", baseUrl + \"/api/v1/leadGeneration/save\", {\n        id: 0,\n        html: \"<!DOCTYPE html><html><body><form data-smoove-form=\\\"true\\\"><input type=\\\"email\\\" name=\\\"email\\\" /><button type=\\\"submit\\\">Send</button></form></body></html>\",\n        leadGenerationType: \"lp\",\n        isDuplicate: false\n    });\n    pm.expect(landingPageRes.code, \"create landing page\").to.eql(200);\n    const landingPageId = Number(landingPageRes.json().id);\n    pm.environment.set(\"smooveApiBpmnSeedLandingPageId\", String(landingPageId));\n\n    const emailRes = await call(\"POST\", baseUrl + \"/api/v1/campaigns/save\", {\n        id: 0,\n        html: \"<!DOCTYPE html><html><body><p>Postman \" + label + \" email</p></body></html>\",\n        name: \"Postman \" + label + \" email\",\n        isDuplicate: false\n    });\n    pm.expect(emailRes.code, \"create email\").to.eql(200);\n    const emailId = Number(emailRes.json().id);\n    pm.environment.set(\"smooveApiBpmnSeedEmailId\", String(emailId));\n\n    const journeyRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys\", {\n        businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n        journeyType: 1,\n        audienceState: 0,\n        title: \"Postman bpmn-\" + label + \" source \" + suffix,\n        name: \"postman-bpmn-\" + label + \"-src-\" + suffix,\n        targetValue: 100,\n        targetDate: future.toISOString(),\n        activate: false\n    });\n    pm.expect(journeyRes.code, \"create journey\").to.eql(201);\n    const journeyId = Number(journeyRes.json().id);\n\n    const stations = [\n        { key: \"List\", stepNumber: 1, assetId: listId, assetName: listName },\n        { key: \"LandingPage\", stepNumber: 2, assetId: landingPageId, assetName: \"Postman LP \" + suffix },\n        { key: \"Email\", stepNumber: 3, assetId: emailId, assetName: \"Postman Email \" + suffix }\n    ];\n    for (const station of stations) {\n        const attachRes = await call(\"PUT\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/stations/\" + station.key + \"/asset\",\n            { assetId: station.assetId, assetName: station.assetName, stepNumber: station.stepNumber });\n        pm.expect(attachRes.code, \"attach \" + station.key).to.eql(200);\n        let journey = attachRes.json();\n        let attachedStation = ((journey && journey.stations) || []).find(function (s) {\n            return s && String(s.stationKey) === station.key;\n        });\n        pm.expect(attachedStation, station.key + \" after attach\").to.be.an(\"object\");\n        if (attachedStation.isCompleted !== true) {\n            const completeRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/stations/\" + station.key + \"/complete\",\n                { assetId: station.assetId, stepNumber: station.stepNumber });\n            pm.expect(completeRes.code, \"complete \" + station.key).to.eql(200);\n            journey = completeRes.json();\n            attachedStation = ((journey && journey.stations) || []).find(function (s) {\n                return s && String(s.stationKey) === station.key;\n            });\n            pm.expect(attachedStation, station.key + \" after complete\").to.be.an(\"object\");\n        }\n        pm.expect(attachedStation.isCompleted, station.key + \" isCompleted\").to.eql(true);\n    }\n\n    const automationName = \"postman-bpmn-\" + label + \"-\" + suffix;\n    const templateRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/automation-template\",\n        { automationName: automationName, language: \"en\" });\n    pm.expect(templateRes.code, \"create automation template\").to.eql(200);\n    const automationId = Number(templateRes.json().automationId);\n    pm.expect(automationId, \"automationId\").to.be.above(0);\n\n    // The journey must be detached before the automation can be soft-deleted.\n    const journeyDeleteRes = await call(\"DELETE\", baseUrl + \"/api/v1/business-journeys/\" + journeyId);\n    pm.expect(journeyDeleteRes.code, \"delete journey\").to.be.oneOf([200, 204]);\n\n    return { id: automationId, name: automationName };\n}\n\nconst automation = await createDisposableAutomation(\"restore\");\n\n// Soft-delete the seeded automation so restore has a real target.\nconst deleteRes = await call(\"DELETE\", baseUrl + \"/api/v1/bpmn\", { ids: [automation.id] });\npm.expect(deleteRes.code, \"soft-delete seeded automation\").to.be.oneOf([200, 201, 204]);\n\npm.environment.set(\"smooveApiBpmnIdToRestore\", String(automation.id));\npm.environment.set(\"smooveApiBpmnNameToRestore\", automation.name);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\nasync function cleanupSeedAssets() {\n    const listId = pm.environment.get(\"smooveApiBpmnSeedListId\");\n    const landingPageId = Number(pm.environment.get(\"smooveApiBpmnSeedLandingPageId\"));\n    const emailId = Number(pm.environment.get(\"smooveApiBpmnSeedEmailId\"));\n    return [\n        [\"list\", await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\")],\n        [\"landing page\", await call(\"DELETE\", baseUrl + \"/api/v1/leadGeneration\", { ids: [landingPageId] })],\n        [\"email\", await call(\"DELETE\", baseUrl + \"/api/v1/campaigns\", { ids: [emailId] })]\n    ];\n}\nfunction clearSeedVariables() {\n    [\"smooveApiBpmnSeedListId\", \"smooveApiBpmnSeedLandingPageId\", \"smooveApiBpmnSeedEmailId\"].forEach(function (k) {\n        pm.environment.unset(k);\n    });\n}\n\nconst bpmnId = Number(pm.environment.get(\"smooveApiBpmnIdToRestore\"));\nconst expectedName = pm.environment.get(\"smooveApiBpmnNameToRestore\");\n\n// Cleanup: soft-delete the restored automation again, then remove the assets it was built from.\nconst redeleteRes = await call(\"DELETE\", baseUrl + \"/api/v1/bpmn\", { ids: [bpmnId] });\nconst cleanup = await cleanupSeedAssets();\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'publishState', 'dateCreated', 'dateModified', 'name'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.publishState, 'publishState').to.be.oneOf(['deleted', 'draft', 'active', 'disabled']);\n    pm.expect(json.dateCreated, 'dateCreated').to.be.a('string');\n    pm.expect(json.dateModified, 'dateModified').to.be.a('string');\n    pm.expect(json.name, 'name').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.dateCreated)), 'dateCreated parseable').to.eql(false);\n    pm.expect(Number.isNaN(Date.parse(json.dateModified)), 'dateModified parseable').to.eql(false);\n});\n\npm.test('Restored bpmn echoes the seeded id and name', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.eql(bpmnId);\n    pm.expect(json.name, 'name').to.eql(expectedName);\n});\n\npm.test('Cleanup: restored bpmn soft-deleted again and seed assets removed', function () {\n    pm.expect(redeleteRes.code, 'soft-delete status').to.be.oneOf([200, 201, 204]);\n    cleanup.forEach(function (entry) {\n        pm.expect(entry[1].code, 'delete ' + entry[0]).to.be.oneOf([200, 201, 204]);\n    });\n});\n\nclearSeedVariables();\n[\"smooveApiBpmnIdToRestore\", \"smooveApiBpmnNameToRestore\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"422528d3-81ea-45bc-a825-7a575c2e00b0","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/bpmn/:id/restore","urlObject":{"path":["api","v1","bpmn",":id","restore"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiBpmnIdToRestore}}","key":"id"}]}},"response":[],"_postman_id":"422528d3-81ea-45bc-a825-7a575c2e00b0"}],"id":"e2c4e28a-3d30-4c6f-a611-052839dd68bd","_postman_id":"e2c4e28a-3d30-4c6f-a611-052839dd68bd","description":""}],"id":"bae3d6e2-1208-4e36-beb3-5018f55c253d","_postman_id":"bae3d6e2-1208-4e36-beb3-5018f55c253d","description":""},{"name":"Bpmn Get Bpmns","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n    pm.expect(json, 'missing results').to.have.property('results');\n    pm.expect(json.results, 'results').to.be.an('array');\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.results.length, 'results within page').to.be.at.most(50);\n    pm.expect(json.rows, 'rows').to.be.at.least(json.results.length);\n});\n\npm.test('First bpmn has all expected fields when results exist', function () {\n    const json = pm.response.json();\n    if (!json.results.length) {\n        pm.expect(json.rows, 'rows when empty').to.eql(0);\n        return;\n    }\n    const item = json.results[0];\n    ['id', 'publishState', 'dateCreated', 'dateModified', 'name'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.publishState, 'publishState').to.be.oneOf(['deleted', 'draft', 'active', 'disabled']);\n    pm.expect(item.dateCreated, 'dateCreated').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.dateCreated)), 'dateCreated parseable').to.eql(false);\n    pm.expect(item.dateModified, 'dateModified').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.dateModified)), 'dateModified parseable').to.eql(false);\n    pm.expect(item.name, 'name').to.be.a('string');\n});"]}}],"id":"b8b529bc-986a-45cc-9632-1a3d3f88f82b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/bpmn?Page=1&PageSize=50","urlObject":{"path":["api","v1","bpmn"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"b8b529bc-986a-45cc-9632-1a3d3f88f82b"},{"name":"Bpmn Delete Bpmns","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\n// The admin API has no create-automation endpoint. A business journey builds one from a list,\n// a landing page and an email, so create all of them and keep the ids for the cleanup step.\nasync function createDisposableAutomation(label) {\n    const suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const future = new Date();\n    future.setUTCFullYear(future.getUTCFullYear() + 1);\n\n    const listName = \"postman_\" + label + \"_list_\" + suffix;\n    const listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: listName, description: \"temp\" });\n    pm.expect(listRes.code, \"create list\").to.eql(200);\n    const listId = listRes.json().id;\n    pm.environment.set(\"smooveApiBpmnSeedListId\", String(listId));\n\n    const landingPageRes = await call(\"POST\", baseUrl + \"/api/v1/leadGeneration/save\", {\n        id: 0,\n        html: \"<!DOCTYPE html><html><body><form data-smoove-form=\\\"true\\\"><input type=\\\"email\\\" name=\\\"email\\\" /><button type=\\\"submit\\\">Send</button></form></body></html>\",\n        leadGenerationType: \"lp\",\n        isDuplicate: false\n    });\n    pm.expect(landingPageRes.code, \"create landing page\").to.eql(200);\n    const landingPageId = Number(landingPageRes.json().id);\n    pm.environment.set(\"smooveApiBpmnSeedLandingPageId\", String(landingPageId));\n\n    const emailRes = await call(\"POST\", baseUrl + \"/api/v1/campaigns/save\", {\n        id: 0,\n        html: \"<!DOCTYPE html><html><body><p>Postman \" + label + \" email</p></body></html>\",\n        name: \"Postman \" + label + \" email\",\n        isDuplicate: false\n    });\n    pm.expect(emailRes.code, \"create email\").to.eql(200);\n    const emailId = Number(emailRes.json().id);\n    pm.environment.set(\"smooveApiBpmnSeedEmailId\", String(emailId));\n\n    const journeyRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys\", {\n        businessJourneyDefinitionId: Number(pm.environment.get(\"smooveApiBusinessJourneyDefinitionId\")),\n        journeyType: 1,\n        audienceState: 0,\n        title: \"Postman bpmn-\" + label + \" source \" + suffix,\n        name: \"postman-bpmn-\" + label + \"-src-\" + suffix,\n        targetValue: 100,\n        targetDate: future.toISOString(),\n        activate: false\n    });\n    pm.expect(journeyRes.code, \"create journey\").to.eql(201);\n    const journeyId = Number(journeyRes.json().id);\n\n    const stations = [\n        { key: \"List\", stepNumber: 1, assetId: listId, assetName: listName },\n        { key: \"LandingPage\", stepNumber: 2, assetId: landingPageId, assetName: \"Postman LP \" + suffix },\n        { key: \"Email\", stepNumber: 3, assetId: emailId, assetName: \"Postman Email \" + suffix }\n    ];\n    for (const station of stations) {\n        const attachRes = await call(\"PUT\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/stations/\" + station.key + \"/asset\",\n            { assetId: station.assetId, assetName: station.assetName, stepNumber: station.stepNumber });\n        pm.expect(attachRes.code, \"attach \" + station.key).to.eql(200);\n        let journey = attachRes.json();\n        let attachedStation = ((journey && journey.stations) || []).find(function (s) {\n            return s && String(s.stationKey) === station.key;\n        });\n        pm.expect(attachedStation, station.key + \" after attach\").to.be.an(\"object\");\n        if (attachedStation.isCompleted !== true) {\n            const completeRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/stations/\" + station.key + \"/complete\",\n                { assetId: station.assetId, stepNumber: station.stepNumber });\n            pm.expect(completeRes.code, \"complete \" + station.key).to.eql(200);\n            journey = completeRes.json();\n            attachedStation = ((journey && journey.stations) || []).find(function (s) {\n                return s && String(s.stationKey) === station.key;\n            });\n            pm.expect(attachedStation, station.key + \" after complete\").to.be.an(\"object\");\n        }\n        pm.expect(attachedStation.isCompleted, station.key + \" isCompleted\").to.eql(true);\n    }\n\n    const automationName = \"postman-bpmn-\" + label + \"-\" + suffix;\n    const templateRes = await call(\"POST\", baseUrl + \"/api/v1/business-journeys/\" + journeyId + \"/automation-template\",\n        { automationName: automationName, language: \"en\" });\n    pm.expect(templateRes.code, \"create automation template\").to.eql(200);\n    const automationId = Number(templateRes.json().automationId);\n    pm.expect(automationId, \"automationId\").to.be.above(0);\n\n    // The journey must be detached before the automation can be soft-deleted.\n    const journeyDeleteRes = await call(\"DELETE\", baseUrl + \"/api/v1/business-journeys/\" + journeyId);\n    pm.expect(journeyDeleteRes.code, \"delete journey\").to.be.oneOf([200, 204]);\n\n    return { id: automationId, name: automationName };\n}\n\nconst automation = await createDisposableAutomation(\"delete\");\npm.environment.set(\"smooveApiBpmnIdToDelete\", String(automation.id));\npm.environment.set(\"smooveApiBpmnNameToDelete\", automation.name);\n\npm.request.body.update(JSON.stringify({ ids: [automation.id] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\nasync function cleanupSeedAssets() {\n    const listId = pm.environment.get(\"smooveApiBpmnSeedListId\");\n    const landingPageId = Number(pm.environment.get(\"smooveApiBpmnSeedLandingPageId\"));\n    const emailId = Number(pm.environment.get(\"smooveApiBpmnSeedEmailId\"));\n    return [\n        [\"list\", await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\")],\n        [\"landing page\", await call(\"DELETE\", baseUrl + \"/api/v1/leadGeneration\", { ids: [landingPageId] })],\n        [\"email\", await call(\"DELETE\", baseUrl + \"/api/v1/campaigns\", { ids: [emailId] })]\n    ];\n}\nfunction clearSeedVariables() {\n    [\"smooveApiBpmnSeedListId\", \"smooveApiBpmnSeedLandingPageId\", \"smooveApiBpmnSeedEmailId\"].forEach(function (k) {\n        pm.environment.unset(k);\n    });\n}\n\nconst bpmnId = Number(pm.environment.get(\"smooveApiBpmnIdToDelete\"));\nconst liveRes = await call(\"GET\", baseUrl + \"/api/v1/bpmn?Page=1&PageSize=100&IsDeleted=false\");\nconst cleanup = await cleanupSeedAssets();\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    pm.expect(pm.response.text().trim(), 'body').to.eql('');\n});\n\npm.test('Delete targeted the seeded bpmn id', function () {\n    pm.expect(bpmnId, 'bpmn id').to.be.above(0);\n});\n\npm.test('Follow-up list no longer includes the deleted bpmn', function () {\n    pm.expect(liveRes.code, 'live list status').to.eql(200);\n    const stillThere = (liveRes.json().results || []).some(function (item) { return item.id === bpmnId; });\n    pm.expect(stillThere, 'bpmn still live after delete').to.eql(false);\n});\n\npm.test('Cleanup: seeded list, landing page and email deleted', function () {\n    cleanup.forEach(function (entry) {\n        pm.expect(entry[1].code, 'delete ' + entry[0]).to.be.oneOf([200, 201, 204]);\n    });\n});\n\nclearSeedVariables();\n[\"smooveApiBpmnIdToDelete\", \"smooveApiBpmnNameToDelete\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"b733c394-b1c6-494e-a465-e1d6195a6e68","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/bpmn","urlObject":{"path":["api","v1","bpmn"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"b733c394-b1c6-494e-a465-e1d6195a6e68"}],"id":"7e6b3bde-171a-407e-be93-d21f5625345c","_postman_id":"7e6b3bde-171a-407e-be93-d21f5625345c","description":""},{"name":"links","item":[{"name":"Campaigns Get Mail Links","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst mailId = Number(pm.environment.get(\"smooveApiMailIdForLinks\"));\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: \"jvlpsi=\" + cookie + \";\"\n});\n\npm.expect(mailId, \"smooveApiMailIdForLinks\").to.be.a(\"number\").and.above(0);\n\n// Approve the configured mail has links — no discovery / other mail ids.\nconst linksRes = await new Promise(function (resolve, reject) {\n    pm.sendRequest({\n        url: baseUrl + \"/api/v1/campaigns/links?mailId=\" + mailId,\n        method: \"GET\",\n        header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n    }, function (err, res) {\n        if (err) reject(err);\n        else resolve(res);\n    });\n});\npm.expect(linksRes.code, \"approve mail links status\").to.eql(200);\nconst body = linksRes.json();\npm.expect(body, \"approve mail links body\").to.be.an(\"array\");\npm.expect(body.length, \"smooveApiMailIdForLinks must have links\").to.be.at.least(1);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedMailId = Number(pm.environment.get(\"smooveApiMailIdForLinks\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'links length').to.be.at.least(1);\n    const item = json[0];\n    ['linkId', 'linkClicks', 'linkUrl', 'linkTitle'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.linkId, 'linkId').to.be.a('number');\n    pm.expect(item.linkClicks, 'linkClicks').to.be.a('number');\n    pm.expect(item.linkUrl, 'linkUrl').to.be.a('string');\n    pm.expect(item.linkTitle, 'linkTitle').to.be.a('string');\n});\n\npm.test('Links have real click and url values', function () {\n    const json = pm.response.json();\n    const item = json[0];\n    pm.expect(item.linkId, 'linkId').to.be.above(0);\n    pm.expect(item.linkUrl, 'linkUrl').to.not.equal('');\n    pm.expect(item.linkClicks, 'linkClicks').to.be.at.least(0);\n    pm.expect(expectedMailId, 'smooveApiMailIdForLinks').to.be.above(0);\n});"]}}],"id":"2b1e9a14-f119-441b-bd42-3a2ed143ec01","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/campaigns/links?mailId={{smooveApiMailIdForLinks}}","urlObject":{"path":["api","v1","campaigns","links"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"mailId","value":"{{smooveApiMailIdForLinks}}"}],"variable":[]}},"response":[],"_postman_id":"2b1e9a14-f119-441b-bd42-3a2ed143ec01"}],"id":"efe9a389-68e7-48f1-b765-c6be63e4a21f","_postman_id":"efe9a389-68e7-48f1-b765-c6be63e4a21f","description":""},{"name":"update-scheduled-campaign","item":[{"name":"Campaigns Update Scheduled Campaign","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst scheduledTime = \"2099-06-15T10:30:00.000Z\";\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst subject = \"Postman UpdateScheduled \" + suffix;\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst html =\n    \"<!DOCTYPE html><html><head><title>\" + subject + \"</title></head>\" +\n    \"<body><p>Postman update scheduled campaign</p></body></html>\";\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/campaigns/save\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            id: 0,\n            html: html,\n            name: subject,\n            isDuplicate: false\n        })\n    }\n});\npm.expect(createRes.code, \"Smoove.Api create email status\").to.eql(200);\nconst campaignId = Number(createRes.json().id);\npm.expect(campaignId, \"created campaign id\").to.be.above(0);\n\npm.environment.set(\"smooveApiCampaignIdToSchedule\", String(campaignId));\npm.environment.set(\"smooveApiCampaignScheduledTime\", scheduledTime);\npm.request.body.update(JSON.stringify({ id: campaignId, scheduledTime: scheduledTime }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst campaignId = Number(pm.environment.get(\"smooveApiCampaignIdToSchedule\"));\nconst scheduledTime = pm.environment.get(\"smooveApiCampaignScheduledTime\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/campaigns/\" + campaignId,\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test('Follow-up GET shows campaign scheduled', function () {\n    pm.expect(getRes.code, \"get-by-id status\").to.eql(200);\n    const json = getRes.json();\n    pm.expect(json.id, \"id\").to.eql(campaignId);\n    pm.expect(String(json.status).toLowerCase(), \"status\").to.eql(\"automatic\");\n    pm.expect(json.sentDate, \"sentDate\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(json.sentDate)), \"sentDate parseable\").to.eql(false);\n    // API may shift timezone; assert the scheduled calendar day survives.\n    pm.expect(String(json.sentDate), \"sentDate day\").to.include(\"2099-06-15\");\n});\n\npm.sendRequest({\n    url: baseUrl + \"/api/v1/campaigns\",\n    method: \"DELETE\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    },\n    body: { mode: \"raw\", raw: JSON.stringify({ ids: [campaignId] }) }\n}, function () {});\n\npm.environment.unset(\"smooveApiCampaignIdToSchedule\");\npm.environment.unset(\"smooveApiCampaignScheduledTime\");"]}}],"id":"7104d353-18de-48fe-b107-423019318231","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"id\": 0,\n  \"scheduledTime\": \"2099-01-01T12:00:00.000Z\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/campaigns/update-scheduled-campaign","urlObject":{"path":["api","v1","campaigns","update-scheduled-campaign"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7104d353-18de-48fe-b107-423019318231"}],"id":"0d4aafc0-fe23-4cb0-9b45-ed5817894fa1","_postman_id":"0d4aafc0-fe23-4cb0-9b45-ed5817894fa1","description":""},{"name":"dashboard-aggregate-statistics","item":[{"name":"Campaigns Get Aggregate Statistics","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['from', 'to', 'sends', 'opens', 'uniqueOpens', 'clicks', 'uniqueClicks', 'bounced', 'abuse', 'mostWatchedSubject', 'mostWatchedMailRate'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.from, 'from').to.be.a('string');\n    pm.expect(json.to, 'to').to.be.a('string');\n    pm.expect(json.sends, 'sends').to.be.a('number');\n    pm.expect(json.opens, 'opens').to.be.a('number');\n    pm.expect(json.uniqueOpens, 'uniqueOpens').to.be.a('number');\n    pm.expect(json.clicks, 'clicks').to.be.a('number');\n    pm.expect(json.uniqueClicks, 'uniqueClicks').to.be.a('number');\n    pm.expect(json.bounced, 'bounced').to.be.a('number');\n    pm.expect(json.abuse, 'abuse').to.be.a('number');\n    pm.expect(json.mostWatchedSubject, 'mostWatchedSubject').to.be.a('string');\n    pm.expect(json.mostWatchedMailRate, 'mostWatchedMailRate').to.be.a('number');\n});\n\npm.test('Aggregate statistics have consistent date and count values', function () {\n    const json = pm.response.json();\n    pm.expect(Number.isNaN(Date.parse(json.from)), 'from parseable').to.eql(false);\n    pm.expect(Number.isNaN(Date.parse(json.to)), 'to parseable').to.eql(false);\n    pm.expect(Date.parse(json.to), 'to >= from').to.be.at.least(Date.parse(json.from));\n    pm.expect(json.sends, 'sends').to.be.at.least(0);\n    pm.expect(json.opens, 'opens').to.be.at.least(0);\n    pm.expect(json.uniqueOpens, 'uniqueOpens').to.be.at.most(json.opens);\n    pm.expect(json.uniqueClicks, 'uniqueClicks').to.be.at.most(json.clicks);\n    pm.expect(json.mostWatchedSubject, 'mostWatchedSubject').to.not.equal('');\n});"]}}],"id":"9030a541-98ef-4066-8bdb-be308d067f51","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/campaigns/dashboard-aggregate-statistics","urlObject":{"path":["api","v1","campaigns","dashboard-aggregate-statistics"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9030a541-98ef-4066-8bdb-be308d067f51"}],"id":"89bd5dac-c860-4f03-832e-6008d120bd32","_postman_id":"89bd5dac-c860-4f03-832e-6008d120bd32","description":""},{"name":"aggregate-statistics-for-mail","item":[{"name":"{mailId}","item":[{"name":"Campaigns Get Aggregate Statistics By Mail Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/campaigns?Page=1&PageSize=5&Status=sent&IncludeStats=true\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.expect(listRes.code, \"seed sent campaigns\").to.eql(200);\nconst campaignId = Number((listRes.json().results || [])[0].id);\npm.expect(campaignId, \"mail id\").to.be.above(0);\npm.environment.set(\"smooveApiCampaignAggMailId\", String(campaignId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedMailId = Number(pm.environment.get(\"smooveApiCampaignAggMailId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(expectedMailId, 'queried mail id').to.be.above(0);\n    if (!json.length) {\n        return;\n    }\n    const item = json[0];\n    ['id', 'sends', 'opens', 'uniqueOpens', 'clicks', 'uniqueClicks', 'bounced', 'day'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number');\n    pm.expect(item.sends, 'sends').to.be.a('number');\n    pm.expect(item.opens, 'opens').to.be.a('number');\n    pm.expect(item.uniqueOpens, 'uniqueOpens').to.be.a('number');\n    pm.expect(item.clicks, 'clicks').to.be.a('number');\n    pm.expect(item.uniqueClicks, 'uniqueClicks').to.be.a('number');\n    pm.expect(item.bounced, 'bounced').to.be.a('number');\n    pm.expect(item.day, 'day').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.day)), 'day parseable').to.eql(false);\n    pm.expect(item.sends, 'sends').to.be.at.least(0);\n    pm.expect(item.uniqueOpens, 'uniqueOpens').to.be.at.most(item.opens);\n});\n\npm.environment.unset(\"smooveApiCampaignAggMailId\");"]}}],"id":"ae765dfc-b1fb-411e-a68c-543cfe1770a0","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/campaigns/aggregate-statistics-for-mail/{{smooveApiCampaignId}}","urlObject":{"path":["api","v1","campaigns","aggregate-statistics-for-mail","{{smooveApiCampaignId}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"ae765dfc-b1fb-411e-a68c-543cfe1770a0"}],"id":"40d94784-355f-445c-8ef7-0f36b7ceb416","_postman_id":"40d94784-355f-445c-8ef7-0f36b7ceb416","description":""}],"id":"7efef4e5-5911-4fa2-a479-d239ddb9976c","_postman_id":"7efef4e5-5911-4fa2-a479-d239ddb9976c","description":""},{"name":"save","item":[{"name":"Campaigns Save","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst name = \"Postman Campaign Save \" + suffix;\n\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nconst html =\n    \"<!DOCTYPE html><html><head><title>\" + name + \"</title></head>\" +\n    \"<body><p>Postman campaign save</p></body></html>\";\n\npm.environment.set(\"smooveApiCampaignNameToSave\", name);\npm.request.body.update(JSON.stringify({\n    id: 0,\n    html: html,\n    name: name,\n    isDuplicate: false\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst expectedName = pm.environment.get(\"smooveApiCampaignNameToSave\");\nconst json = pm.response.json();\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response time is less than 10000ms\", function () {\n    pm.expect(pm.response.responseTime).to.be.below(10000);\n});\n\npm.test(\"Content-Type is application/json\", function () {\n    pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");\n});\n\npm.test(\"Response contains all required fields\", function () {\n    pm.expect(json).to.include.all.keys(\"id\", \"name\", \"html\");\n});\n\npm.test(\"Field types are correct\", function () {\n    pm.expect(json.id).to.be.a(\"number\");\n    pm.expect(json.name).to.be.a(\"string\");\n    pm.expect(json.html).to.be.a(\"string\");\n});\n\npm.test(\"Field values are valid\", function () {\n    pm.expect(Number.isInteger(json.id), \"id should be an integer\").to.be.true;\n    pm.expect(json.id, \"id\").to.be.above(0);\n    pm.expect(json.name, \"name echoes the requested name\").to.eql(expectedName);\n    pm.expect(json.html, \"html keeps the saved content\").to.include(\"Postman campaign save\");\n});\n\n// Cleanup: soft-delete the campaign created by this request.\nconst cleanupRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/campaigns\",\n    method: \"DELETE\",\n    header: { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" },\n    body: { mode: \"raw\", raw: JSON.stringify({ ids: [json.id] }) }\n});\npm.test(\"Cleanup: saved campaign soft-deleted\", function () {\n    pm.expect([200, 204]).to.include(cleanupRes.code);\n});\npm.environment.unset(\"smooveApiCampaignNameToSave\");"]}}],"id":"2bfb0034-c85e-40b2-aae0-be740f43d3db","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"id\": 0,\n  \"html\": \"\",\n  \"name\": \"\",\n  \"isDuplicate\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/campaigns/save","urlObject":{"path":["api","v1","campaigns","save"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"2bfb0034-c85e-40b2-aae0-be740f43d3db"}],"id":"5e86173f-a6d4-4e5e-bc92-86776f8b5de7","_postman_id":"5e86173f-a6d4-4e5e-bc92-86776f8b5de7","description":""},{"name":"Campaigns Get Campaigns","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n    pm.expect(json, 'missing results').to.have.property('results');\n    pm.expect(json.results, 'results').to.be.an('array');\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.results.length, 'results length').to.be.at.least(1);\n    pm.expect(json.rows, 'rows').to.be.at.least(json.results.length);\n    pm.expect(json.size, 'size').to.be.at.least(json.results.length);\n});\n\npm.test('First result has all expected fields and types', function () {\n    const item = pm.response.json().results[0];\n    ['id', 'subject', 'name', 'status', 'sentDate', 'recipients', 'contentType', 'sentCount', 'bouncedCount', 'openedCount', 'clickedCount', 'snoozedCount', 'isAttachedToBusinessJourney', 'isUsedByActiveAutomation', 'openedRate', 'clickedRate', 'unknownCount'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number');\n    pm.expect(item.subject, 'subject').to.be.a('string');\n    pm.expect(item.name, 'name').to.be.a('string');\n    pm.expect(item.status, 'status').to.be.a('string');\n    pm.expect(item.sentDate, 'sentDate').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.sentDate)), 'sentDate parseable').to.eql(false);\n    pm.expect(item.recipients, 'recipients').to.be.a('string');\n    pm.expect(item.contentType, 'contentType').to.be.a('string');\n    pm.expect(item.sentCount, 'sentCount').to.be.a('number');\n    pm.expect(item.bouncedCount, 'bouncedCount').to.be.a('number');\n    pm.expect(item.openedCount, 'openedCount').to.be.a('number');\n    pm.expect(item.clickedCount, 'clickedCount').to.be.a('number');\n    pm.expect(item.snoozedCount, 'snoozedCount').to.be.a('number');\n    pm.expect(item.isAttachedToBusinessJourney, 'isAttachedToBusinessJourney').to.be.a('boolean');\n    pm.expect(item.isUsedByActiveAutomation, 'isUsedByActiveAutomation').to.be.a('boolean');\n    pm.expect(item.openedRate, 'openedRate').to.be.a('number');\n    pm.expect(item.clickedRate, 'clickedRate').to.be.a('number');\n    pm.expect(item.unknownCount, 'unknownCount').to.be.a('number');\n});\n\npm.test('First campaign has real identity values', function () {\n    const item = pm.response.json().results[0];\n    pm.expect(item.id, 'id').to.be.above(0);\n    pm.expect(item.status, 'status').to.not.equal('');\n    pm.expect(item.contentType, 'contentType').to.not.equal('');\n    pm.expect(item.sentCount, 'sentCount').to.be.at.least(0);\n    pm.expect(item.openedCount, 'openedCount').to.be.at.least(0);\n});"]}}],"id":"e9388f8c-15c5-4d31-a599-f190753876df","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/campaigns","urlObject":{"path":["api","v1","campaigns"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e9388f8c-15c5-4d31-a599-f190753876df"},{"name":"Campaigns Bulk Delete","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst subject = \"Postman BulkDelete \" + suffix;\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst html =\n    \"<!DOCTYPE html><html><head><title>\" + subject + \"</title></head>\" +\n    \"<body><p>Postman bulk delete campaign</p></body></html>\";\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/campaigns/save\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            id: 0,\n            html: html,\n            name: subject,\n            isDuplicate: false\n        })\n    }\n});\npm.expect(createRes.code, \"Smoove.Api create email status\").to.eql(200);\nconst created = createRes.json();\nconst campaignId = Number(created && created.id);\npm.expect(campaignId, \"created campaign id\").to.be.a(\"number\").and.above(0);\n\npm.environment.set(\"smooveApiCampaignIdToDelete\", String(campaignId));\npm.environment.set(\"smooveApiCampaignSubjectToDelete\", subject);\npm.request.body.update(JSON.stringify({ ids: [campaignId] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expectedId = Number(pm.environment.get(\"smooveApiCampaignIdToDelete\"));\nconst expectedSubject = pm.environment.get(\"smooveApiCampaignSubjectToDelete\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with deleted campaign shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"array\");\n    pm.expect(json.length, \"deleted campaigns length\").to.be.at.least(1);\n    const item = json.find(function (c) { return Number(c.id) === expectedId; }) || json[0];\n    ['id', 'subject', 'status'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, \"id\").to.be.a(\"number\");\n    pm.expect(item.subject, \"subject\").to.be.a(\"string\");\n    pm.expect(item.status, \"status\").to.be.a(\"string\");\n});\n\npm.test('Deleted campaign echoes request and is marked deleted', function () {\n    const json = pm.response.json();\n    const item = json.find(function (c) { return Number(c.id) === expectedId; }) || json[0];\n    pm.expect(item.id, \"id\").to.eql(expectedId);\n    pm.expect(item.subject, \"subject\").to.eql(expectedSubject);\n    pm.expect(String(item.status).toLowerCase(), \"status\").to.eql(\"deleted\");\n});\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/campaigns/\" + expectedId,\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test('Follow-up GET no longer finds the deleted campaign', function () {\n    pm.expect(getRes.code, \"get-by-id status after delete\").to.eql(404);\n});\n\npm.environment.unset(\"smooveApiCampaignIdToDelete\");\npm.environment.unset(\"smooveApiCampaignSubjectToDelete\");"]}}],"id":"5db06092-931c-4c4b-aff7-2c615b23c538","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/campaigns","urlObject":{"path":["api","v1","campaigns"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"ids","value":""}],"variable":[]}},"response":[],"_postman_id":"5db06092-931c-4c4b-aff7-2c615b23c538"}],"id":"1fe0509f-65d2-422b-a524-a08ce6f224d9","_postman_id":"1fe0509f-65d2-422b-a524-a08ce6f224d9","description":""},{"name":"cdn","item":[{"name":"mimetypes","item":[{"name":"Cdn Get Allowed Mime Types","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});\r\n"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is a non-empty array of mime type strings', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array').and.not.empty;\n    json.forEach(function (item, i) {\n        pm.expect(item, 'item[' + i + ']').to.be.a('string').and.not.empty;\n    });\n});\n\npm.test('Common mime types are allowed', function () {\n    const json = pm.response.json();\n    ['pdf', 'png', 'jpg', 'jpeg', 'gif', 'csv'].forEach(function (ext) {\n        pm.expect(json, 'includes ' + ext).to.include(ext);\n    });\n});"]}}],"id":"8e83ceb7-0a67-49c0-a90b-85a6d2bb8c95","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/cdn/mimetypes","urlObject":{"path":["api","v1","cdn","mimetypes"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8e83ceb7-0a67-49c0-a90b-85a6d2bb8c95"}],"id":"b9fa4513-a4f8-448c-bfba-b8b09f451247","_postman_id":"b9fa4513-a4f8-448c-bfba-b8b09f451247","description":""},{"name":"{fileId}","item":[{"name":"preview","item":[{"name":"Cdn Preview File","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});\r\n"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Preview response is non-empty binary content', function () {\n    const text = pm.response.text();\n    pm.expect(text, 'body').to.be.a('string');\n    pm.expect(text.length, 'body length').to.be.above(0);\n    const contentType = pm.response.headers.get('Content-Type') || pm.response.headers.get('content-type') || '';\n    pm.expect(contentType.length, 'Content-Type present').to.be.above(0);\n});"]}}],"id":"d9a29578-3d6e-4181-ba7d-eda88b0813dc","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveApiBaseURL}}/api/v1/cdn/{{smooveApiFileId}}/preview","urlObject":{"path":["api","v1","cdn","{{smooveApiFileId}}","preview"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d9a29578-3d6e-4181-ba7d-eda88b0813dc"}],"id":"dea87c4c-e2f5-4338-964e-43a72d83ed30","_postman_id":"dea87c4c-e2f5-4338-964e-43a72d83ed30","description":""},{"name":"Cdn Get File","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});\r\n"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is non-empty binary content', function () {\n    const text = pm.response.text();\n    pm.expect(text, 'body').to.be.a('string');\n    pm.expect(text.length, 'body length').to.be.above(0);\n    const contentType = pm.response.headers.get('Content-Type') || pm.response.headers.get('content-type') || '';\n    pm.expect(contentType.length, 'Content-Type present').to.be.above(0);\n});"]}}],"id":"045c57a5-7b27-46ef-9310-9327a25be365","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveApiBaseURL}}/api/v1/cdn/{{smooveApiFileId}}","urlObject":{"path":["api","v1","cdn","{{smooveApiFileId}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"045c57a5-7b27-46ef-9310-9327a25be365"},{"name":"Cdn Delete File","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst apiKey = pm.environment.get(\"apiKey\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction headers(extra) {\n    return Object.assign({\n        Accept: \"application/json\",\n        Cookie: cookie ? `jvlpsi=${cookie};` : undefined,\n        apiKey: apiKey\n    }, extra || {});\n}\n\n// API uploads land as status \"hidden\" with no FileUsage, so DELETE returns 404 until the\n// file is attached to the account. Attach by putting the public id into a temporary\n// file-typed custom field on a throwaway contact (extra key = field id).\nconst groupId = Number(pm.environment.get(\"smooveApiCustomFieldGroupId\"));\nconst siteId = Number(pm.environment.get(\"smooveApiAccountSiteId\") || 0);\n\n// DEV account can have a tiny CDN limit (tens of bytes). Bump if needed so attach works.\nif (siteId > 0) {\n    const quotaRes = await send({\n        url: baseUrl + \"/api/v1/cdn/quotas\",\n        method: \"GET\",\n        header: headers()\n    });\n    const quota = quotaRes && quotaRes.code === 200 ? quotaRes.json() : null;\n    if (quota && Number(quota.limit || 0) < 1024 * 1024) {\n        await send({\n            url: baseUrl + \"/api/v1/admin/customer/\" + siteId + \"/promotions\",\n            method: \"POST\",\n            header: headers({ \"Content-Type\": \"application/json\" }),\n            body: {\n                mode: \"raw\",\n                raw: JSON.stringify({\n                    value: 10 * 1024 * 1024,\n                    description: \"postman cdn delete quota bump\",\n                    reason: 0\n                })\n            }\n        });\n    }\n}\n\nconst cfRes = await send({\n    url: baseUrl + \"/api/v1/account/customField\",\n    method: \"PUT\",\n    header: headers({ \"Content-Type\": \"application/json\" }),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            name: \"PostmanCdnDel\" + Date.now().toString().slice(-8),\n            type: \"contacts\",\n            dataType: \"file\",\n            groupId: groupId,\n            position: 0,\n            serialNumber: 0,\n            mapId: \"pd\" + String(Date.now()).slice(-6)\n        })\n    }\n});\nif (!cfRes || cfRes.code !== 200) {\n    throw new Error(\"Create file custom field failed with status \" + (cfRes && cfRes.code) + \": \" + (cfRes && cfRes.text && cfRes.text()));\n}\nconst field = cfRes.json();\nconst fieldId = field && field.id;\nif (!fieldId) throw new Error(\"Create file custom field returned no id\");\n\n// pm.sendRequest rejects file formdata (\"Invalid input for model\") in the CLI/Desktop\n// sandbox, so upload a tiny embedded PNG as a raw multipart body instead.\nconst pngBase64 = \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==\";\nconst boundary = \"----PostmanCdnDelete\" + Date.now();\nfunction b64ToBinaryString(b64) {\n    if (typeof Buffer !== \"undefined\") {\n        return Buffer.from(b64, \"base64\").toString(\"binary\");\n    }\n    const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n    let str = \"\";\n    let i = 0;\n    b64 = b64.replace(/[^A-Za-z0-9+/=]/g, \"\");\n    while (i < b64.length) {\n        const enc1 = chars.indexOf(b64.charAt(i++));\n        const enc2 = chars.indexOf(b64.charAt(i++));\n        const enc3 = chars.indexOf(b64.charAt(i++));\n        const enc4 = chars.indexOf(b64.charAt(i++));\n        const chr1 = (enc1 << 2) | (enc2 >> 4);\n        const chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n        const chr3 = ((enc3 & 3) << 6) | enc4;\n        str += String.fromCharCode(chr1);\n        if (enc3 !== 64) str += String.fromCharCode(chr2);\n        if (enc4 !== 64) str += String.fromCharCode(chr3);\n    }\n    return str;\n}\nconst fileBinary = b64ToBinaryString(pngBase64);\nconst multipart =\n    \"--\" + boundary + \"\\r\\n\" +\n    \"Content-Disposition: form-data; name=\\\"File\\\"; filename=\\\"tiny.png\\\"\\r\\n\" +\n    \"Content-Type: image/png\\r\\n\\r\\n\" +\n    fileBinary +\n    \"\\r\\n--\" + boundary + \"--\\r\\n\";\n\nconst uploadRes = await send({\n    url: baseUrl + \"/api/v1/cdn\",\n    method: \"POST\",\n    header: headers({\n        \"Content-Type\": \"multipart/form-data; boundary=\" + boundary\n    }),\n    body: {\n        mode: \"raw\",\n        raw: multipart\n    }\n});\nif (!uploadRes || (uploadRes.code !== 200 && uploadRes.code !== 201)) {\n    throw new Error(\n        \"CDN upload for disposable file failed with status \" +\n        (uploadRes && uploadRes.code) +\n        \": \" +\n        (uploadRes && uploadRes.text && uploadRes.text())\n    );\n}\nconst uploaded = uploadRes.json();\nconst fileId = uploaded && uploaded.id;\nif (!fileId) throw new Error(\"CDN upload returned no file id\");\n\nconst contactRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: headers({ \"Content-Type\": \"application/json\" }),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            email: \"postman.cdndel.\" + ts + \"@smoove.smoove-api.postman.test\",\n            firstname: \"Postman\",\n            lastname: \"CdnDelete\",\n            mailPermissions: true,\n            unsubscribed: false,\n            isDeleted: false,\n            extra: (function () {\n                const extra = {};\n                extra[String(fieldId)] = String(fileId);\n                return extra;\n            })()\n        })\n    }\n});\nif (!contactRes || (contactRes.code !== 200 && contactRes.code !== 201)) {\n    throw new Error(\"Create contact to attach CDN file failed with status \" + (contactRes && contactRes.code) + \": \" + (contactRes && contactRes.text && contactRes.text()));\n}\nconst contactId = contactRes.json() && contactRes.json().id;\nif (contactId) pm.environment.set(\"smooveApiCdnDeleteContactId\", String(contactId));\n\n// Delete the file field before the file. The ContactCreated consumer runs asynchronously and attaches again the\n// files that a contact's file fields point to, even after the file was deleted. Without the field it has\n// nothing to attach, so the second delete of the file reliably returns 404.\nconst fieldDeleteRes = await send({\n    url: baseUrl + \"/api/v1/account/customField/\" + fieldId,\n    method: \"DELETE\",\n    header: headers()\n});\nif (!fieldDeleteRes || fieldDeleteRes.code !== 200) {\n    throw new Error(\"Delete file custom field failed with status \" + (fieldDeleteRes && fieldDeleteRes.code));\n}\n\npm.environment.unset(\"smooveApiCdnDeleteSkipped\");\npm.environment.set(\"smooveApiDisposableCdnFileId\", String(fileId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const deletedFileId = pm.environment.get(\"smooveApiDisposableCdnFileId\");\nconst deleteAgainRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/cdn/\" + deletedFileId,\n    method: \"DELETE\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response returns the updated CDN quota', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['total', 'value', 'legacyValue', 'legacyFileCount', 'limit'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n});\n\npm.test('Deleted file is no longer attached to the account', function () {\n    pm.expect(deleteAgainRes.code, 'second delete status').to.eql(404);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const apiKey = pm.environment.get(\"apiKey\");\n    const contactId = pm.environment.get(\"smooveApiCdnDeleteContactId\");\n    const header = {\n        Accept: \"application/json\",\n        Cookie: cookie ? (\"jvlpsi=\" + cookie + \";\") : undefined,\n        apiKey: apiKey\n    };\n\n    async function remove(label, url) {\n        const res = await pm.sendRequest({ url: url, method: \"DELETE\", header: header });\n        pm.test(\"Cleanup: \" + label, function () {\n            pm.expect([200, 201, 204, 404]).to.include(res.code);\n        });\n    }\n\n    if (contactId) {\n        await remove(\"attach contact deleted\", baseUrl + \"/api/v1/contacts/\" + contactId);\n    }\n\n    [\"smooveApiCdnDeleteContactId\", \"smooveApiDisposableCdnFileId\"].forEach(function (k) {\n        pm.environment.unset(k);\n    });\n}\n\nawait cleanUp();"]}}],"id":"a3c9a34e-7a3e-4551-b2a3-22c1afe6189e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/cdn/{{smooveApiDisposableCdnFileId}}","urlObject":{"path":["api","v1","cdn","{{smooveApiDisposableCdnFileId}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a3c9a34e-7a3e-4551-b2a3-22c1afe6189e"}],"id":"fea17703-fcaa-4188-a3d7-cbbf7042662d","_postman_id":"fea17703-fcaa-4188-a3d7-cbbf7042662d","description":""},{"name":"{fileName}","item":[{"name":"properties","item":[{"name":"Cdn Get File Properties","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['size', 'createdAt', 'id', 'fileName', 'mimeType', 'status', 'extension'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.size, 'size').to.be.a('number').and.above(0);\n    pm.expect(json.createdAt, 'createdAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.createdAt)), 'createdAt parseable').to.equal(false);\n    pm.expect(json.id, 'id').to.be.a('string').and.not.empty;\n    pm.expect(json.fileName, 'fileName').to.be.a('string').and.not.empty;\n    pm.expect(json.mimeType, 'mimeType').to.be.a('string').and.not.empty;\n    pm.expect(json.status, 'status').to.be.a('string').and.not.empty;\n    pm.expect(json.extension, 'extension').to.be.a('string').and.not.empty;\n});\n\npm.test('Properties match the requested file id', function () {\n    const json = pm.response.json();\n    const expectedId = pm.environment.get('smooveApiFileId');\n    if (expectedId && !String(expectedId).includes('{{')) {\n        pm.expect(json.id, 'id').to.eql(String(expectedId));\n    }\n    pm.expect(json.status, 'status').to.eql('available');\n});"]}}],"id":"61d3a844-b3ce-45b9-a817-4bb99f6779c2","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/cdn/{{smooveApiFileId}}/properties","urlObject":{"path":["api","v1","cdn","{{smooveApiFileId}}","properties"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"61d3a844-b3ce-45b9-a817-4bb99f6779c2"}],"id":"7c0b4f79-d3de-4524-b1d4-855091c5977a","_postman_id":"7c0b4f79-d3de-4524-b1d4-855091c5977a","description":""}],"id":"b13f0cac-6dd8-4d70-83e7-17aee3ebc1c8","_postman_id":"b13f0cac-6dd8-4d70-83e7-17aee3ebc1c8","description":""},{"name":"quotas","item":[{"name":"Cdn Get File Quota","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['total', 'value', 'legacyValue', 'legacyFileCount', 'limit'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n});\n\npm.test('Quota values are coherent', function () {\n    const json = pm.response.json();\n    pm.expect(json.total, 'total').to.be.at.least(0);\n    pm.expect(json.value, 'value').to.be.at.least(0);\n    pm.expect(json.legacyValue, 'legacyValue').to.be.at.least(0);\n    pm.expect(json.legacyFileCount, 'legacyFileCount').to.be.at.least(0);\n    pm.expect(json.limit, 'limit').to.be.above(0);\n    pm.expect(json.value, 'value <= limit').to.be.at.most(json.limit);\n});"]}}],"id":"3e56c53a-fd0f-4268-ac5a-1ead30be621b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/cdn/quotas","urlObject":{"path":["api","v1","cdn","quotas"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3e56c53a-fd0f-4268-ac5a-1ead30be621b"}],"id":"e74bba42-1b35-42ee-9727-f64b9a690bc4","_postman_id":"e74bba42-1b35-42ee-9727-f64b9a690bc4","description":""},{"name":"files","item":[{"name":"Cdn Get File Usages","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number').and.at.least(1);\n    pm.expect(json.results, 'results').to.be.an('array').and.not.empty;\n});\n\npm.test('First result has all expected fields and types', function () {\n    const item = pm.response.json().results[0];\n    ['id', 'fileName', 'size', 'uploadedAt', 'source', 'action', 'status', 'type'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('string').and.not.empty;\n    pm.expect(item.fileName, 'fileName').to.be.a('string').and.not.empty;\n    pm.expect(item.size, 'size').to.be.a('number').and.at.least(0);\n    pm.expect(item.uploadedAt, 'uploadedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.uploadedAt)), 'uploadedAt parseable').to.equal(false);\n    pm.expect(item.source, 'source').to.be.a('string');\n    pm.expect(item.action, 'action').to.be.a('string');\n    pm.expect(item.status, 'status').to.be.a('string');\n    pm.expect(item.type, 'type').to.be.a('string');\n});"]}}],"id":"0a857454-e45b-4810-96c4-151a56cdd3af","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/cdn/files","urlObject":{"path":["api","v1","cdn","files"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"0a857454-e45b-4810-96c4-151a56cdd3af"}],"id":"45bfe7f0-0352-40ea-a8b2-ca89de088bda","_postman_id":"45bfe7f0-0352-40ea-a8b2-ca89de088bda","description":""},{"name":"ensure-contact-files-attached","item":[{"name":"Cdn Ensure File Attached To Contact","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});"]}}],"id":"c31682b3-8a2c-4bec-b2bf-85e1bafedb35","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[],"url":"{{smooveApiBaseURL}}/api/v1/cdn/ensure-contact-files-attached?contactId={{smooveApiContactId}}","urlObject":{"path":["api","v1","cdn","ensure-contact-files-attached"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"contactId","value":"{{smooveApiContactId}}"}],"variable":[]}},"response":[],"_postman_id":"c31682b3-8a2c-4bec-b2bf-85e1bafedb35"}],"id":"433b9795-42a5-46f0-8517-2767117096d9","_postman_id":"433b9795-42a5-46f0-8517-2767117096d9","description":""},{"name":"update-files-status","item":[{"name":"Cdn Update Files Status","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});"]}}],"id":"dd3c70d8-9ba9-425a-bffd-5293167ee4eb","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[],"url":"{{smooveApiBaseURL}}/api/v1/cdn/update-files-status","urlObject":{"path":["api","v1","cdn","update-files-status"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"dd3c70d8-9ba9-425a-bffd-5293167ee4eb"}],"id":"f887c5cf-3a3c-4aec-9b36-13040119a53f","_postman_id":"f887c5cf-3a3c-4aec-9b36-13040119a53f","description":""},{"name":"Cdn Upload File","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['size', 'createdAt', 'id', 'fileName', 'mimeType', 'status', 'extension'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json[\"size\"], \"size\").to.be.a('number').and.above(0);\n    pm.expect(json[\"createdAt\"], \"createdAt\").to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json[\"createdAt\"])), \"createdAt should be a parseable date\").to.equal(false);\n    pm.expect(json[\"id\"], \"id\").to.be.a('string').and.not.empty;\n    pm.expect(json[\"fileName\"], \"fileName\").to.be.a('string').and.not.empty;\n    pm.expect(json[\"mimeType\"], \"mimeType\").to.be.a('string').and.not.empty;\n    pm.expect(json[\"status\"], \"status\").to.be.a('string').and.not.empty;\n    pm.expect(json[\"extension\"], \"extension\").to.be.a('string').and.not.empty;\n});\n\npm.test('Uploaded file echoes request filename', function () {\n    const json = pm.response.json();\n    pm.expect(json.fileName, 'fileName').to.match(/tiny\\.png/i);\n    pm.expect(json.extension, 'extension').to.match(/png/i);\n});\n\ntry {\n    const uploaded = pm.response.json();\n    if (uploaded && uploaded.id) {\n        pm.environment.set(\"smooveApiUploadedFileId\", uploaded.id);\n        pm.environment.set(\"smooveApiFileUpload\", uploaded.id);\n    }\n} catch (e) {}\n\n// Uploaded files are Hidden with no FileUsage, so DELETE 404s until attached.\n// Attach via a temporary file custom field + contact, then delete.\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const apiKey = pm.environment.get(\"apiKey\");\n    const ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    let cleanupId = null;\n    try {\n        cleanupId = pm.response.json() && (pm.response.json().id || pm.response.json().fileId);\n    } catch (e) {}\n    if (!cleanupId) {\n        pm.test(\"Cleanup skipped: could not resolve cdn file id\", function () {\n            pm.expect.fail(\"Missing cdn file id for cleanup\");\n        });\n        return;\n    }\n\n    function send(opts) {\n        return new Promise(function (resolve, reject) {\n            pm.sendRequest(opts, function (err, res) {\n                if (err) reject(err);\n                else resolve(res);\n            });\n        });\n    }\n    function headers(extra) {\n        return Object.assign({\n            Accept: \"application/json\",\n            Cookie: cookie ? (\"jvlpsi=\" + cookie + \";\") : undefined,\n            apiKey: apiKey\n        }, extra || {});\n    }\n\n    const groupId = Number(pm.environment.get(\"smooveApiCustomFieldGroupId\"));\n    const siteId = Number(pm.environment.get(\"smooveApiAccountSiteId\") || 0);\n    if (siteId > 0) {\n        const quotaRes = await send({ url: baseUrl + \"/api/v1/cdn/quotas\", method: \"GET\", header: headers() });\n        const quota = quotaRes && quotaRes.code === 200 ? quotaRes.json() : null;\n        if (quota && Number(quota.limit || 0) < 1024 * 1024) {\n            await send({\n                url: baseUrl + \"/api/v1/admin/customer/\" + siteId + \"/promotions\",\n                method: \"POST\",\n                header: headers({ \"Content-Type\": \"application/json\" }),\n                body: {\n                    mode: \"raw\",\n                    raw: JSON.stringify({\n                        value: 10 * 1024 * 1024,\n                        description: \"postman cdn upload cleanup quota bump\",\n                        reason: 0\n                    })\n                }\n            });\n        }\n    }\n    const cfRes = await send({\n        url: baseUrl + \"/api/v1/account/customField\",\n        method: \"PUT\",\n        header: headers({ \"Content-Type\": \"application/json\" }),\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({\n                name: \"PostmanCdnUp\" + Date.now().toString().slice(-8),\n                type: \"contacts\",\n                dataType: \"file\",\n                groupId: groupId,\n                position: 0,\n                serialNumber: 0,\n                mapId: \"pu\" + String(Date.now()).slice(-6)\n            })\n        }\n    });\n    const fieldId = cfRes && cfRes.code === 200 && cfRes.json() && cfRes.json().id;\n    let contactId = null;\n    if (fieldId) {\n        const extra = {};\n        extra[String(fieldId)] = String(cleanupId);\n        const contactRes = await send({\n            url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n            method: \"POST\",\n            header: headers({ \"Content-Type\": \"application/json\" }),\n            body: {\n                mode: \"raw\",\n                raw: JSON.stringify({\n                    email: \"postman.cdnup.\" + ts + \"@smoove.smoove-api.postman.test\",\n                    firstname: \"Postman\",\n                    lastname: \"CdnUpload\",\n                    mailPermissions: true,\n                    extra: extra\n                })\n            }\n        });\n        if (contactRes && (contactRes.code === 200 || contactRes.code === 201)) {\n            contactId = contactRes.json() && contactRes.json().id;\n        }\n    }\n\n    const delRes = await send({\n        url: baseUrl + \"/api/v1/cdn/\" + encodeURIComponent(String(cleanupId)),\n        method: \"DELETE\",\n        header: headers()\n    });\n    pm.test(\"Cleanup: cdn file deleted successfully\", function () {\n        pm.expect([200, 204]).to.include(delRes.code);\n    });\n\n    if (contactId) {\n        await send({ url: baseUrl + \"/api/v1/contacts/\" + contactId, method: \"DELETE\", header: headers() });\n    }\n    if (fieldId) {\n        await send({ url: baseUrl + \"/api/v1/account/customField/\" + fieldId, method: \"DELETE\", header: headers() });\n    }\n}\n\nawait cleanUp();"]}}],"id":"6f21fa0f-8484-4152-a333-d1f3760badb8","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"text/plain"}],"body":{"mode":"formdata","formdata":[{"type":"file","key":"File","src":"postman/fixtures/tiny.png"}]},"url":"{{smooveApiBaseURL}}/api/v1/cdn","urlObject":{"path":["api","v1","cdn"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6f21fa0f-8484-4152-a333-d1f3760badb8"}],"id":"6502ea91-2960-4ce1-9844-60523e42c60e","_postman_id":"6502ea91-2960-4ce1-9844-60523e42c60e","description":""},{"name":"communication","item":[{"name":"{contactId}","item":[{"name":"statistics","item":[{"name":"Communication Get Statistics","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nasync function ensureContactId() {\n    let contactId = pm.environment.get(\"smooveApiContactId\");\n    if (contactId && String(contactId).indexOf(\"{{\") === -1 && Number(contactId) > 0) {\n        const getRes = await send({\n            url: baseUrl + \"/api/v1/contacts/\" + contactId,\n            method: \"GET\",\n            header: { Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` }\n        });\n        if (getRes.code === 200) return String(contactId);\n    }\n\n    const ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const createRes = await send({\n        url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n        method: \"POST\",\n        header: {\n            \"Content-Type\": \"application/json\",\n            Accept: \"application/json\",\n            Cookie: `jvlpsi=${cookie};`\n        },\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({\n                email: \"postman.comm.stats.\" + ts + \"@smoove.smoove-api.postman.test\",\n                firstname: \"Postman\",\n                lastname: \"CommStats\",\n                mailPermissions: true,\n                unsubscribed: false,\n                isDeleted: false\n            })\n        }\n    });\n    pm.expect([200, 201], \"create contact status\").to.include(createRes.code);\n    const created = createRes.json();\n    pm.expect(created && created.id, \"seed contact id\").to.be.a(\"number\").and.above(0);\n    contactId = String(created.id);\n    pm.environment.set(\"smooveApiContactId\", contactId);\n    return contactId;\n}\n\nconst contactId = await ensureContactId();"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Statistics is an array of date/totalCount points\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"array\");\n\n    json.forEach(function (item, index) {\n        pm.expect(item, \"item[\" + index + \"] missing date\").to.have.property(\"date\");\n        pm.expect(item, \"item[\" + index + \"] missing totalCount\").to.have.property(\"totalCount\");\n        pm.expect(item.date, \"date\").to.be.a(\"string\");\n        pm.expect(Number.isNaN(Date.parse(item.date)), \"date parseable\").to.eql(false);\n        pm.expect(item.totalCount, \"totalCount\").to.be.a(\"number\").and.at.least(0);\n    });\n});"]}}],"id":"726093c5-1130-4836-9d41-a2ef8db66596","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{smooveApiBaseURL}}/api/v1/communication/:contactId/statistics","urlObject":{"path":["api","v1","communication",":contactId","statistics"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiContactId}}","key":"contactId"}]}},"response":[],"_postman_id":"726093c5-1130-4836-9d41-a2ef8db66596"}],"id":"d62c3b5f-8d4f-4c46-908b-b391aa2bb85c","_postman_id":"d62c3b5f-8d4f-4c46-908b-b391aa2bb85c","description":""},{"name":"Communication Get Communication","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst email = \"postman.comm.get.\" + suffix + \"@smoove.smoove-api.postman.test\";\nconst content = \"postman-comm-get-\" + suffix;\n\nconst contactRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({ email: email, firstname: \"Postman\", lastname: \"CommGet\", mailPermissions: true, unsubscribed: false, isDeleted: false })\n    }\n});\npm.expect(contactRes.code, \"seed contact status\").to.be.oneOf([200, 201]);\nconst contactId = contactRes.json().id;\npm.expect(contactId, \"seed contact id\").to.be.a(\"number\").and.above(0);\n\n// The admin API has no create-communication endpoint, so seed one through the public REST API.\nconst now = new Date();\nconst pad = function (n) { return String(n).padStart(2, \"0\"); };\nconst communicationRes = await pm.sendRequest({\n    url: \"https://\" + pm.environment.get(\"restApiUrl\") + \"/v1/Communications?by=Email\",\n    method: \"POST\",\n    header: { apikey: pm.environment.get(\"restApiKeyForAutomationTests\"), \"Content-Type\": \"application/json\" },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            type: \"Meeting\",\n            contact: email,\n            time: pad(now.getHours()) + \":\" + pad(now.getMinutes()),\n            initiator: \"You\",\n            content: content,\n            date: pad(now.getDate()) + \"/\" + pad(now.getMonth() + 1) + \"/\" + now.getFullYear(),\n            // The env value is stored with its JSON quotes because ViplusRest splices it in unquoted.\n            communicator: String(pm.environment.get(\"restApiCommunicatorAddress\")).replace(/^\"|\"$/g, \"\")\n        })\n    }\n});\npm.expect(communicationRes.code, \"seed communication status\").to.eql(200);\nconst communicationId = communicationRes.json().id;\npm.expect(communicationId, \"seeded communication id\").to.be.a(\"number\").and.above(0);\n\npm.environment.set(\"smooveApiCommContactId\", String(contactId));\npm.environment.set(\"smooveApiCommCommunicationId\", String(communicationId));\n// A multi-year window makes GetSentCampaigns scan tbl_LogMailContact and hit the 30s command timeout.\nconst windowEnd = new Date(Date.now() + 60 * 60 * 1000);\nconst windowStart = new Date(windowEnd.getTime() - 24 * 60 * 60 * 1000);\npm.environment.set(\"smooveApiCommLatestFrom\", windowStart.toISOString());\npm.environment.set(\"smooveApiCommLatestTo\", windowEnd.toISOString());\npm.environment.set(\"smooveApiCommOldestFrom\", windowStart.toISOString());\npm.environment.set(\"smooveApiCommOldestTo\", windowEnd.toISOString());"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst contactId = Number(pm.environment.get(\"smooveApiCommContactId\"));\nconst communicationId = Number(pm.environment.get(\"smooveApiCommCommunicationId\"));\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nconst communicationCleanup = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/crm/delete\",\n    method: \"DELETE\",\n    header: headers,\n    body: { mode: \"raw\", raw: JSON.stringify({ ids: [communicationId] }) }\n});\nconst contactCleanup = await pm.sendRequest({ url: baseUrl + \"/api/v1/contacts/\" + contactId, method: \"DELETE\", header: headers });\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Seeded communication is listed for the contact\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    pm.expect(json.latestCommunications, \"latestCommunications\").to.be.an(\"array\");\n    pm.expect(json.oldestCommunications, \"oldestCommunications\").to.be.an(\"array\");\n        pm.expect(json.latestCommunications.length, \"latest communications\").to.be.at.least(1);\n    const item = json.latestCommunications[0];\n    [\"id\", \"timestamp\", \"siteId\", \"type\"].forEach(function (key) {\n        pm.expect(item, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(item.id, \"id\").to.be.a(\"number\").and.above(0);\n    pm.expect(Number.isNaN(Date.parse(item.timestamp)), \"timestamp parseable\").to.eql(false);\n    pm.expect(item.siteId, \"siteId\").to.be.a(\"number\").and.above(0);\n    pm.expect(item.type, \"type\").to.be.a(\"string\").and.not.empty;\n});\n\npm.test(\"Cleanup: seeded communication and contact deleted\", function () {\n    pm.expect(communicationCleanup.code, \"delete communication\").to.be.oneOf([200, 204]);\n    pm.expect(contactCleanup.code, \"delete contact\").to.be.oneOf([200, 204]);\n});\n\n[\"smooveApiCommContactId\", \"smooveApiCommCommunicationId\", \"smooveApiCommLatestFrom\", \"smooveApiCommLatestTo\", \"smooveApiCommOldestFrom\", \"smooveApiCommOldestTo\"].forEach(function (k) {\n    pm.environment.unset(k);\n});"]}}],"id":"48b9092c-9d63-4402-bb6a-aeb64e7c2550","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/communication/:contactId?latestDateFrom={{smooveApiCommLatestFrom}}&latestDateTo={{smooveApiCommLatestTo}}&oldestDateFrom={{smooveApiCommOldestFrom}}&oldestDateTo={{smooveApiCommOldestTo}}","urlObject":{"path":["api","v1","communication",":contactId"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"latestDateFrom","value":"{{smooveApiCommLatestFrom}}"},{"key":"latestDateTo","value":"{{smooveApiCommLatestTo}}"},{"key":"oldestDateFrom","value":"{{smooveApiCommOldestFrom}}"},{"key":"oldestDateTo","value":"{{smooveApiCommOldestTo}}"}],"variable":[{"type":"any","value":"{{smooveApiCommContactId}}","key":"contactId"}]}},"response":[],"_postman_id":"48b9092c-9d63-4402-bb6a-aeb64e7c2550"}],"id":"6a5e9c23-2ddb-4cb2-a398-c9d6e7e2bae2","_postman_id":"6a5e9c23-2ddb-4cb2-a398-c9d6e7e2bae2","description":""},{"name":"leadgenerationcontentsnapshot","item":[{"name":"{fingerprint}","item":[],"id":"ef991555-d1d6-4db2-89d2-93e9d4e91f26","_postman_id":"ef991555-d1d6-4db2-89d2-93e9d4e91f26","description":""}],"id":"c1ffad95-ec55-45ca-bec3-507cde6c442f","_postman_id":"c1ffad95-ec55-45ca-bec3-507cde6c442f","description":""},{"name":"reminders","item":[{"name":"Communication Get Reminders","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst dateFrom = pm.environment.get(\"smooveApiDateFrom\");\nconst dateTo = new Date().toISOString();\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\npm.environment.set(\"smooveApiRemindersDateFrom\", dateFrom);\npm.environment.set(\"smooveApiRemindersDateTo\", dateTo);\n\ntry {\n    pm.request.url.query.upsert({ key: \"DateFrom\", value: dateFrom });\n    pm.request.url.query.upsert({ key: \"DateTo\", value: dateTo });\n    pm.request.url.query.upsert({ key: \"Page\", value: \"1\" });\n    pm.request.url.query.upsert({ key: \"PageSize\", value: \"50\" });\n} catch (e) {}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Pagination fields exist and stay consistent\", function () {\n    const json = pm.response.json();\n    [\"current\", \"pages\", \"size\", \"rows\", \"results\"].forEach(function (key) {\n        pm.expect(json, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(json.current, \"current\").to.be.a(\"number\").and.eql(1);\n    pm.expect(json.pages, \"pages\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(json.size, \"size\").to.be.a(\"number\").and.eql(50);\n    pm.expect(json.rows, \"rows\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(json.results, \"results\").to.be.an(\"array\");\n    pm.expect(json.results.length, \"results length\").to.eql(Math.min(json.rows, json.size));\n    pm.environment.set(\"smooveApiRemindersRows\", String(json.rows));\n});\n\npm.test(\"Reminder items have required fields when present\", function () {\n    const json = pm.response.json();\n    if (!json.results.length) {\n        pm.expect(json.rows, \"empty rows\").to.eql(0);\n        return;\n    }\n    const item = json.results[0];\n    [\"id\", \"timestamp\", \"siteId\", \"contactId\", \"status\", \"title\", \"type\", \"isMade\"].forEach(function (key) {\n        pm.expect(item, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(item.id, \"id\").to.be.a(\"number\").and.above(0);\n    pm.expect(item.timestamp, \"timestamp\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(item.timestamp)), \"timestamp parseable\").to.eql(false);\n    pm.expect(item.siteId, \"siteId\").to.be.a(\"number\");\n    pm.expect(item.contactId, \"contactId\").to.be.a(\"number\");\n    pm.expect(item.status, \"status\").to.be.a(\"string\").and.not.empty;\n    pm.expect(item.title, \"title\").to.be.a(\"string\");\n    pm.expect(item.type, \"type\").to.be.a(\"string\").and.not.empty;\n    pm.expect(item.isMade, \"isMade\").to.be.a(\"boolean\");\n});\n\n[\"smooveApiRemindersDateFrom\", \"smooveApiRemindersDateTo\"].forEach(function (k) {\n    pm.environment.unset(k);\n});"]}}],"id":"0073ff90-e51e-42bf-9526-7c011ff8aaf2","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/communication/reminders?DateFrom={{smooveApiRemindersDateFrom}}&DateTo={{smooveApiRemindersDateTo}}&Page=1&PageSize=50","urlObject":{"path":["api","v1","communication","reminders"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"DateFrom","value":"{{smooveApiRemindersDateFrom}}"},{"key":"DateTo","value":"{{smooveApiRemindersDateTo}}"},{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"0073ff90-e51e-42bf-9526-7c011ff8aaf2"}],"id":"157f6b4f-0326-42d5-a50c-b6f11cc71296","_postman_id":"157f6b4f-0326-42d5-a50c-b6f11cc71296","description":""},{"name":"remindersCount","item":[{"name":"Communication Get Reminders Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst dateFrom = pm.environment.get(\"smooveApiDateFrom\");\nconst dateTo = new Date().toISOString();\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\n// Cross-check against the reminders list (open/todo reminders drive the count).\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/communication/reminders?DateFrom=\" + encodeURIComponent(dateFrom) +\n        \"&DateTo=\" + encodeURIComponent(dateTo) + \"&Page=1&PageSize=1\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.expect(listRes.code, \"seed reminders list\").to.eql(200);\nconst listJson = listRes.json();\npm.expect(listJson, \"missing rows\").to.have.property(\"rows\");\npm.environment.set(\"smooveApiRemindersListRows\", String(listJson.rows));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const listRows = Number(pm.environment.get(\"smooveApiRemindersListRows\"));\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Reminders count is a finite non-negative number\", function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a(\"number\");\n    pm.expect(Number.isFinite(value)).to.be.true;\n    pm.expect(value).to.be.at.least(0);\n    // remindersCount is open/todo reminders; list without Status may differ,\n    // but both must be finite and the seeded list rows must be finite.\n    pm.expect(Number.isFinite(listRows)).to.be.true;\n    pm.expect(listRows).to.be.at.least(0);\n    // On this DEV account both are zero; if either is non-zero, count should be coherent.\n    if (listRows === 0) {\n        pm.expect(value, \"count when list is empty\").to.eql(0);\n    }\n});\n\npm.environment.unset(\"smooveApiRemindersListRows\");"]}}],"id":"21de1068-c1c3-441b-ae3a-bb18bf9a3fcd","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/communication/remindersCount","urlObject":{"path":["api","v1","communication","remindersCount"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"21de1068-c1c3-441b-ae3a-bb18bf9a3fcd"}],"id":"add5e746-1c87-4670-a1b6-cba88e49edc7","_postman_id":"add5e746-1c87-4670-a1b6-cba88e49edc7","description":""},{"name":"markReminderAsDone","item":[{"name":"{id}","item":[],"id":"23adfb1d-96db-4277-89fc-1b41e534a69c","_postman_id":"23adfb1d-96db-4277-89fc-1b41e534a69c","description":""}],"id":"58ebb083-17a4-444c-b527-07bb20b75a04","_postman_id":"58ebb083-17a4-444c-b527-07bb20b75a04","description":""}],"id":"eeb05847-e790-4cfd-a985-79a482613fc6","_postman_id":"eeb05847-e790-4cfd-a985-79a482613fc6","description":""},{"name":"contacts","item":[{"name":"search","item":[{"name":"Contacts Search","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\ntry {\n    const u = new URL(pm.request.url.toString());\n    [\"general\", \"pattern\", \"sort\", \"extra\", \"system\", \"bpmn\"].forEach(function (k) { u.searchParams.delete(k); });\n    pm.request.url = u.toString();\n} catch (e) {}\npm.request.body.update(JSON.stringify({ fields: [] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Search page consistency', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(json.results.length);\n    pm.expect(json.rows, 'rows').to.be.at.least(json.results.length);\n    if (json.results.length > 0) {\n        pm.expect(json.results[0], 'first result').to.have.property('id');\n        pm.expect(json.results[0].id, 'id').to.be.a('number').and.above(0);\n    }\n});"]}}],"id":"99a60b0a-c3df-4a94-92da-4b8f1f25d9cd","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"fields\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/search?page=1&pageSize=50&byUnsubscribed=false","urlObject":{"path":["api","v1","contacts","search"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"50"},{"key":"byUnsubscribed","value":"false"}],"variable":[]}},"response":[],"_postman_id":"99a60b0a-c3df-4a94-92da-4b8f1f25d9cd"}],"id":"b536203a-5f72-4384-8f49-60773eeaa4e2","_postman_id":"b536203a-5f72-4384-8f49-60773eeaa4e2","description":""},{"name":"create-list-from-search","item":[{"name":"Contacts Create List From Search","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\ntry {\n    const u = new URL(pm.request.url.toString());\n    [\"pattern\", \"fields\", \"general\", \"extra\", \"system\", \"bpmn\", \"sort\"].forEach(function (k) { u.searchParams.delete(k); });\n    u.searchParams.set(\"page\", \"1\");\n    u.searchParams.set(\"pageSize\", \"50\");\n    pm.request.url = u.toString();\n} catch (e) {}\npm.request.body.update(JSON.stringify({\n    name: \"postman_list_from_search_\" + ts,\n    description: \"postman temp list\",\n    isActive: true,\n    isPublic: false,\n    isPortal: false,\n    isDynamic: false,\n    allowRegistration: false\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    [\"id\",\"isActive\",\"contactsCount\",\"isPublic\",\"isPortal\",\"isDynamic\",\"isEvaluationInProgress\",\"allowRegistration\",\"isAttachedToBusinessJourney\"].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n    pm.expect(json.contactsCount, 'contactsCount').to.be.a('number');\n    pm.expect(json.isPublic, 'isPublic').to.be.a('boolean');\n    pm.expect(json.isPortal, 'isPortal').to.be.a('boolean');\n    pm.expect(json.isDynamic, 'isDynamic').to.be.a('boolean');\n    pm.expect(json.isEvaluationInProgress, 'isEvaluationInProgress').to.be.a('boolean');\n    pm.expect(json.allowRegistration, 'allowRegistration').to.be.a('boolean');\n    pm.expect(json.isAttachedToBusinessJourney, 'isAttachedToBusinessJourney').to.be.a('boolean');\n});\n\npm.test('Created list has a valid id and inactive evaluation', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.isActive, 'isActive').to.eql(true);\n    pm.expect(json.isPublic, 'isPublic').to.eql(false);\n    pm.expect(json.isPortal, 'isPortal').to.eql(false);\n    pm.expect(json.isDynamic, 'isDynamic').to.eql(false);\n    pm.expect(json.allowRegistration, 'allowRegistration').to.eql(false);\n    pm.expect(json.contactsCount, 'contactsCount').to.be.at.least(0);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const listId = pm.response.json() && pm.response.json().id;\n    if (!listId) return;\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\",\n        method: \"DELETE\",\n        header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" }\n    });\n    pm.test(\"Cleanup: list deleted successfully\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n}\n\nawait cleanUp();"]}}],"id":"c9a87747-f818-4a57-af82-48c73814f4e3","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"\",\n  \"description\": \"\",\n  \"isActive\": true,\n  \"isPublic\": false,\n  \"isPortal\": false,\n  \"isDynamic\": false,\n  \"allowRegistration\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/create-list-from-search","urlObject":{"path":["api","v1","contacts","create-list-from-search"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"c9a87747-f818-4a57-af82-48c73814f4e3"}],"id":"6dda7787-b5f7-4453-82ad-af6c1eb9d4ce","_postman_id":"6dda7787-b5f7-4453-82ad-af6c1eb9d4ce","description":""},{"name":"imports","item":[{"name":"analyzeCsv","item":[{"name":"Contact Imports Analyze Csv","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing analysis').to.have.property('analysis');\n    pm.expect(json.analysis, 'analysis').to.be.an('object');\n    ['encoding', 'delimiter', 'dimensions', 'sampleRows', 'aiCsvAnalysis'].forEach(function (key) {\n        pm.expect(json.analysis, 'missing analysis.' + key).to.have.property(key);\n    });\n    pm.expect(json.analysis.encoding, 'encoding').to.be.a('string');\n    pm.expect(json.analysis.delimiter, 'delimiter').to.be.a('string');\n    pm.expect(json.analysis.dimensions, 'dimensions').to.be.an('object');\n    pm.expect(json.analysis.sampleRows, 'sampleRows').to.be.an('array');\n    pm.expect(json.analysis.aiCsvAnalysis, 'aiCsvAnalysis').to.be.an('object');\n});\n\npm.test('Analysis echoes request CSV shape and mappings', function () {\n    const json = pm.response.json();\n    const a = json.analysis;\n    pm.expect(a.encoding, 'encoding').to.eql('utf-8');\n    pm.expect(a.delimiter, 'delimiter').to.eql(',');\n    pm.expect(a.dimensions.rows, 'rows').to.eql(2);\n    pm.expect(a.dimensions.columns, 'columns').to.eql(2);\n    pm.expect(a.sampleRows.length, 'sampleRows length').to.eql(2);\n    pm.expect(a.aiCsvAnalysis.mappings, 'mappings').to.be.an('array').and.have.lengthOf.at.least(1);\n    const keys = a.aiCsvAnalysis.mappings.map(function (m) { return m.contactFieldKey; });\n    pm.expect(keys, 'mapped fields').to.include('email');\n});"]}}],"id":"3cfc3faf-b39e-46a2-a3ca-f6a0c0df682b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"language\": \"en\",\n  \"encoding\": \"utf-8\",\n  \"delimiter\": \",\",\n  \"dimensions\": {\n    \"rows\": 2,\n    \"columns\": 2\n  },\n  \"sampleRows\": [\n    [\"email\", \"firstname\"],\n    [\"test@example.com\", \"Ada\"]\n  ],\n  \"contactFields\": [\n    {\n      \"key\": \"email\",\n      \"label\": \"Email\",\n      \"dataType\": \"string\",\n      \"isCustom\": false,\n      \"options\": []\n    },\n    {\n      \"key\": \"firstname\",\n      \"label\": \"First name\",\n      \"dataType\": \"string\",\n      \"isCustom\": false,\n      \"options\": []\n    }\n  ]\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/imports/analyzeCsv","urlObject":{"path":["api","v1","contacts","imports","analyzeCsv"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3cfc3faf-b39e-46a2-a3ca-f6a0c0df682b"}],"id":"f9c104bf-73e8-4c0d-be08-ec5e0a1d1806","_postman_id":"f9c104bf-73e8-4c0d-be08-ec5e0a1d1806","description":""},{"name":"modifyCsv","item":[{"name":"Contact Imports Modify Csv","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst siteId = Number(pm.environment.get(\"smooveApiAccountSiteId\") || 1);\n\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction headers() {\n    return {\n        \"Content-Type\": \"application/json\",\n        Accept: \"application/json\",\n        Cookie: `jvlpsi=${cookie};`\n    };\n}\n\nconst analyzePayload = {\n    language: \"en\",\n    encoding: \"utf-8\",\n    delimiter: \",\",\n    dimensions: { rows: 2, columns: 2 },\n    sampleRows: [[\"email\", \"firstname\"], [\"test@example.com\", \"Ada\"]],\n    contactFields: [\n        { key: \"email\", label: \"Email\", dataType: \"string\", isCustom: false, options: [] },\n        { key: \"firstname\", label: \"First name\", dataType: \"string\", isCustom: false, options: [] }\n    ]\n};\n\n// The API rejects a modify job whose analysis carries no modifications,\n// so the fixture always supplies one.\nconst modifications = [\n    { csvColumn: 1, reason: \"split full name into first name\", targetContactFieldKeys: [\"firstname\"] }\n];\n\nlet fingerprint = \"postman-test-fingerprint\";\nlet analysis = {\n    csvFingerprint: fingerprint,\n    encoding: \"utf-8\",\n    delimiter: \",\",\n    dimensions: { rows: 2, columns: 2 },\n    sampleRows: [[\"email\", \"firstname\"], [\"test@example.com\", \"Ada\"]],\n    aiCsvAnalysis: {\n        mappings: [{ csvColumn: 0, contactFieldKey: \"email\", confidence: 1 }],\n        modifications: modifications\n    }\n};\n\nconst analyzeRes = await send({\n    url: baseUrl + \"/api/v1/contacts/imports/analyzeCsv\",\n    method: \"POST\",\n    header: headers(),\n    body: { mode: \"raw\", raw: JSON.stringify(analyzePayload) }\n});\n\npm.environment.set(\"smooveApiCsvAnalyzeStatus\", String(analyzeRes.code));\n\nif (analyzeRes.code >= 200 && analyzeRes.code < 300) {\n    const analyzeJson = analyzeRes.json() || {};\n    const analyzed = analyzeJson.analysis || analyzeJson;\n    fingerprint = analyzed.csvFingerprint || fingerprint;\n    analysis = Object.assign({}, analysis, analyzed, { csvFingerprint: fingerprint });\n    if (!analysis.aiCsvAnalysis || !(analysis.aiCsvAnalysis.modifications || []).length) {\n        analysis.aiCsvAnalysis = Object.assign({}, analysis.aiCsvAnalysis, { modifications: modifications });\n    }\n    pm.environment.set(\"smooveApiCsvFingerprintDiscovered\", fingerprint !== \"postman-test-fingerprint\" ? \"true\" : \"false\");\n} else {\n    pm.environment.set(\"smooveApiCsvFingerprintDiscovered\", \"false\");\n}\n\npm.request.body.update(JSON.stringify({\n    siteId: siteId,\n    csvFingerprint: fingerprint,\n    analysis: analysis,\n    language: \"en\",\n    userPrompt: \"Map email and firstname columns\",\n    chatHistory: []\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a queued async operation', function () {\n    pm.response.to.be.json;\n    const json = pm.response.json();\n    if ((json) !== undefined) { pm.expect(json, 'response').to.be.an('object'); }\n    pm.expect(json.operationUuid, 'operationUuid').to.be.a('string').and.have.lengthOf.at.least(1);\n    pm.expect(json.status, 'status').to.be.a('string').and.have.lengthOf.at.least(1);\n});\n\npm.environment.unset(\"smooveApiCsvAnalyzeStatus\");\npm.environment.unset(\"smooveApiCsvFingerprintDiscovered\");"]}}],"id":"57826deb-bf6b-4f8c-b3a3-f13fdfd7b3d3","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"siteId\": 1,\n  \"csvFingerprint\": \"postman-test-fingerprint\",\n  \"analysis\": {\n    \"csvFingerprint\": \"postman-test-fingerprint\",\n    \"encoding\": \"utf-8\",\n    \"delimiter\": \",\",\n    \"dimensions\": { \"rows\": 2, \"columns\": 2 },\n    \"sampleRows\": [[\"email\", \"firstname\"], [\"test@example.com\", \"Ada\"]],\n    \"aiCsvAnalysis\": {\n      \"mappings\": [{ \"csvColumn\": 0, \"contactFieldKey\": \"email\", \"confidence\": 1 }],\n      \"modifications\": [{ \"csvColumn\": 1, \"reason\": \"split full name into first name\", \"targetContactFieldKeys\": [\"firstname\"] }]\n    }\n  },\n  \"language\": \"en\",\n  \"userPrompt\": \"Map email and firstname columns\",\n  \"chatHistory\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/imports/modifyCsv","urlObject":{"path":["api","v1","contacts","imports","modifyCsv"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"57826deb-bf6b-4f8c-b3a3-f13fdfd7b3d3"}],"id":"7306c5ef-7a40-4f94-b654-924acb7abdaf","_postman_id":"7306c5ef-7a40-4f94-b654-924acb7abdaf","description":""},{"name":"search","item":[{"name":"Contact Imports Search","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['results', 'current', 'pages', 'size', 'rows'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.results, 'results').to.be.an('array');\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n});\n\npm.test('Pinned contact import is completed', function () {\n    const json = pm.response.json();\n    const importId = Number(pm.environment.get('smooveApiContactImportId'));\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.results.length, 'results').to.be.at.most(json.size);\n    pm.expect(importId, 'smooveApiContactImportId').to.be.above(0);\n\n    const item = json.results.find(function (row) {\n        return row.importId === importId;\n    });\n    pm.expect(item, 'import ' + importId).to.be.an('object');\n    ['importId', 'importStartTime', 'importEndTime', 'listId', 'groupName', 'contactsAmount', 'importedContacts', 'updatedContacts', 'invalidContacts', 'blacklistedContacts', 'optInRequired', 'status'].forEach(function (key) {\n        pm.expect(item, 'import ' + importId + ' missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.importId, 'importId').to.eql(importId);\n    pm.expect(item.status, 'status').to.eql('completed');\n    pm.expect(item.optInRequired, 'optInRequired').to.be.a('boolean');\n    pm.expect(item.contactsAmount, 'contactsAmount').to.be.a('number').and.at.least(0);\n});"]}}],"id":"3d735b9e-c0b2-4f86-bd12-abc605178a67","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/imports/search?page=1&pageSize=50&pattern={{smooveApiContactImportId}}","urlObject":{"path":["api","v1","contacts","imports","search"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"50"},{"key":"pattern","value":"{{smooveApiContactImportId}}"}],"variable":[]}},"response":[],"_postman_id":"3d735b9e-c0b2-4f86-bd12-abc605178a67"}],"id":"9b9920be-cd9c-4cdc-ada5-78f37a4b85ba","_postman_id":"9b9920be-cd9c-4cdc-ada5-78f37a4b85ba","description":""},{"name":"count","item":[{"name":"Contact Imports Get Total Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const listRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/contacts/imports/search?Page=1&PageSize=1\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative integer', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isInteger(value), 'integer').to.eql(true);\n    pm.expect(value, 'imports count').to.be.at.least(0);\n});\n\npm.test('Count equals the total rows of the contact imports list', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    pm.expect(pm.response.json(), 'count').to.eql(listRes.json().rows);\n});"]}}],"id":"36940076-a6d8-46d7-8371-b25f8f285e6b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/imports/count","urlObject":{"path":["api","v1","contacts","imports","count"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"36940076-a6d8-46d7-8371-b25f8f285e6b"}],"id":"e16fa9a6-85b9-4498-a294-ff3f17834a1f","_postman_id":"e16fa9a6-85b9-4498-a294-ff3f17834a1f","description":""}],"id":"425326a8-7524-4cf6-bc99-acdbf2fa4f88","_postman_id":"425326a8-7524-4cf6-bc99-acdbf2fa4f88","description":""},{"name":"add-contacts-to-lists","item":[{"name":"Contacts Add Contacts To Lists","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction headers(extra) {\n    return Object.assign({\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    }, extra || {});\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction assertOk(res, label) {\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error((label || \"Request\") + \" failed with status \" + (res && res.code) + \": \" + (res && res.text && res.text()));\n    }\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/lists\",\n    method: \"POST\",\n    header: headers(),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            name: \"postman_add_to_list_\" + ts,\n            description: \"temp list for add-contacts-to-lists\",\n            isActive: true,\n            isPublic: false,\n            isPortal: false,\n            isDynamic: false,\n            allowRegistration: false\n        })\n    }\n});\nassertOk(listRes, \"Create list\");\nconst listId = listRes.json().id;\npm.environment.set(\"smooveApiTempListId\", listId);\n\nconst contactRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: headers(),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            email: \"postman.addlist.\" + ts + \"@smoove.smoove-api.postman.test\",\n            firstname: \"Postman\",\n            lastname: \"AddList\",\n            mailPermissions: true,\n            unsubscribed: false,\n            isDeleted: false\n        })\n    }\n});\nassertOk(contactRes, \"Create contact\");\nconst contactJson = contactRes.json();\nconst contactId = contactJson.id || (Array.isArray(contactJson) && contactJson[0] && contactJson[0].id);\npm.environment.set(\"smooveApiContactIdToDelete\", contactId);\n\n// Contract accepts listsIds with contactsIds (listId alone/with listsIds can 500 on DEV).\npm.request.body.update(JSON.stringify({\n    listsIds: [Number(listId)],\n    contactsIds: [Number(contactId)]\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nasync function followUpAndCleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const listId = Number(pm.environment.get(\"smooveApiTempListId\"));\n    const contactId = Number(pm.environment.get(\"smooveApiContactIdToDelete\"));\n    function send(opts) {\n        return new Promise(function (resolve, reject) {\n            pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n        });\n    }\n    const countRes = await send({\n        url: baseUrl + \"/api/v1/contacts/count?list=\" + listId,\n        method: \"GET\",\n        header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\", \"Accept\": \"application/json\" }\n    });\n    pm.test('Follow-up count shows contact on list', function () {\n        pm.expect(countRes.code, 'count status').to.eql(200);\n        const j = countRes.json();\n        pm.expect(j.active, 'active').to.be.at.least(1);\n    });\n    await send({ url: baseUrl + \"/api/v1/contacts/\" + contactId, method: \"DELETE\", header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" } });\n    await send({ url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\", method: \"DELETE\", header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" } });\n    pm.environment.unset(\"smooveApiTempListId\");\n    pm.environment.unset(\"smooveApiContactIdToDelete\");\n}\n\nawait followUpAndCleanUp();"]}}],"id":"5f2105f2-a054-42c9-adb0-694e464b2490","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"listId\": 0,\n  \"listsIds\": [],\n  \"contactsIds\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/add-contacts-to-lists","urlObject":{"path":["api","v1","contacts","add-contacts-to-lists"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"5f2105f2-a054-42c9-adb0-694e464b2490"}],"id":"dd56c038-a1b3-4054-832d-28c66843c0f2","_postman_id":"dd56c038-a1b3-4054-832d-28c66843c0f2","description":""},{"name":"remove-contacts-from-list","item":[{"name":"Contacts Remove Contacts From List","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction headers(extra) {\n    return Object.assign({\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    }, extra || {});\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction assertOk(res, label) {\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error((label || \"Request\") + \" failed with status \" + (res && res.code) + \": \" + (res && res.text && res.text()));\n    }\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/lists\",\n    method: \"POST\",\n    header: headers(),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            name: \"postman_remove_\" + ts,\n            description: \"temp list for remove-contacts-from-list\",\n            isActive: true,\n            isPublic: false,\n            isPortal: false,\n            isDynamic: false,\n            allowRegistration: false\n        })\n    }\n});\nassertOk(listRes, \"Create list\");\nconst listId = listRes.json().id;\npm.environment.set(\"smooveApiTempListId\", listId);\n\nconst contactRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: headers(),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            email: \"postman.removelist.\" + ts + \"@smoove.smoove-api.postman.test\",\n            firstname: \"Postman\",\n            lastname: \"RemoveList\",\n            lists: [listId],\n            mailPermissions: true,\n            unsubscribed: false,\n            isDeleted: false\n        })\n    }\n});\nassertOk(contactRes, \"Create contact on list\");\nconst contactId = contactRes.json().id || (contactRes.json()[0] && contactRes.json()[0].id);\npm.environment.set(\"smooveApiContactIdToDelete\", contactId);\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/contacts/\" + contactId,\n    method: \"GET\",\n    header: headers()\n});\nassertOk(getRes, \"Verify contact exists before remove-from-list\");\n\npm.request.body.update(JSON.stringify({\n    listId: Number(listId),\n    contactsIds: [Number(contactId)]\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nasync function followUpAndCleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const listId = Number(pm.environment.get(\"smooveApiTempListId\"));\n    const contactId = Number(pm.environment.get(\"smooveApiContactIdToDelete\"));\n    function send(opts) {\n        return new Promise(function (resolve, reject) {\n            pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n        });\n    }\n    const getRes = await send({\n        url: baseUrl + \"/api/v1/contacts/\" + contactId,\n        method: \"GET\",\n        header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\", \"Accept\": \"application/json\" }\n    });\n    pm.test('Follow-up GET shows contact removed from list', function () {\n        pm.expect(getRes.code, 'get status').to.eql(200);\n        const j = getRes.json();\n        const lists = Array.isArray(j.lists) ? j.lists : [];\n        const ids = lists.map(function (x) { return typeof x === 'object' ? Number(x.id || x.listId) : Number(x); });\n        pm.expect(ids, 'list membership').to.not.include(listId);\n    });\n    await send({ url: baseUrl + \"/api/v1/contacts/\" + contactId, method: \"DELETE\", header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" } });\n    await send({ url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\", method: \"DELETE\", header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" } });\n    pm.environment.unset(\"smooveApiTempListId\");\n    pm.environment.unset(\"smooveApiContactIdToDelete\");\n}\n\nawait followUpAndCleanUp();"]}}],"id":"60cb42f1-a0af-4066-9c08-f94058ed695a","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"listId\": 0,\n  \"contactsIds\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/remove-contacts-from-list","urlObject":{"path":["api","v1","contacts","remove-contacts-from-list"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"60cb42f1-a0af-4066-9c08-f94058ed695a"}],"id":"bee21fe6-25f0-44e0-9d7f-9e6ec76767e4","_postman_id":"bee21fe6-25f0-44e0-9d7f-9e6ec76767e4","description":""},{"name":"create-list-from-bpmn-transitions","item":[{"name":"Contacts Create List From Bpmn Transitions","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nconst listName = \"postman_bpmn_list_\" + ts;\npm.environment.set(\"smooveApiBpmnListName\", listName);\n\n// bpmn must be the full ContactTransitionsHelper filter\n// (id,element,,from,till,unique) — a bare automation id returns 500.\nconst bpmnFilter = String(pm.environment.get(\"smooveApiCreateListFromBpmnFilter\") || \"\").trim();\npm.request.url = bpmnFilter\n    ? baseUrl + \"/api/v1/contacts/create-list-from-bpmn-transitions?bpmn=\" + encodeURIComponent(bpmnFilter)\n    : baseUrl + \"/api/v1/contacts/create-list-from-bpmn-transitions\";\npm.request.body.update(JSON.stringify({\n    name: listName,\n    description: \"postman temp list\",\n    isActive: true,\n    isPublic: false,\n    isPortal: false,\n    isDynamic: false,\n    allowRegistration: false\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    [\"id\",\"isActive\",\"contactsCount\",\"isPublic\",\"isPortal\",\"isDynamic\",\"isEvaluationInProgress\",\"allowRegistration\",\"isAttachedToBusinessJourney\"].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n    pm.expect(json.contactsCount, 'contactsCount').to.be.a('number');\n    pm.expect(json.isPublic, 'isPublic').to.be.a('boolean');\n    pm.expect(json.isPortal, 'isPortal').to.be.a('boolean');\n    pm.expect(json.isDynamic, 'isDynamic').to.be.a('boolean');\n    pm.expect(json.isEvaluationInProgress, 'isEvaluationInProgress').to.be.a('boolean');\n    pm.expect(json.allowRegistration, 'allowRegistration').to.be.a('boolean');\n    pm.expect(json.isAttachedToBusinessJourney, 'isAttachedToBusinessJourney').to.be.a('boolean');\n});\n\npm.test('Created list has a valid id and echoes the requested name when present', function () {\n    const json = pm.response.json();\n    const expectedName = pm.environment.get(\"smooveApiBpmnListName\");\n    pm.expect(json.id, 'id').to.be.above(0);\n    if (json.name != null) {\n        pm.expect(json.name, 'name').to.eql(expectedName);\n    }\n});\n\n// Fire-and-forget cleanup so timeouts do not fail the request.\nconst listId = pm.response.json() && pm.response.json().id;\nif (listId) {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    pm.sendRequest({\n        url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\",\n        method: \"DELETE\",\n        header: { Cookie: \"jvlpsi=\" + cookie + \";\" }\n    }, function () {});\n}\npm.environment.unset(\"smooveApiBpmnListName\");"]}}],"id":"ec391a25-80c0-4e4e-9bd3-7e653ad5ee04","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"postman_bpmn_list_placeholder\",\n  \"description\": \"postman temp\",\n  \"isActive\": true,\n  \"isPublic\": false,\n  \"isPortal\": false,\n  \"isDynamic\": false,\n  \"allowRegistration\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/create-list-from-bpmn-transitions","urlObject":{"path":["api","v1","contacts","create-list-from-bpmn-transitions"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"ec391a25-80c0-4e4e-9bd3-7e653ad5ee04"}],"id":"700d773c-db58-4b7c-a447-32e161633698","_postman_id":"700d773c-db58-4b7c-a447-32e161633698","description":""},{"name":"verifyDelete","item":[{"name":"Contacts Verify Delete","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is true: idCount is within the account limit', function () {\n    pm.expect(pm.response.json()).to.eql(true);\n});"]}}],"id":"37711fb0-c74a-4c1a-aaa8-39e65a950557","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/verifyDelete?idCount={{smooveApiVerifyIdCount}}","urlObject":{"path":["api","v1","contacts","verifyDelete"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"idCount","value":"{{smooveApiVerifyIdCount}}"}],"variable":[]}},"response":[],"_postman_id":"37711fb0-c74a-4c1a-aaa8-39e65a950557"}],"id":"a8531de9-4cac-4850-b76e-0f01ddc2a652","_postman_id":"a8531de9-4cac-4850-b76e-0f01ddc2a652","description":""},{"name":"verifyUnsubscribe","item":[{"name":"Contacts Verify Unsubscribe","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is true: idCount is within the account limit', function () {\n    pm.expect(pm.response.json()).to.eql(true);\n});"]}}],"id":"b95e6fe0-a252-4818-9f59-6864e35e1731","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/verifyUnsubscribe?idCount={{smooveApiVerifyIdCount}}","urlObject":{"path":["api","v1","contacts","verifyUnsubscribe"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"idCount","value":"{{smooveApiVerifyIdCount}}"}],"variable":[]}},"response":[],"_postman_id":"b95e6fe0-a252-4818-9f59-6864e35e1731"}],"id":"8d5d49bf-2756-4305-85cf-acfbd56df489","_postman_id":"8d5d49bf-2756-4305-85cf-acfbd56df489","description":""},{"name":"verifyAdd","item":[{"name":"Contacts Verify Add","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is true: idCount is within the account limit', function () {\n    pm.expect(pm.response.json()).to.eql(true);\n});"]}}],"id":"a8b4ff2c-be0c-419c-8a17-e78ce70d64d8","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/verifyAdd?idCount={{smooveApiVerifyIdCount}}","urlObject":{"path":["api","v1","contacts","verifyAdd"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"idCount","value":"{{smooveApiVerifyIdCount}}"}],"variable":[]}},"response":[],"_postman_id":"a8b4ff2c-be0c-419c-8a17-e78ce70d64d8"}],"id":"0409230f-62d3-4b83-9dd6-74882bcc2004","_postman_id":"0409230f-62d3-4b83-9dd6-74882bcc2004","description":""},{"name":"{id}","item":[{"name":"restore","item":[{"name":"Contacts Restore","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: { mode: \"raw\", raw: JSON.stringify({ email: \"postman.restore.\" + ts + \"@smoove.smoove-api.postman.test\", firstname: \"Postman\", lastname: \"Restore\", mailPermissions: true, unsubscribed: false, isDeleted: false }) }\n});\nif (!createRes || (createRes.code !== 200 && createRes.code !== 201)) {\n    throw new Error(\"Create contact before restore failed\");\n}\nconst contactId = createRes.json().id;\nconst delRes = await send({ url: baseUrl + \"/api/v1/contacts/\" + contactId, method: \"DELETE\", header: { \"Cookie\": `jvlpsi=${cookie};` } });\nif (!delRes || ![200, 201, 204].includes(delRes.code)) {\n    throw new Error(\"Soft-delete before restore failed\");\n}\npm.environment.set(\"smooveApiContactIdToRestore\", String(contactId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing message').to.have.property('message');\n    pm.expect(json.message, 'message').to.be.a('string');\n});\n\npm.test('Message is non-empty and meaningful', function () {\n    const json = pm.response.json();\n    pm.expect(json.message, 'message').to.not.equal('');\n    pm.expect(json.message.toLowerCase(), 'message').to.match(/restor/);\n});\n\nconst cleanupRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/contacts/\" + pm.environment.get(\"smooveApiContactIdToRestore\"),\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\npm.test(\"The seeded contact is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete contact status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiContactIdToRestore\");"]}}],"id":"5903ec42-e17c-4d1f-a966-9d0a9f091c4e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/:id/restore","urlObject":{"path":["api","v1","contacts",":id","restore"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiContactIdToRestore}}","key":"id"}]}},"response":[],"_postman_id":"5903ec42-e17c-4d1f-a966-9d0a9f091c4e"}],"id":"4b18431e-8ecc-475c-8e0c-e7ee25028c2c","_postman_id":"4b18431e-8ecc-475c-8e0c-e7ee25028c2c","description":""},{"name":"unsubscribe","item":[{"name":"Contacts Unsubscribe","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: { mode: \"raw\", raw: JSON.stringify({ email: \"postman.unsub.\" + ts + \"@smoove.smoove-api.postman.test\", firstname: \"Postman\", lastname: \"Temp\", mailPermissions: true, unsubscribed: false, isDeleted: false }) }\n});\nif (!createRes || (createRes.code !== 200 && createRes.code !== 201)) {\n    throw new Error(\"Create contact failed with status \" + (createRes && createRes.code));\n}\nconst contactId = createRes.json().id;\nif (!contactId) { throw new Error(\"Create contact returned no id\"); }\npm.environment.set(\"smooveApiContactIdToUnsubscribe\", String(contactId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing message').to.have.property('message');\n    pm.expect(json.message, 'message').to.be.a('string');\n});\n\npm.test('Message is non-empty and meaningful', function () {\n    const json = pm.response.json();\n    pm.expect(json.message, 'message').to.not.equal('');\n    pm.expect(json.message.toLowerCase(), 'message').to.include('unsubscribed');\n});\n\nconst cleanupRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/contacts/\" + pm.environment.get(\"smooveApiContactIdToUnsubscribe\"),\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\npm.test(\"The seeded contact is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete contact status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiContactIdToUnsubscribe\");"]}}],"id":"da05c690-09a7-40b4-99dc-c61ba5335544","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/:id/unsubscribe?reason=","urlObject":{"path":["api","v1","contacts",":id","unsubscribe"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"reason","value":""}],"variable":[{"type":"any","value":"{{smooveApiContactIdToUnsubscribe}}","key":"id"}]}},"response":[],"_postman_id":"da05c690-09a7-40b4-99dc-c61ba5335544"}],"id":"23c27907-9464-497b-9206-9979317182eb","_postman_id":"23c27907-9464-497b-9206-9979317182eb","description":""},{"name":"unsubscribeAllSimilar","item":[{"name":"Contacts Unsubscribe All Similar","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: { mode: \"raw\", raw: JSON.stringify({ email: \"postman.unsubsim.\" + ts + \"@smoove.smoove-api.postman.test\", firstname: \"Postman\", lastname: \"Temp\", mailPermissions: true, unsubscribed: false, isDeleted: false }) }\n});\nif (!createRes || (createRes.code !== 200 && createRes.code !== 201)) {\n    throw new Error(\"Create contact failed with status \" + (createRes && createRes.code));\n}\nconst contactId = createRes.json().id;\nif (!contactId) { throw new Error(\"Create contact returned no id\"); }\npm.environment.set(\"smooveApiContactIdToUnsubSimilar\", String(contactId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing message').to.have.property('message');\n    pm.expect(json.message, 'message').to.be.a('string');\n});\n\npm.test('Message is non-empty and meaningful', function () {\n    const json = pm.response.json();\n    pm.expect(json.message, 'message').to.not.equal('');\n    pm.expect(json.message.toLowerCase(), 'message').to.include('unsubscribed');\n});\n\nconst cleanupRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/contacts/\" + pm.environment.get(\"smooveApiContactIdToUnsubSimilar\"),\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\npm.test(\"The seeded contact is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete contact status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiContactIdToUnsubSimilar\");"]}}],"id":"09757cc2-76dc-47d2-95a6-ab23360957ee","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/:id/unsubscribeAllSimilar?reason=&suppressWarnings=false","urlObject":{"path":["api","v1","contacts",":id","unsubscribeAllSimilar"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"reason","value":""},{"key":"suppressWarnings","value":"false"}],"variable":[{"type":"any","value":"{{smooveApiContactIdToUnsubSimilar}}","key":"id"}]}},"response":[],"_postman_id":"09757cc2-76dc-47d2-95a6-ab23360957ee"}],"id":"eff0e770-c4ef-46a9-bcf2-037d47282282","_postman_id":"eff0e770-c4ef-46a9-bcf2-037d47282282","description":""},{"name":"resubscribe","item":[{"name":"Contacts Resubscribe","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            email: \"postman.resub.\" + ts + \"@smoove.smoove-api.postman.test\",\n            firstname: \"Postman\",\n            lastname: \"Resub\",\n            mailPermissions: true,\n            unsubscribed: false,\n            isDeleted: false\n        })\n    }\n});\nconst contactId = createRes.json().id;\nawait send({\n    url: baseUrl + \"/api/v1/contacts/\" + contactId + \"/unsubscribe?reason=postman\",\n    method: \"POST\",\n    header: { \"Cookie\": `jvlpsi=${cookie};` }\n});\npm.environment.set(\"smooveApiContactId\", String(contactId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing message').to.have.property('message');\n    pm.expect(json.message, 'message').to.be.a('string');\n});\n\npm.test('Message confirms resubscribe for prepared contact', function () {\n    const json = pm.response.json();\n    const id = pm.environment.get(\"smooveApiContactId\");\n    pm.expect(json.message, 'message').to.include(String(id));\n    pm.expect(json.message.toLowerCase(), 'message').to.include('resubscribed');\n});\n\nasync function followUpAndCleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const id = pm.environment.get(\"smooveApiContactId\");\n    if (!id) return;\n    await pm.sendRequest({\n        url: baseUrl + \"/api/v1/contacts/\" + id,\n        method: \"DELETE\",\n        header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" }\n    });\n    pm.environment.unset(\"smooveApiContactId\");\n}\n\nawait followUpAndCleanUp();"]}}],"id":"847c337a-4a00-4773-98db-e0e5cc47fe2c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/:id/resubscribe","urlObject":{"path":["api","v1","contacts",":id","resubscribe"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiContactId}}","key":"id"}]}},"response":[],"_postman_id":"847c337a-4a00-4773-98db-e0e5cc47fe2c"}],"id":"b2343ab9-1b5a-4dda-b554-5c4436d6c88a","_postman_id":"b2343ab9-1b5a-4dda-b554-5c4436d6c88a","description":""},{"name":"Contacts Delete","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction headers(extra) {\n    return Object.assign({\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    }, extra || {});\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction assertOk(res, label) {\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error((label || \"Request\") + \" failed with status \" + (res && res.code) + \": \" + (res && res.text && res.text()));\n    }\n}\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: headers(),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            email: \"postman.delete.\" + ts + \"@smoove.smoove-api.postman.test\",\n            firstname: \"Postman\",\n            lastname: \"Delete\",\n            mailPermissions: true,\n            smsPermissions: false,\n            unsubscribed: false,\n            isDeleted: false\n        })\n    }\n});\nassertOk(createRes, \"Create contact\");\nconst created = createRes.json();\nconst contactId = created.id || (Array.isArray(created) && created[0] && created[0].id);\nif (!contactId) throw new Error(\"Create contact did not return an id: \" + createRes.text());\npm.environment.set(\"smooveApiContactIdToDelete\", contactId);\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/contacts/\" + contactId,\n    method: \"GET\",\n    header: headers()\n});\nassertOk(getRes, \"Verify contact exists\");"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array of deleted contacts', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array').and.have.lengthOf.at.least(1);\n    const item = json[0];\n    [\"id\",\"firstname\",\"lastname\",\"externalId\",\"password\",\"email\",\"cellPhone\",\"phone\",\"city\",\"country\",\"company\",\"position\",\"address\",\"ipAddress\",\"mailPermissions\",\"smsPermissions\",\"contactCanReceiveWhatsappMessages\",\"joinSource\",\"addedAt\",\"unsubscribed\",\"isDeleted\",\"timestamp\"].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.email, 'email').to.be.a('string');\n    pm.expect(item.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(item.mailPermissions, 'mailPermissions').to.be.a('boolean');\n    pm.expect(item.smsPermissions, 'smsPermissions').to.be.a('boolean');\n    pm.expect(item.unsubscribed, 'unsubscribed').to.be.a('boolean');\n    pm.expect(item.timestamp, 'timestamp').to.be.a('string');\n});\n\npm.test('Deleted contact matches prepared id and is marked deleted', function () {\n    const expectedId = Number(pm.environment.get(\"smooveApiContactIdToDelete\"));\n    const item = pm.response.json()[0];\n    pm.expect(expectedId, 'prepared id').to.be.above(0);\n    pm.expect(item.id, 'id').to.eql(expectedId);\n    pm.expect(item.isDeleted, 'isDeleted').to.eql(true);\n});\n\nasync function followUpAndCleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const id = pm.environment.get(\"smooveApiContactIdToDelete\");\n    function send(opts) {\n        return new Promise(function (resolve, reject) {\n            pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n        });\n    }\n    const getRes = await send({\n        url: baseUrl + \"/api/v1/contacts/\" + id,\n        method: \"GET\",\n        header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\", \"Accept\": \"application/json\" }\n    });\n    pm.test('Follow-up GET shows contact is deleted or gone', function () {\n        pm.expect([200, 404]).to.include(getRes.code);\n        if (getRes.code === 200) {\n            const j = getRes.json();\n            pm.expect(j.isDeleted, 'isDeleted after delete').to.eql(true);\n        }\n    });\n    pm.environment.unset(\"smooveApiContactIdToDelete\");\n}\n\nawait followUpAndCleanUp();"]}}],"id":"e7c381c2-af8a-427a-99f0-0cb4527bb704","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/:id","urlObject":{"path":["api","v1","contacts",":id"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiContactIdToDelete}}","key":"id"}]}},"response":[],"_postman_id":"e7c381c2-af8a-427a-99f0-0cb4527bb704"},{"name":"Contacts Put","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: { mode: \"raw\", raw: JSON.stringify({ email: \"postman.put.\" + ts + \"@smoove.smoove-api.postman.test\", firstname: \"Postman\", lastname: \"Temp\", mailPermissions: true, unsubscribed: false, isDeleted: false }) }\n});\nif (!createRes || (createRes.code !== 200 && createRes.code !== 201)) {\n    throw new Error(\"Create contact failed with status \" + (createRes && createRes.code));\n}\nconst created = createRes.json();\nconst contactId = created.id;\nconst email = created.email;\nif (!contactId) { throw new Error(\"Create contact returned no id\"); }\nif (!email) { throw new Error(\"Create contact returned no email\"); }\npm.environment.set(\"smooveApiContactIdToUpdate\", String(contactId));\n\n// \"extra\" must be present: the update path only loads the contact's extra-info\n// row when the payload carries the key, and omitting it makes the API 500.\npm.request.body.update(JSON.stringify({\n    email: email,\n    firstname: \"PostmanUpdated\",\n    lastname: \"TempUpdated\",\n    mailPermissions: true,\n    unsubscribed: false,\n    isDeleted: false,\n    extra: {}\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    [\"id\",\"firstname\",\"lastname\",\"externalId\",\"password\",\"email\",\"cellPhone\",\"phone\",\"city\",\"country\",\"company\",\"position\",\"address\",\"ipAddress\",\"mailPermissions\",\"smsPermissions\",\"contactCanReceiveWhatsappMessages\",\"joinSource\",\"addedAt\",\"extra\",\"unsubscribed\",\"isDeleted\",\"subscribedAt\",\"timestamp\"].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.firstname, 'firstname').to.be.a('string');\n    pm.expect(json.lastname, 'lastname').to.be.a('string');\n    pm.expect(json.externalId, 'externalId').to.be.a('string');\n    pm.expect(json.password, 'password').to.be.a('string');\n    pm.expect(json.email, 'email').to.be.a('string');\n    pm.expect(json.cellPhone, 'cellPhone').to.be.a('string');\n    pm.expect(json.phone, 'phone').to.be.a('string');\n    pm.expect(json.city, 'city').to.be.a('string');\n    pm.expect(json.country, 'country').to.be.a('string');\n    pm.expect(json.company, 'company').to.be.a('string');\n    pm.expect(json.position, 'position').to.be.a('string');\n    pm.expect(json.address, 'address').to.be.a('string');\n    pm.expect(json.ipAddress, 'ipAddress').to.be.a('string');\n    pm.expect(json.mailPermissions, 'mailPermissions').to.be.a('boolean');\n    pm.expect(json.smsPermissions, 'smsPermissions').to.be.a('boolean');\n    pm.expect(json.contactCanReceiveWhatsappMessages, 'contactCanReceiveWhatsappMessages').to.be.a('boolean');\n    pm.expect(json.joinSource, 'joinSource').to.be.a('number');\n    pm.expect(json.addedAt, 'addedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.addedAt)), 'addedAt parseable').to.eql(false);\n    pm.expect(json.extra, 'extra').to.be.an('object');\n    pm.expect(json.unsubscribed, 'unsubscribed').to.be.a('boolean');\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.subscribedAt, 'subscribedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.subscribedAt)), 'subscribedAt parseable').to.eql(false);\n    pm.expect(json.timestamp, 'timestamp').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.timestamp)), 'timestamp parseable').to.eql(false);\n});\n\npm.test('Updated contact echoes request identity', function () {\n    const json = pm.response.json();\n    const expectedId = Number(pm.environment.get('smooveApiContactIdToUpdate'));\n    pm.expect(json.id, 'id').to.eql(expectedId);\n    pm.expect(json.firstname, 'firstname').to.eql('PostmanUpdated');\n    pm.expect(json.lastname, 'lastname').to.eql('TempUpdated');\n    pm.expect(json.mailPermissions, 'mailPermissions').to.eql(true);\n    pm.expect(json.unsubscribed, 'unsubscribed').to.eql(false);\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n    pm.expect(json.extra, 'extra').to.be.an('object');\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const cleanupId = pm.environment.get(\"smooveApiContactIdToUpdate\");\n    if (!cleanupId) return;\n\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/contacts/\" + cleanupId,\n        method: \"DELETE\",\n        header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" }\n    });\n    pm.test(\"Cleanup: contact deleted successfully\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n    pm.environment.unset(\"smooveApiContactIdToUpdate\");\n}\n\nawait cleanUp();"]}}],"id":"9a650ce2-006c-495d-9192-12a6de5a9547","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"email\": \"postman.update.placeholder@smoove.smoove-api.postman.test\",\n  \"firstname\": \"Postman\",\n  \"lastname\": \"Updated\",\n  \"mailPermissions\": true,\n  \"unsubscribed\": false,\n  \"isDeleted\": false,\n  \"extra\": {}\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/:id?suppressWarnings=true","urlObject":{"path":["api","v1","contacts",":id"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"suppressWarnings","value":"true"}],"variable":[{"type":"any","value":"{{smooveApiContactIdToUpdate}}","key":"id"}]}},"response":[],"_postman_id":"9a650ce2-006c-495d-9192-12a6de5a9547"},{"name":"Contacts Get","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            email: \"postman.get.\" + ts + \"@smoove.smoove-api.postman.test\",\n            firstname: \"Postman\",\n            lastname: \"Get\",\n            mailPermissions: true,\n            smsPermissions: false,\n            unsubscribed: false,\n            isDeleted: false\n        })\n    }\n});\nif (!createRes || (createRes.code !== 200 && createRes.code !== 201)) {\n    throw new Error(\"Create contact before GET failed: \" + (createRes && createRes.code));\n}\nconst contactId = createRes.json().id;\npm.environment.set(\"smooveApiContactId\", String(contactId));\npm.environment.set(\"smooveApiContactGetEmail\", createRes.json().email);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    [\"id\",\"firstname\",\"lastname\",\"externalId\",\"password\",\"email\",\"cellPhone\",\"phone\",\"city\",\"country\",\"company\",\"position\",\"address\",\"ipAddress\",\"mailPermissions\",\"smsPermissions\",\"contactCanReceiveWhatsappMessages\",\"joinSource\",\"addedAt\",\"extra\",\"unsubscribed\",\"isDeleted\",\"subscribedAt\",\"timestamp\",\"lists\"].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.firstname, 'firstname').to.be.a('string');\n    pm.expect(json.lastname, 'lastname').to.be.a('string');\n    pm.expect(json.externalId, 'externalId').to.be.a('string');\n    pm.expect(json.password, 'password').to.be.a('string');\n    pm.expect(json.email, 'email').to.be.a('string');\n    pm.expect(json.cellPhone, 'cellPhone').to.be.a('string');\n    pm.expect(json.phone, 'phone').to.be.a('string');\n    pm.expect(json.city, 'city').to.be.a('string');\n    pm.expect(json.country, 'country').to.be.a('string');\n    pm.expect(json.company, 'company').to.be.a('string');\n    pm.expect(json.position, 'position').to.be.a('string');\n    pm.expect(json.address, 'address').to.be.a('string');\n    pm.expect(json.ipAddress, 'ipAddress').to.be.a('string');\n    pm.expect(json.mailPermissions, 'mailPermissions').to.be.a('boolean');\n    pm.expect(json.smsPermissions, 'smsPermissions').to.be.a('boolean');\n    pm.expect(json.contactCanReceiveWhatsappMessages, 'contactCanReceiveWhatsappMessages').to.be.a('boolean');\n    pm.expect(json.joinSource, 'joinSource').to.be.a('number');\n    pm.expect(json.addedAt, 'addedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.addedAt)), 'addedAt parseable').to.eql(false);\n    pm.expect(json.extra, 'extra').to.be.an('object');\n    pm.expect(json.unsubscribed, 'unsubscribed').to.be.a('boolean');\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.subscribedAt, 'subscribedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.subscribedAt)), 'subscribedAt parseable').to.eql(false);\n    pm.expect(json.timestamp, 'timestamp').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.timestamp)), 'timestamp parseable').to.eql(false);\n    pm.expect(json.lists, 'lists').to.be.an('array');\n});\n\npm.test('Contact identity echoes created contact', function () {\n    const json = pm.response.json();\n    const expectedId = Number(pm.environment.get(\"smooveApiContactId\"));\n    const expectedEmail = pm.environment.get(\"smooveApiContactGetEmail\");\n    pm.expect(json.id, 'id').to.eql(expectedId);\n    pm.expect(json.email, 'email').to.eql(expectedEmail);\n    pm.expect(json.firstname, 'firstname').to.eql('Postman');\n    pm.expect(json.lastname, 'lastname').to.eql('Get');\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const id = pm.environment.get(\"smooveApiContactId\");\n    if (!id) return;\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/contacts/\" + id,\n        method: \"DELETE\",\n        header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" }\n    });\n    pm.test(\"Cleanup: contact deleted successfully\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n    pm.environment.unset(\"smooveApiContactId\");\n    pm.environment.unset(\"smooveApiContactGetEmail\");\n}\n\nawait cleanUp();"]}}],"id":"3fd964fa-f116-42be-819a-5c6de07ebbb3","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/:id","urlObject":{"path":["api","v1","contacts",":id"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiContactId}}","key":"id"}]}},"response":[],"_postman_id":"3fd964fa-f116-42be-819a-5c6de07ebbb3"}],"id":"f30ceac0-e488-4ef5-94a4-b0bce4cf4ba2","_postman_id":"f30ceac0-e488-4ef5-94a4-b0bce4cf4ba2","description":""},{"name":"restore","item":[{"name":"Contacts Bulk Restore","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: { mode: \"raw\", raw: JSON.stringify({ email: \"postman.bulkrestore.\" + ts + \"@smoove.smoove-api.postman.test\", firstname: \"Postman\", lastname: \"BulkRestore\", mailPermissions: true, unsubscribed: false, isDeleted: false }) }\n});\nif (!createRes || (createRes.code !== 200 && createRes.code !== 201)) {\n    throw new Error(\"Create contact before bulk restore failed\");\n}\nconst contactId = createRes.json().id;\npm.environment.set(\"smooveApiContactIdToBulkRestore\", String(contactId));\nawait send({ url: baseUrl + \"/api/v1/contacts/\" + contactId, method: \"DELETE\", header: { \"Cookie\": `jvlpsi=${cookie};` } });\npm.request.body.update(JSON.stringify({ ids: [Number(contactId)] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing message').to.have.property('message');\n    pm.expect(json.message, 'message').to.be.a('string');\n});\n\npm.test('Message is non-empty and meaningful', function () {\n    const json = pm.response.json();\n    pm.expect(json.message, 'message').to.not.equal('');\n    pm.expect(json.message.toLowerCase(), 'message').to.match(/restor|success/);\n});\n\nconst cleanupRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/contacts/\" + pm.environment.get(\"smooveApiContactIdToBulkRestore\"),\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\npm.test(\"The seeded contact is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete contact status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiContactIdToBulkRestore\");"]}}],"id":"296a2f9e-99be-4e42-9a0d-1a81ccecb9cd","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/restore","urlObject":{"path":["api","v1","contacts","restore"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"296a2f9e-99be-4e42-9a0d-1a81ccecb9cd"}],"id":"5f08c6f6-e781-4389-ab9f-15fc3451413c","_postman_id":"5f08c6f6-e781-4389-ab9f-15fc3451413c","description":""},{"name":"unsubscribed","item":[{"name":"{id}","item":[{"name":"Contacts Get Unsubscribed","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: { mode: \"raw\", raw: JSON.stringify({ email: \"postman.getunsub.\" + ts + \"@smoove.smoove-api.postman.test\", firstname: \"Postman\", lastname: \"GetUnsub\", mailPermissions: true, unsubscribed: false, isDeleted: false }) }\n});\nif (!createRes || (createRes.code !== 200 && createRes.code !== 201)) {\n    throw new Error(\"Create contact before get-unsubscribed failed\");\n}\nconst contactId = createRes.json().id;\nawait send({ url: baseUrl + \"/api/v1/contacts/\" + contactId + \"/unsubscribe?reason=postman\", method: \"POST\", header: { \"Cookie\": `jvlpsi=${cookie};` } });\npm.environment.set(\"smooveApiContactIdUnsubscribed\", String(contactId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'firstname', 'lastname', 'externalId', 'email', 'phone', 'cellPhone', 'company', 'position', 'country', 'city', 'addedAt', 'unsubscribeDate'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.firstname, 'firstname').to.be.a('string');\n    pm.expect(json.lastname, 'lastname').to.be.a('string');\n    pm.expect(json.externalId, 'externalId').to.be.a('string');\n    pm.expect(json.email, 'email').to.be.a('string');\n    pm.expect(json.phone, 'phone').to.be.a('string');\n    pm.expect(json.cellPhone, 'cellPhone').to.be.a('string');\n    pm.expect(json.company, 'company').to.be.a('string');\n    pm.expect(json.position, 'position').to.be.a('string');\n    pm.expect(json.country, 'country').to.be.a('string');\n    pm.expect(json.city, 'city').to.be.a('string');\n    pm.expect(json.addedAt, 'addedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.addedAt)), 'addedAt parseable').to.eql(false);\n    pm.expect(json.unsubscribeDate, 'unsubscribeDate').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.unsubscribeDate)), 'unsubscribeDate parseable').to.eql(false);\n});\n\npm.test('Unsubscribed contact id is positive with email', function () {\n    const json = pm.response.json();\n    const expectedId = Number(pm.environment.get(\"smooveApiContactIdUnsubscribed\"));\n    pm.expect(json.id, 'id').to.eql(expectedId);\n    pm.expect(json.email, 'email').to.be.a('string').and.include('postman.getunsub.');\n    pm.expect(json.unsubscribeDate, 'unsubscribeDate').to.be.a('string').and.not.equal('');\n});\n\nasync function followUpAndCleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const id = pm.environment.get(\"smooveApiContactIdUnsubscribed\");\n    if (!id) return;\n    await pm.sendRequest({\n        url: baseUrl + \"/api/v1/contacts/\" + id,\n        method: \"DELETE\",\n        header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" }\n    });\n    pm.environment.unset(\"smooveApiContactIdUnsubscribed\");\n}\n\nawait followUpAndCleanUp();"]}}],"id":"a76413eb-015b-4531-afef-bf85d431f567","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/unsubscribed/:id","urlObject":{"path":["api","v1","contacts","unsubscribed",":id"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiContactIdUnsubscribed}}","key":"id"}]}},"response":[],"_postman_id":"a76413eb-015b-4531-afef-bf85d431f567"}],"id":"c7cb9d93-972e-4fbc-979b-47595bf7b562","_postman_id":"c7cb9d93-972e-4fbc-979b-47595bf7b562","description":""}],"id":"5b234037-015a-46da-89d3-ceb06798d6c7","_postman_id":"5b234037-015a-46da-89d3-ceb06798d6c7","description":""},{"name":"resubscribe","item":[{"name":"Contacts Bulk Resubscribe","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            email: \"postman.bulkresub.\" + ts + \"@smoove.smoove-api.postman.test\",\n            firstname: \"Postman\",\n            lastname: \"BulkResub\",\n            mailPermissions: true,\n            unsubscribed: false,\n            isDeleted: false\n        })\n    }\n});\nconst contactId = createRes.json().id;\nawait send({\n    url: baseUrl + \"/api/v1/contacts/\" + contactId + \"/unsubscribe?reason=postman\",\n    method: \"POST\",\n    header: { \"Cookie\": `jvlpsi=${cookie};` }\n});\npm.environment.set(\"smooveApiBulkResubContactId\", String(contactId));\npm.request.body.update(JSON.stringify({ ids: [Number(contactId)] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing message').to.have.property('message');\n    pm.expect(json.message, 'message').to.be.a('string');\n});\n\npm.test('Message confirms bulk resubscribe', function () {\n    const json = pm.response.json();\n    pm.expect(json.message, 'message').to.not.equal('');\n    pm.expect(json.message.toLowerCase(), 'message').to.match(/resubscrib|subscrib|success/);\n});\n\nasync function followUpAndCleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const id = pm.environment.get(\"smooveApiBulkResubContactId\");\n    if (!id) return;\n    await pm.sendRequest({\n        url: baseUrl + \"/api/v1/contacts/\" + id,\n        method: \"DELETE\",\n        header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" }\n    });\n    pm.environment.unset(\"smooveApiBulkResubContactId\");\n}\n\nawait followUpAndCleanUp();"]}}],"id":"8c0e03f7-f416-40eb-bb59-f72863c5d5d3","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/resubscribe","urlObject":{"path":["api","v1","contacts","resubscribe"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8c0e03f7-f416-40eb-bb59-f72863c5d5d3"}],"id":"dfa4edaf-a641-44e2-93ac-38f2593399a1","_postman_id":"dfa4edaf-a641-44e2-93ac-38f2593399a1","description":""},{"name":"validateUnsubscribe","item":[{"name":"Contacts Validate Unsubscribe","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\n// Validate unsubscribe needs an existing contact, so create one first.\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst createRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", Cookie: `jvlpsi=${cookie};` },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            email: \"postman.validate.unsubscribe.\" + suffix + \"@smoove.smoove-api.postman.test\",\n            firstname: \"Postman\",\n            lastname: \"Validate\",\n            mailPermissions: true,\n            unsubscribed: false,\n            isDeleted: false\n        })\n    }\n});\npm.expect(createRes.code, \"create contact status\").to.be.oneOf([200, 201]);\nconst contact = createRes.json();\npm.expect(contact.id, \"created contact id\").to.be.above(0);\npm.environment.set(\"smooveApiContactIdToValidateUnsubscribe\", String(contact.id));\n\npm.request.body.update(JSON.stringify({\n    id: contact.id,\n    email: contact.email,\n    firstname: \"Postman\",\n    lastname: \"Validate\",\n    mailPermissions: true,\n    unsubscribed: true,\n    isDeleted: false\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing message').to.have.property('message');\n    pm.expect(json.message, 'message').to.be.a('string');\n});\n\npm.test('Message is non-empty and meaningful', function () {\n    const json = pm.response.json();\n    pm.expect(json.message, 'message').to.not.equal('');\n    pm.expect(json.message.toLowerCase(), 'message').to.match(/unsubscrib|valid/);\n});\n\nconst cleanupRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/contacts/\" + pm.environment.get(\"smooveApiContactIdToValidateUnsubscribe\"),\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\npm.test(\"The seeded contact is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete contact status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiContactIdToValidateUnsubscribe\");"]}}],"id":"4759d539-9d1f-4d2e-be45-a047d716a3d1","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"id\": 0,\n  \"email\": \"\",\n  \"firstname\": \"\",\n  \"lastname\": \"\",\n  \"mailPermissions\": true,\n  \"unsubscribed\": false,\n  \"isDeleted\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/validateUnsubscribe?suppressWarnings=false","urlObject":{"path":["api","v1","contacts","validateUnsubscribe"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"suppressWarnings","value":"false"}],"variable":[]}},"response":[],"_postman_id":"4759d539-9d1f-4d2e-be45-a047d716a3d1"}],"id":"2499ca66-f4f6-4283-894f-2709890c1050","_postman_id":"2499ca66-f4f6-4283-894f-2709890c1050","description":""},{"name":"validateAdd","item":[{"name":"Contacts Validate Add","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.body.update(JSON.stringify({\n    email: \"postman.validate.add.\" + suffix + \"@smoove.smoove-api.postman.test\",\n    firstname: \"Postman\",\n    lastname: \"ValidateAdd\",\n    mailPermissions: true,\n    unsubscribed: false,\n    isDeleted: false\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing message').to.have.property('message');\n    pm.expect(json.message, 'message').to.be.a('string');\n});\n\npm.test('Message is non-empty and meaningful', function () {\n    const json = pm.response.json();\n    pm.expect(json.message, 'message').to.not.equal('');\n    pm.expect(json.message.toLowerCase(), 'message').to.include('added');\n});"]}}],"id":"b7b7f2c9-e2c7-4758-bd4a-4cab7087e755","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"email\": \"\",\n  \"firstname\": \"\",\n  \"lastname\": \"\",\n  \"mailPermissions\": true,\n  \"unsubscribed\": false,\n  \"isDeleted\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/validateAdd?suppressWarnings=false","urlObject":{"path":["api","v1","contacts","validateAdd"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"suppressWarnings","value":"false"}],"variable":[]}},"response":[],"_postman_id":"b7b7f2c9-e2c7-4758-bd4a-4cab7087e755"}],"id":"f0d67fe3-7312-42f8-9474-79c2938445bf","_postman_id":"f0d67fe3-7312-42f8-9474-79c2938445bf","description":""},{"name":"validateUpdate","item":[{"name":"Contacts Validate Update","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\n// Validate update needs an existing contact, so create one first.\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst createRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", Cookie: `jvlpsi=${cookie};` },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            email: \"postman.validate.update.\" + suffix + \"@smoove.smoove-api.postman.test\",\n            firstname: \"Postman\",\n            lastname: \"Validate\",\n            mailPermissions: true,\n            unsubscribed: false,\n            isDeleted: false\n        })\n    }\n});\npm.expect(createRes.code, \"create contact status\").to.be.oneOf([200, 201]);\nconst contact = createRes.json();\npm.expect(contact.id, \"created contact id\").to.be.above(0);\npm.environment.set(\"smooveApiContactIdToValidateUpdate\", String(contact.id));\n\npm.request.body.update(JSON.stringify({\n    id: contact.id,\n    email: contact.email,\n    firstname: \"PostmanUpdated\",\n    lastname: \"Validate\",\n    mailPermissions: true,\n    unsubscribed: false,\n    isDeleted: false\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing message').to.have.property('message');\n    pm.expect(json.message, 'message').to.be.a('string');\n});\n\npm.test('Message is non-empty and meaningful', function () {\n    const json = pm.response.json();\n    pm.expect(json.message, 'message').to.not.equal('');\n    pm.expect(json.message.toLowerCase(), 'message').to.match(/updat|valid/);\n});\n\nconst cleanupRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/contacts/\" + pm.environment.get(\"smooveApiContactIdToValidateUpdate\"),\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\npm.test(\"The seeded contact is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete contact status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiContactIdToValidateUpdate\");"]}}],"id":"57313786-509a-4a1a-8717-b0fa95bf8038","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"id\": 0,\n  \"email\": \"\",\n  \"firstname\": \"\",\n  \"lastname\": \"\",\n  \"mailPermissions\": true,\n  \"unsubscribed\": false,\n  \"isDeleted\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/validateUpdate?suppressWarnings=false","urlObject":{"path":["api","v1","contacts","validateUpdate"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"suppressWarnings","value":"false"}],"variable":[]}},"response":[],"_postman_id":"57313786-509a-4a1a-8717-b0fa95bf8038"}],"id":"a9e9b50c-c58b-4ea2-b19d-addead381700","_postman_id":"a9e9b50c-c58b-4ea2-b19d-addead381700","description":""},{"name":"exportAudit","item":[{"name":"Contacts Export Audit","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is the id of the new export audit row', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isFinite(value)).to.be.true;\n    pm.expect(value, 'export audit id').to.be.above(0);\n});"]}}],"id":"62c97711-6b00-4fc0-ba13-42b4fdf47b4d","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/exportAudit?totalContacts={{smooveApiExportContactsCount}}&cntDownloaded={{smooveApiExportContactsCount}}&exportId=0&fileWasDownloaded=false","urlObject":{"path":["api","v1","contacts","exportAudit"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"totalContacts","value":"{{smooveApiExportContactsCount}}"},{"key":"cntDownloaded","value":"{{smooveApiExportContactsCount}}"},{"key":"exportId","value":"0"},{"key":"fileWasDownloaded","value":"false"}],"variable":[]}},"response":[],"_postman_id":"62c97711-6b00-4fc0-ba13-42b4fdf47b4d"}],"id":"38f2c9cd-a822-4d4d-bfbb-be710c6488da","_postman_id":"38f2c9cd-a822-4d4d-bfbb-be710c6488da","description":""},{"name":"count","item":[{"name":"Contacts Get Total Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\nasync function createContact(label, extra) {\n    const res = await call(\"POST\", baseUrl + \"/api/v1/contacts?suppressWarnings=true\", Object.assign({\n        email: \"postman.\" + label + \".\" + suffix + \"@smoove.smoove-api.postman.test\",\n        firstname: \"Postman\",\n        lastname: label,\n        mailPermissions: true,\n        unsubscribed: false,\n        isDeleted: false\n    }, extra));\n    pm.expect(res.code, \"create contact status\").to.be.oneOf([200, 201]);\n    const id = res.json().id;\n    pm.expect(id, \"created contact id\").to.be.above(0);\n    return id;\n}\n\nconst listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: \"postman_count_list_\" + suffix, description: \"temp\" });\npm.expect(listRes.code, \"create list\").to.eql(200);\nconst listId = listRes.json().id;\npm.environment.set(\"smooveApiCountListId\", String(listId));\n\n// Two active contacts in the new list.\nawait createContact(\"CountFirst\", { lists: [listId] });\nawait createContact(\"CountSecond\", { lists: [listId] });"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\nconst listId = pm.environment.get(\"smooveApiCountListId\");\nconst cleanupRes = await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=true\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['active', 'deleted', 'unsubscribed'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n});\n\npm.test('Counts are finite non-negative integers', function () {\n    const json = pm.response.json();\n    ['active', 'deleted', 'unsubscribed'].forEach(function (key) {\n        pm.expect(Number.isFinite(json[key]), key + ' finite').to.eql(true);\n        pm.expect(json[key], key).to.be.at.least(0);\n        pm.expect(Number.isInteger(json[key]), key + ' integer').to.eql(true);\n    });\n});\n\npm.test('Counts match the seeded list: two active, none deleted, none unsubscribed', function () {\n    const json = pm.response.json();\n    pm.expect(json.active, 'active').to.eql(2);\n    pm.expect(json.deleted, 'deleted').to.eql(0);\n    pm.expect(json.unsubscribed, 'unsubscribed').to.eql(0);\n});\n\npm.test(\"Cleanup: seeded list and contacts deleted\", function () {\n    pm.expect(cleanupRes.code, \"cleanup status\").to.be.oneOf([200, 204]);\n});\n\npm.environment.unset(\"smooveApiCountListId\");"]}}],"id":"e59384ba-cb95-48e1-b22a-3ff9e8b4d35d","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/count?list={{smooveApiCountListId}}","urlObject":{"path":["api","v1","contacts","count"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"list","value":"{{smooveApiCountListId}}"}],"variable":[]}},"response":[],"_postman_id":"e59384ba-cb95-48e1-b22a-3ff9e8b4d35d"}],"id":"9cfd5c16-fc65-49f8-b687-7b9b92c172d1","_postman_id":"9cfd5c16-fc65-49f8-b687-7b9b92c172d1","description":""},{"name":"subscribersCount","item":[{"name":"Contacts Get Count Of Subscribers","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\n\nconst listRes = await call(\"GET\", baseUrl + \"/api/v1/leadGeneration?isDeleted=false&page=1&pageSize=1\");\npm.expect(listRes.code, \"lead generation list status\").to.eql(200);\nconst form = listRes.json().results && listRes.json().results[0];\npm.expect(form && form.id, \"an existing form to count\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiLeadGenerationFormId\", String(form.id));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative number', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isFinite(value)).to.be.true;\n    pm.expect(value).to.be.at.least(0);\n    pm.expect(Number.isInteger(value), 'integer').to.eql(true);\n});"]}}],"id":"07478e1a-1ecd-4439-94de-d043b17a466d","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/subscribersCount?formId={{smooveApiLeadGenerationFormId}}","urlObject":{"path":["api","v1","contacts","subscribersCount"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"formId","value":"{{smooveApiLeadGenerationFormId}}"}],"variable":[]}},"response":[],"_postman_id":"07478e1a-1ecd-4439-94de-d043b17a466d"}],"id":"6f4007c8-0b28-45cd-9d25-0b0c775b22d6","_postman_id":"6f4007c8-0b28-45cd-9d25-0b0c775b22d6","description":""},{"name":"allFromRecycleBin","item":[],"id":"fe45e41e-940d-4f5a-988e-e3f36b3a3369","_postman_id":"fe45e41e-940d-4f5a-988e-e3f36b3a3369","description":""},{"name":"fromRecycleBin","item":[{"name":"Contacts Delete From Recycle Bin","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: { mode: \"raw\", raw: JSON.stringify({ email: \"postman.recycle.\" + ts + \"@smoove.smoove-api.postman.test\", firstname: \"Postman\", lastname: \"Temp\", mailPermissions: true, unsubscribed: false, isDeleted: false }) }\n});\nif (!createRes || (createRes.code !== 200 && createRes.code !== 201)) {\n    throw new Error(\"Create contact failed with status \" + (createRes && createRes.code));\n}\nconst contactId = createRes.json().id;\nif (!contactId) { throw new Error(\"Create contact returned no id\"); }\n\nconst deleteRes = await send({\n    url: baseUrl + \"/api/v1/contacts/\" + contactId,\n    method: \"DELETE\",\n    header: { \"Cookie\": `jvlpsi=${cookie};` }\n});\nif (!deleteRes || (deleteRes.code !== 200 && deleteRes.code !== 204)) {\n    throw new Error(\"Soft-delete contact failed with status \" + (deleteRes && deleteRes.code));\n}\n\npm.environment.set(\"smooveApiRecycleBinContactId\", String(contactId));\npm.request.body.update(JSON.stringify({ ids: [Number(contactId)] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["// Permanent deletion is intentionally not exercised on DEV: it physically removes contacts, and the test account\n// does not have AllowPermanentDeletion. The seeded contact stays in the recycle bin. This request therefore\n// accepts both outcomes, a 200 when the account allows it and a 403 naming the permission when it does not.\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst contactId = Number(pm.environment.get(\"smooveApiRecycleBinContactId\"));\n\nconst contactRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/contacts/\" + contactId,\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test('Status code is 200 (permanent deletion allowed) or 403 (not allowed)', function () {\n    pm.expect(pm.response.code).to.be.oneOf([200, 403]);\n});\n\npm.test('The seeded contact is gone only when the deletion was allowed', function () {\n    pm.expect(contactRes.code, 'contact status after the request').to.eql(pm.response.code === 200 ? 404 : 200);\n});\n\npm.test('A rejected request names the permission', function () {\n    if (pm.response.code === 200) return;\n    pm.response.to.be.json;\n    pm.expect(pm.response.json().message.toLowerCase(), 'message').to.include('permanent deletion');\n});\n\npm.environment.unset(\"smooveApiRecycleBinContactId\");"]}}],"id":"a34e9314-6b9c-48c0-ba39-9c049100c5fc","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/fromRecycleBin","urlObject":{"path":["api","v1","contacts","fromRecycleBin"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a34e9314-6b9c-48c0-ba39-9c049100c5fc"}],"id":"e9f01b05-f3fa-4b50-b694-d3df007c56db","_postman_id":"e9f01b05-f3fa-4b50-b694-d3df007c56db","description":""},{"name":"searchForMail","item":[{"name":"Contacts Search For Mail","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst mailId = pm.environment.get(\"smooveApiMailId\") || pm.environment.get(\"smooveApiCampaignId\");\n\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}\n\nif (!mailId) {\n    throw new Error(\"Missing smooveApiMailId or smooveApiCampaignId in environment\");\n}\npm.environment.set(\"smooveApiMailId\", String(mailId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination values are consistent', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.be.at.least(1);\n    pm.expect(json.size, 'size').to.be.at.least(json.results.length);\n    pm.expect(json.rows, 'rows').to.be.at.least(0);\n    pm.expect(json.pages, 'pages').to.be.at.least(0);\n    if (json.results.length > 0) {\n        pm.expect(json.results[0], 'first result').to.be.an('object');\n        pm.expect(json.results[0], 'missing id').to.have.property('id');\n        pm.expect(json.results[0].id, 'id').to.be.a('number').and.above(0);\n    }\n});"]}}],"id":"6e933718-c1d6-42a4-9b26-590557865f01","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/searchForMail?Mode=0&MailId={{smooveApiMailId}}&Page=1&PageSize=50","urlObject":{"path":["api","v1","contacts","searchForMail"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"Mode","value":"0"},{"key":"MailId","value":"{{smooveApiMailId}}"},{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"6e933718-c1d6-42a4-9b26-590557865f01"}],"id":"25652635-945b-4ecb-a490-3e0ee57c8930","_postman_id":"25652635-945b-4ecb-a490-3e0ee57c8930","description":""},{"name":"searchForSms","item":[{"name":"Contacts Search For Sms","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\n\n// The admin API has no create-SMS endpoint, so seed an unsent (saved) SMS through the public REST API.\n// Retry briefly on 5xx — DEV REST occasionally returns a transient 500 on Messages create.\nlet createRes;\nfor (let attempt = 1; attempt <= 3; attempt++) {\n    createRes = await pm.sendRequest({\n        url: \"https://\" + pm.environment.get(\"restApiUrl\") + \"/v1/Messages?isTts=false&sendNow=false\",\n        method: \"POST\",\n        header: { apikey: pm.environment.get(\"restApiKeyForAutomationTests\"), \"Content-Type\": \"application/json\" },\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({\n                toMembersByCell: [\"0500000000\"],\n                body: \"postman-sms-search-\" + Date.now() + \"-\" + Math.random().toString(36).slice(2, 8),\n                fromNumber: pm.environment.get(\"smooveApiSmsFromNumber\")\n            })\n        }\n    });\n    if (createRes.code < 500) break;\n    if (attempt < 3) await new Promise(function (r) { setTimeout(r, 500 * attempt); });\n}\npm.expect(createRes.code, \"seed saved sms status\").to.eql(200);\nconst smsId = createRes.json().id;\npm.expect(smsId, \"seeded sms id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiSearchSmsId\", String(smsId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\nconst smsId = Number(pm.environment.get(\"smooveApiSearchSmsId\"));\nconst cleanupRes = await call(\"DELETE\", baseUrl + \"/api/v1/sms\", { ids: [smsId] });\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination values are consistent', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.be.at.least(1);\n    pm.expect(json.size, 'size').to.be.at.least(json.results.length);\n    pm.expect(json.rows, 'rows').to.be.at.least(0);\n    pm.expect(json.pages, 'pages').to.be.at.least(0);\n    if (json.results.length > 0) {\n        pm.expect(json.results[0], 'first result').to.be.an('object');\n        pm.expect(json.results[0], 'missing id').to.have.property('id');\n        pm.expect(json.results[0].id, 'id').to.be.a('number').and.above(0);\n    }\n});\n\npm.test('A saved SMS that was never sent has no recipients', function () {\n    const json = pm.response.json();\n    pm.expect(json.rows, 'rows').to.eql(0);\n    pm.expect(json.results, 'results').to.be.an('array').that.is.empty;\n});\n\npm.test(\"Cleanup: seeded sms deleted\", function () {\n    pm.expect(cleanupRes.code, \"cleanup status\").to.be.oneOf([200, 204]);\n});\n\npm.environment.unset(\"smooveApiSearchSmsId\");"]}}],"id":"dc8972da-a396-455b-a03e-97dd00555cfc","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/searchForSms?Mode=0&SmsId={{smooveApiSearchSmsId}}&ShowOnlyUnique=true&StartDate={{smooveApiDateFrom}}&EndDate=2026-11-22T14:07:07.369Z&Page=1&PageSize=50","urlObject":{"path":["api","v1","contacts","searchForSms"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"Mode","value":"0"},{"key":"SmsId","value":"{{smooveApiSearchSmsId}}"},{"key":"ShowOnlyUnique","value":"true"},{"key":"StartDate","value":"{{smooveApiDateFrom}}"},{"key":"EndDate","value":"2026-11-22T14:07:07.369Z"},{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"dc8972da-a396-455b-a03e-97dd00555cfc"}],"id":"ebd4b30e-2191-48ab-bc82-e976261ad6ef","_postman_id":"ebd4b30e-2191-48ab-bc82-e976261ad6ef","description":""},{"name":"searchForOmnichannelMessage","item":[{"name":"Contacts Search For Omnichannel Message","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\n\n// The admin API has no create-message endpoint, so seed an unsent (saved) WhatsApp campaign through the public REST API.\nconst createRes = await pm.sendRequest({\n    url: \"https://\" + pm.environment.get(\"restApiUrl\") + \"/v1/Messages/Whatsapp/Create?sendNow=false\",\n    method: \"POST\",\n    header: { apikey: pm.environment.get(\"restApiKeyForAutomationTests\"), \"Content-Type\": \"application/json\" },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            toMembersByCell: [\"0510000000\"],\n            templateId: Number(pm.environment.get(\"TemplateIdForWhatsApp\")),\n            templateMessageParams: [],\n            fromNumber: Number(pm.environment.get(\"WhatsAppVirtualNumber\"))\n        })\n    }\n});\npm.expect(createRes.code, \"seed saved omnichannel message status\").to.eql(200);\nconst messageId = createRes.json().id;\npm.expect(messageId, \"seeded message id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiSearchOmnichannelMessageId\", String(messageId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\nconst messageId = Number(pm.environment.get(\"smooveApiSearchOmnichannelMessageId\"));\nconst cleanupRes = await call(\"DELETE\", baseUrl + \"/api/v1/omnichannelMessages\", { ids: [messageId] });\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination values are consistent', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.be.at.least(1);\n    pm.expect(json.size, 'size').to.be.at.least(json.results.length);\n    pm.expect(json.rows, 'rows').to.be.at.least(0);\n    pm.expect(json.pages, 'pages').to.be.at.least(0);\n    if (json.results.length > 0) {\n        pm.expect(json.results[0], 'first result').to.be.an('object');\n        pm.expect(json.results[0], 'missing id').to.have.property('id');\n        pm.expect(json.results[0].id, 'id').to.be.a('number').and.above(0);\n    }\n});\n\npm.test('A saved message that was never sent has no recipients', function () {\n    const json = pm.response.json();\n    pm.expect(json.rows, 'rows').to.eql(0);\n    pm.expect(json.results, 'results').to.be.an('array').that.is.empty;\n});\n\npm.test(\"Cleanup: seeded message deleted\", function () {\n    pm.expect(cleanupRes.code, \"cleanup status\").to.be.oneOf([200, 204]);\n});\n\npm.environment.unset(\"smooveApiSearchOmnichannelMessageId\");"]}}],"id":"c6fc1af0-5c10-4b99-8962-a3a33441727e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/searchForOmnichannelMessage?MessageSentState=4&MessageId={{smooveApiSearchOmnichannelMessageId}}&Page=1&PageSize=50","urlObject":{"path":["api","v1","contacts","searchForOmnichannelMessage"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"MessageSentState","value":"4"},{"key":"MessageId","value":"{{smooveApiSearchOmnichannelMessageId}}"},{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"c6fc1af0-5c10-4b99-8962-a3a33441727e"}],"id":"1934099b-3957-44c7-ab6e-530ef585af04","_postman_id":"1934099b-3957-44c7-ab6e-530ef585af04","description":""},{"name":"searchBpmnTransitions","item":[{"name":"Contacts Search Bpmn Transitions","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["// bpmnEl is \"<automationId>,<nodeId>,<contactOrGroup>,<dateFrom>,<dateTill>,<uniqueContacts>\". All six parts must be\n// present. sort=timestamp is required: the default sort column belongs to an alias that this query does not have.\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst automationId = pm.environment.get(\"smooveApiBpmnTransitionsAutomationId\");\n\nconst unknownRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/contacts/searchBpmnTransitions?page=1&pageSize=50&list=0&sort=timestamp&bpmnEl=\" + automationId + \",vip_0_0_0,,,,false\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\nconst missingRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/contacts/searchBpmnTransitions?page=1&pageSize=50\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Paging fields have the expected values', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['current', 'pages', 'size', 'rows'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n    pm.expect(json.results, 'results').to.be.an('array');\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.rows, 'rows').to.be.above(0);\n    pm.expect(json.pages, 'pages').to.eql(Math.ceil(json.rows / json.size));\n    pm.expect(json.results.length, 'results on the page').to.eql(Math.min(json.rows, json.size));\n});\n\npm.test('Every result has the expected contact fields and types', function () {\n    const stringFields = ['firstname', 'lastname', 'externalId', 'email', 'cellPhone', 'phone', 'city', 'country', 'company',\n        'position', 'address', 'ipAddress', 'addedAt', 'timestamp'];\n    const booleanFields = ['mailPermissions', 'smsPermissions', 'contactCanReceiveWhatsappMessages', 'unsubscribed', 'isDeleted'];\n    pm.response.json().results.forEach(function (contact, index) {\n        const label = 'results[' + index + ']';\n        pm.expect(contact.id, label + '.id').to.be.a('number').and.above(0);\n        stringFields.forEach(function (key) {\n            pm.expect(contact, label + ' missing ' + key).to.have.property(key);\n            pm.expect(contact[key], label + '.' + key).to.be.a('string');\n        });\n        booleanFields.forEach(function (key) {\n            pm.expect(contact, label + ' missing ' + key).to.have.property(key);\n            pm.expect(contact[key], label + '.' + key).to.be.a('boolean');\n        });\n        pm.expect(contact.joinSource, label + '.joinSource').to.be.a('number');\n        pm.expect(Number.isNaN(Date.parse(contact.timestamp)), label + '.timestamp is a date').to.equal(false);\n        pm.expect(Number.isNaN(Date.parse(contact.addedAt)), label + '.addedAt is a date').to.equal(false);\n    });\n});\n\npm.test('Results are sorted by transition time, oldest first', function () {\n    const times = pm.response.json().results.map(function (contact) { return Date.parse(contact.timestamp); });\n    times.forEach(function (time, index) {\n        if (index > 0) pm.expect(time, 'timestamp of result ' + index).to.be.at.least(times[index - 1]);\n    });\n});\n\npm.test('An element without transitions returns an empty page', function () {\n    pm.expect(unknownRes.code, 'status').to.eql(200);\n    const json = unknownRes.json();\n    pm.expect(json.results, 'results').to.eql([]);\n    pm.expect(json.rows, 'rows').to.eql(0);\n    pm.expect(json.pages, 'pages').to.eql(0);\n});\n\npm.test('A request without bpmnEl is rejected', function () {\n    pm.expect(missingRes.code, 'status').to.eql(400);\n    pm.expect(missingRes.json().message.toLowerCase(), 'message').to.include('bpmnel');\n});"]}}],"id":"4d9fbc36-3963-425f-a713-68e0f8855418","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/searchBpmnTransitions?page=1&pageSize=50&list=0&sort=timestamp&bpmnEl={{smooveApiBpmnTransitionsAutomationId}},{{smooveApiBpmnTransitionsNodeId}},,,,false","urlObject":{"path":["api","v1","contacts","searchBpmnTransitions"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"50"},{"key":"list","value":"0"},{"key":"sort","value":"timestamp"},{"key":"bpmnEl","value":"{{smooveApiBpmnTransitionsAutomationId}},{{smooveApiBpmnTransitionsNodeId}},,,,false"}],"variable":[]}},"response":[],"_postman_id":"4d9fbc36-3963-425f-a713-68e0f8855418"}],"id":"e1e1abb6-a9be-4998-a168-13440cb789d6","_postman_id":"e1e1abb6-a9be-4998-a168-13440cb789d6","description":""},{"name":"unsubscribeSelected","item":[{"name":"Contacts Unsubscribe Selected","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: { mode: \"raw\", raw: JSON.stringify({ email: \"postman.unsubsel.\" + ts + \"@smoove.smoove-api.postman.test\", firstname: \"Postman\", lastname: \"Temp\", mailPermissions: true, unsubscribed: false, isDeleted: false }) }\n});\nif (!createRes || (createRes.code !== 200 && createRes.code !== 201)) {\n    throw new Error(\"Create contact failed with status \" + (createRes && createRes.code));\n}\nconst contactId = createRes.json().id;\nif (!contactId) { throw new Error(\"Create contact returned no id\"); }\npm.environment.set(\"smooveApiContactIdForUnsubSelected\", String(contactId));\n\npm.environment.set(\"smooveApiUnsubSelectedReason\", \"postman-unsub-selected-\" + ts);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response body is boolean true', function () {\n    pm.expect(pm.response.json(), 'body').to.be.a('boolean').and.eql(true);\n});\n\nconst cleanupRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/contacts/\" + pm.environment.get(\"smooveApiContactIdForUnsubSelected\"),\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\npm.test(\"The seeded contact is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete contact status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiContactIdForUnsubSelected\");"]}}],"id":"c7da9bf8-6318-4807-a986-ebe387408643","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/unsubscribeSelected?param={{smooveApiContactIdForUnsubSelected}}&reason={{smooveApiUnsubSelectedReason}}","urlObject":{"path":["api","v1","contacts","unsubscribeSelected"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"param","value":"{{smooveApiContactIdForUnsubSelected}}"},{"key":"reason","value":"{{smooveApiUnsubSelectedReason}}"}],"variable":[]}},"response":[],"_postman_id":"c7da9bf8-6318-4807-a986-ebe387408643"}],"id":"f1b4ed34-f31b-4d7f-aa78-c2400ecee9b4","_postman_id":"f1b4ed34-f31b-4d7f-aa78-c2400ecee9b4","description":""},{"name":"form-answers-count","item":[{"name":"Contacts Get Form Answers Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\n\nconst listRes = await call(\"GET\", baseUrl + \"/api/v1/leadGeneration?isDeleted=false&page=1&pageSize=1\");\npm.expect(listRes.code, \"lead generation list status\").to.eql(200);\nconst form = listRes.json().results && listRes.json().results[0];\npm.expect(form && form.id, \"an existing form to count\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiLeadGenerationFormId\", String(form.id));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\nconst formId = pm.environment.get(\"smooveApiLeadGenerationFormId\");\nconst submissionsRes = await call(\"GET\", baseUrl + \"/api/v1/leadGeneration/form-submissions-count?formId=\" + formId);\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative number', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isFinite(value)).to.be.true;\n    pm.expect(value).to.be.at.least(0);\n});\n\npm.test('Count equals the lead generation form submissions count', function () {\n    pm.expect(submissionsRes.code, 'form-submissions-count status').to.eql(200);\n    pm.expect(pm.response.json(), 'form answers count').to.eql(submissionsRes.json());\n});"]}}],"id":"80fe0653-9248-4f7e-bfc7-04f3621bf6a1","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/contacts/form-answers-count?formId={{smooveApiLeadGenerationFormId}}","urlObject":{"path":["api","v1","contacts","form-answers-count"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"formId","value":"{{smooveApiLeadGenerationFormId}}"}],"variable":[]}},"response":[],"_postman_id":"80fe0653-9248-4f7e-bfc7-04f3621bf6a1"}],"id":"3e48754f-c446-44f7-b8dc-7630e84d2869","_postman_id":"3e48754f-c446-44f7-b8dc-7630e84d2869","description":""},{"name":"create-list-from-sms-statistics","item":[{"name":"Contacts Create List From Sms Search","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}\n\nconst smsId = pm.environment.get(\"smooveApiSmsId\");\n// Mode 4 (Clicked) is the only SearchSmsContactsMode the API implements;\n// every other mode throws server-side.\nconst search = { page: 1, pageSize: 50, mode: 4 };\nif (smsId) {\n    search.smsId = Number(smsId);\n}\n\npm.request.body.update(JSON.stringify({\n    search: search,\n    list: {\n        name: \"postman_sms_list_\" + ts,\n        description: \"postman temp\",\n        isActive: true,\n        isPublic: false,\n        isPortal: false,\n        isDynamic: false,\n        allowRegistration: false\n    }\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    [\"id\",\"isActive\",\"contactsCount\",\"isPublic\",\"isPortal\",\"isDynamic\",\"isEvaluationInProgress\",\"allowRegistration\",\"isAttachedToBusinessJourney\"].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n    pm.expect(json.contactsCount, 'contactsCount').to.be.a('number');\n    pm.expect(json.isPublic, 'isPublic').to.be.a('boolean');\n    pm.expect(json.isPortal, 'isPortal').to.be.a('boolean');\n    pm.expect(json.isDynamic, 'isDynamic').to.be.a('boolean');\n    pm.expect(json.isEvaluationInProgress, 'isEvaluationInProgress').to.be.a('boolean');\n    pm.expect(json.allowRegistration, 'allowRegistration').to.be.a('boolean');\n    pm.expect(json.isAttachedToBusinessJourney, 'isAttachedToBusinessJourney').to.be.a('boolean');\n});\n\npm.test('Created list has a valid id and inactive evaluation', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.isActive, 'isActive').to.eql(true);\n    pm.expect(json.isPublic, 'isPublic').to.eql(false);\n    pm.expect(json.isPortal, 'isPortal').to.eql(false);\n    pm.expect(json.isDynamic, 'isDynamic').to.eql(false);\n    pm.expect(json.allowRegistration, 'allowRegistration').to.eql(false);\n    pm.expect(json.contactsCount, 'contactsCount').to.be.at.least(0);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const listId = pm.response.json() && pm.response.json().id;\n    if (!listId) return;\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\",\n        method: \"DELETE\",\n        header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" }\n    });\n    pm.test(\"Cleanup: list deleted successfully\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n}\n\nawait cleanUp();"]}}],"id":"6a285622-27c7-4c48-a5ac-27bdf84a4c3c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"search\": {\n    \"page\": 1,\n    \"pageSize\": 50,\n    \"mode\": 4\n  },\n  \"list\": {\n    \"name\": \"postman_sms_list_placeholder\",\n    \"description\": \"postman temp\",\n    \"isActive\": true,\n    \"isPublic\": false,\n    \"isPortal\": false,\n    \"isDynamic\": false,\n    \"allowRegistration\": false\n  }\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts/create-list-from-sms-statistics","urlObject":{"path":["api","v1","contacts","create-list-from-sms-statistics"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6a285622-27c7-4c48-a5ac-27bdf84a4c3c"}],"id":"6a060848-cc8d-4f04-ab98-372a64b64bf9","_postman_id":"6a060848-cc8d-4f04-ab98-372a64b64bf9","description":""},{"name":"Contacts Post","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction uniqueSuffix() {\n    return Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = uniqueSuffix();\npm.request.body.update(JSON.stringify({\n    email: \"postman.create.\" + suffix + \"@smoove.smoove-api.postman.test\",\n    firstname: \"Postman\",\n    lastname: \"Create\",\n    mailPermissions: true,\n    smsPermissions: false,\n    unsubscribed: false,\n    isDeleted: false\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    [\"id\",\"firstname\",\"lastname\",\"externalId\",\"password\",\"email\",\"cellPhone\",\"phone\",\"city\",\"country\",\"company\",\"position\",\"address\",\"ipAddress\",\"mailPermissions\",\"smsPermissions\",\"contactCanReceiveWhatsappMessages\",\"joinSource\",\"addedAt\",\"extra\",\"unsubscribed\",\"isDeleted\",\"subscribedAt\",\"timestamp\"].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.firstname, 'firstname').to.be.a('string');\n    pm.expect(json.lastname, 'lastname').to.be.a('string');\n    pm.expect(json.externalId, 'externalId').to.be.a('string');\n    pm.expect(json.password, 'password').to.be.a('string');\n    pm.expect(json.email, 'email').to.be.a('string');\n    pm.expect(json.cellPhone, 'cellPhone').to.be.a('string');\n    pm.expect(json.phone, 'phone').to.be.a('string');\n    pm.expect(json.city, 'city').to.be.a('string');\n    pm.expect(json.country, 'country').to.be.a('string');\n    pm.expect(json.company, 'company').to.be.a('string');\n    pm.expect(json.position, 'position').to.be.a('string');\n    pm.expect(json.address, 'address').to.be.a('string');\n    pm.expect(json.ipAddress, 'ipAddress').to.be.a('string');\n    pm.expect(json.mailPermissions, 'mailPermissions').to.be.a('boolean');\n    pm.expect(json.smsPermissions, 'smsPermissions').to.be.a('boolean');\n    pm.expect(json.contactCanReceiveWhatsappMessages, 'contactCanReceiveWhatsappMessages').to.be.a('boolean');\n    pm.expect(json.joinSource, 'joinSource').to.be.a('number');\n    pm.expect(json.addedAt, 'addedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.addedAt)), 'addedAt parseable').to.eql(false);\n    pm.expect(json.extra, 'extra').to.be.an('object');\n    pm.expect(json.unsubscribed, 'unsubscribed').to.be.a('boolean');\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.subscribedAt, 'subscribedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.subscribedAt)), 'subscribedAt parseable').to.eql(false);\n    pm.expect(json.timestamp, 'timestamp').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.timestamp)), 'timestamp parseable').to.eql(false);\n});\n\npm.test('Created contact echoes request identity', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.firstname, 'firstname').to.eql('Postman');\n    pm.expect(json.lastname, 'lastname').to.eql('Create');\n    pm.expect(json.email, 'email').to.be.a('string').and.include('postman.create.');\n    pm.expect(json.mailPermissions, 'mailPermissions').to.eql(true);\n    pm.expect(json.smsPermissions, 'smsPermissions').to.eql(false);\n    pm.expect(json.unsubscribed, 'unsubscribed').to.eql(false);\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    let cleanupId;\n    try {\n        const j = pm.response.json();\n        cleanupId = (j && j.id) || (Array.isArray(j) && j[0] && j[0].id);\n    } catch (e) {\n        cleanupId = null;\n    }\n\n    if (!cleanupId) {\n        pm.test(\"Cleanup skipped: could not resolve contact id\", function () {\n            pm.expect.fail(\"Missing contact id for cleanup\");\n        });\n        return;\n    }\n\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/contacts/\" + cleanupId,\n        method: \"DELETE\",\n        header: {\n            \"Cookie\": \"jvlpsi=\" + cookie + \";\",\n            \"Accept\": \"application/json\"\n        }\n    });\n    pm.test(\"Cleanup: contact deleted successfully\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n}\n\nawait cleanUp();"]}}],"id":"0d65597f-d3e0-4956-81c7-25d9563da822","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"email\": \"postman.create.placeholder@smoove.smoove-api.postman.test\",\n  \"firstname\": \"Postman\",\n  \"lastname\": \"Create\",\n  \"mailPermissions\": true,\n  \"smsPermissions\": false,\n  \"unsubscribed\": false,\n  \"isDeleted\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts?suppressWarnings=true","urlObject":{"path":["api","v1","contacts"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"suppressWarnings","value":"true"}],"variable":[]}},"response":[],"_postman_id":"0d65597f-d3e0-4956-81c7-25d9563da822"},{"name":"Contacts Bulk Delete","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction headers(extra) {\n    return Object.assign({\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    }, extra || {});\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction assertOk(res, label) {\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error((label || \"Request\") + \" failed with status \" + (res && res.code) + \": \" + (res && res.text && res.text()));\n    }\n}\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: headers(),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            email: \"postman.bulkdelete.\" + ts + \"@smoove.smoove-api.postman.test\",\n            firstname: \"Postman\",\n            lastname: \"BulkDelete\",\n            mailPermissions: true,\n            unsubscribed: false,\n            isDeleted: false\n        })\n    }\n});\nassertOk(createRes, \"Create contact for bulk delete\");\nconst created = createRes.json();\nconst contactId = created.id || (Array.isArray(created) && created[0] && created[0].id);\nif (!contactId) throw new Error(\"Create contact did not return an id\");\npm.environment.set(\"smooveApiContactIdToDelete\", contactId);\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/contacts/\" + contactId,\n    method: \"GET\",\n    header: headers()\n});\nassertOk(getRes, \"Verify contact exists before bulk delete\");\n\npm.request.body.update(JSON.stringify({ ids: [Number(contactId)] }));\ntry {\n    const u = new URL(pm.request.url.toString());\n    u.searchParams.delete(\"ids\");\n    pm.request.url = u.toString();\n} catch (e) {}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array of deleted contacts', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array').and.have.lengthOf.at.least(1);\n    const item = json[0];\n    [\"id\",\"firstname\",\"lastname\",\"externalId\",\"password\",\"email\",\"cellPhone\",\"phone\",\"city\",\"country\",\"company\",\"position\",\"address\",\"ipAddress\",\"mailPermissions\",\"smsPermissions\",\"contactCanReceiveWhatsappMessages\",\"joinSource\",\"addedAt\",\"unsubscribed\",\"isDeleted\",\"timestamp\"].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.email, 'email').to.be.a('string');\n    pm.expect(item.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(item.mailPermissions, 'mailPermissions').to.be.a('boolean');\n    pm.expect(item.smsPermissions, 'smsPermissions').to.be.a('boolean');\n    pm.expect(item.unsubscribed, 'unsubscribed').to.be.a('boolean');\n    pm.expect(item.timestamp, 'timestamp').to.be.a('string');\n});\n\npm.test('Bulk delete used the created contact id', function () {\n    const expectedId = Number(pm.environment.get(\"smooveApiContactIdToDelete\") || pm.environment.get(\"smooveApiBulkDeleteContactId\"));\n    const ids = pm.response.json().map(function (c) { return Number(c.id); });\n    if (expectedId) {\n        pm.expect(ids, 'deleted ids').to.include(expectedId);\n    }\n    pm.expect(pm.response.json()[0].isDeleted, 'isDeleted').to.eql(true);\n});"]}}],"id":"eb2369ec-8489-477e-814d-98293cd93c23","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/contacts","urlObject":{"path":["api","v1","contacts"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"eb2369ec-8489-477e-814d-98293cd93c23"}],"id":"41082118-13d3-4eb8-b12d-928c38158263","_postman_id":"41082118-13d3-4eb8-b12d-928c38158263","description":""},{"name":"crm","item":[{"name":"communications","item":[{"name":"Crm Get Communications","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n    pm.expect(json, 'missing results').to.have.property('results');\n    pm.expect(json.results, 'results').to.be.an('array');\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.rows, 'rows').to.be.above(0);\n    pm.expect(json.results.length, 'results length').to.be.above(0);\n    pm.expect(json.results.length, 'results length vs size').to.be.at.most(json.size);\n});\n\npm.test('First result has all expected fields and types', function () {\n    const item = pm.response.json().results[0];\n    ['id', 'timestamp', 'callType', 'contactId', 'isUnsubscribedContact', 'content', 'firstName', 'lastName', 'cellphone', 'email'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.timestamp, 'timestamp').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.timestamp)), 'timestamp should be a parseable date').to.eql(false);\n    pm.expect(item.callType, 'callType').to.be.a('string').and.not.equal('');\n    pm.expect(item.contactId, 'contactId').to.be.a('number').and.above(0);\n    pm.expect(item.isUnsubscribedContact, 'isUnsubscribedContact').to.be.a('boolean');\n    pm.expect(item.content, 'content').to.be.a('string');\n    pm.expect(item.firstName, 'firstName').to.be.a('string');\n    pm.expect(item.lastName, 'lastName').to.be.a('string');\n    pm.expect(item.cellphone, 'cellphone').to.be.a('string');\n    pm.expect(item.email, 'email').to.be.a('string');\n    if (item.reminderId !== undefined && item.reminderId !== null) {\n        pm.expect(item.reminderId, 'reminderId').to.be.a('number');\n    }\n});"]}}],"id":"d137e312-3130-49a3-9dfb-50308341ad11","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/crm/communications?Page=1&PageSize=50","urlObject":{"path":["api","v1","crm","communications"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"d137e312-3130-49a3-9dfb-50308341ad11"}],"id":"37fbac5b-4582-42ee-883a-6de911ec9424","_postman_id":"37fbac5b-4582-42ee-883a-6de911ec9424","description":""},{"name":"communicationsCount","item":[{"name":"Crm Get Communications Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\n// Seed list row count for a consistency check against the total count endpoint.\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/crm/communications?Page=1&PageSize=1\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\npm.expect(listRes.code, \"seed communications list status\").to.eql(200);\nconst listJson = listRes.json();\npm.expect(listJson.rows, \"seed list rows\").to.be.a(\"number\");\npm.environment.set(\"smooveApiCrmCommunicationsListRows\", String(listJson.rows));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const listRows = Number(pm.environment.get(\"smooveApiCrmCommunicationsListRows\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a finite number', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isFinite(value)).to.eql(true);\n    pm.environment.set(\"smooveApiCrmCommunicationsCount\", String(value));\n});\n\npm.test('Count is positive and at least the filtered communications list rows', function () {\n    const value = Number(pm.environment.get(\"smooveApiCrmCommunicationsCount\"));\n    pm.expect(listRows, 'seeded list rows').to.be.above(0);\n    pm.expect(value, 'communicationsCount').to.be.above(0);\n    // Count is unfiltered CrmCalls; list excludes deleted contacts, so count >= list rows.\n    pm.expect(value, 'communicationsCount vs list rows').to.be.at.least(listRows);\n});\n\npm.environment.unset(\"smooveApiCrmCommunicationsListRows\");\npm.environment.unset(\"smooveApiCrmCommunicationsCount\");"]}}],"id":"859ba4e8-801f-4bf5-bf6a-7fb1f579b59b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/crm/communicationsCount","urlObject":{"path":["api","v1","crm","communicationsCount"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"859ba4e8-801f-4bf5-bf6a-7fb1f579b59b"}],"id":"496876c7-d326-4056-9722-6b823ebb0937","_postman_id":"496876c7-d326-4056-9722-6b823ebb0937","description":""},{"name":"delete","item":[{"name":"Crm Delete Communications","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst email = \"postman.crm.\" + suffix + \"@smoove.smoove-api.postman.test\";\nconst content = \"postman-crm-delete-\" + suffix;\n\nconst contactRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({ email: email, firstname: \"Postman\", lastname: \"CrmDelete\", mailPermissions: true, unsubscribed: false, isDeleted: false })\n    }\n});\npm.expect(contactRes.code, \"seed contact status\").to.eql(200);\nconst contactId = contactRes.json().id;\npm.expect(contactId, \"seed contact id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiCrmContactIdToCleanup\", String(contactId));\n\n// The admin API has no create-communication endpoint, so seed one through the public REST API.\nconst now = new Date();\nconst pad = function (n) { return String(n).padStart(2, \"0\"); };\nconst communicationRes = await pm.sendRequest({\n    url: \"https://\" + pm.environment.get(\"restApiUrl\") + \"/v1/Communications?by=Email\",\n    method: \"POST\",\n    header: { apikey: pm.environment.get(\"restApiKeyForAutomationTests\"), \"Content-Type\": \"application/json\" },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            type: \"Meeting\",\n            contact: email,\n            time: pad(now.getHours()) + \":\" + pad(now.getMinutes()),\n            initiator: \"You\",\n            content: content,\n            date: pad(now.getDate()) + \"/\" + pad(now.getMonth() + 1) + \"/\" + now.getFullYear(),\n            // The env value is stored with its JSON quotes because ViplusRest splices it in unquoted.\n            communicator: String(pm.environment.get(\"restApiCommunicatorAddress\")).replace(/^\"|\"$/g, \"\")\n        })\n    }\n});\npm.expect(communicationRes.code, \"seed communication status\").to.eql(200);\nconst communicationId = communicationRes.json().id;\npm.expect(communicationId, \"seeded communication id\").to.be.a(\"number\").and.above(0);\n\n\n// The list has no filter and is ordered oldest first, so a new row is on the last page: walk all pages.\nasync function listCommunications() {\n    const all = [];\n    let page = 1;\n    let pages = 1;\n    do {\n        const res = await pm.sendRequest({\n            url: baseUrl + \"/api/v1/crm/communications?page=\" + page + \"&pageSize=100\",\n            method: \"GET\",\n            header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n        });\n        pm.expect(res.code, \"list crm communications page \" + page).to.eql(200);\n        const json = res.json();\n        pages = json.pages;\n        json.results.forEach(function (c) { all.push(c); });\n        page++;\n    } while (page <= pages);\n    return all;\n}\n\n// Look the communication up in the admin list so the id we delete is the one the admin API knows.\nconst communications = await listCommunications();\nconst seeded = communications.find(function (c) { return c.id === communicationId; });\npm.expect(seeded, \"seeded communication in crm list\").to.be.an(\"object\");\n\npm.environment.set(\"smooveApiCrmCommunicationIdToDelete\", String(seeded.id));\npm.request.body.update(JSON.stringify({ ids: [seeded.id] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const deletedId = Number(pm.environment.get(\"smooveApiCrmCommunicationIdToDelete\"));\nconst contactId = pm.environment.get(\"smooveApiCrmContactIdToCleanup\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\n\n// The list has no filter and is ordered oldest first, so a new row is on the last page: walk all pages.\nasync function listCommunications() {\n    const all = [];\n    let page = 1;\n    let pages = 1;\n    do {\n        const res = await pm.sendRequest({\n            url: baseUrl + \"/api/v1/crm/communications?page=\" + page + \"&pageSize=100\",\n            method: \"GET\",\n            header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n        });\n        pm.expect(res.code, \"list crm communications page \" + page).to.eql(200);\n        const json = res.json();\n        pages = json.pages;\n        json.results.forEach(function (c) { all.push(c); });\n        page++;\n    } while (page <= pages);\n    return all;\n}\n\nconst communications = await listCommunications();\nconst contactCleanupRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/contacts/\" + contactId,\n    method: \"DELETE\",\n    header: headers\n});\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response body is empty\", function () {\n    pm.expect(pm.response.text().trim(), \"body\").to.eql(\"\");\n});\n\npm.test(\"Deleted communication is gone from the list\", function () {\n    pm.expect(deletedId, \"deleted id\").to.be.above(0);\n    const stillListed = communications.some(function (c) { return c.id === deletedId; });\n    pm.expect(stillListed, \"communication still in list after delete\").to.eql(false);\n});\n\npm.test(\"Cleanup: seeded contact deleted\", function () {\n    pm.expect(contactCleanupRes.code, \"contact cleanup status\").to.be.oneOf([200, 204]);\n});\n\npm.environment.unset(\"smooveApiCrmCommunicationIdToDelete\");\npm.environment.unset(\"smooveApiCrmContactIdToCleanup\");"]}}],"id":"f7d6b65a-d3ba-46f1-a1ae-b9b065d32222","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/crm/delete","urlObject":{"path":["api","v1","crm","delete"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f7d6b65a-d3ba-46f1-a1ae-b9b065d32222"}],"id":"3513cf02-98d0-44a6-9220-898b607a0329","_postman_id":"3513cf02-98d0-44a6-9220-898b607a0329","description":""}],"id":"a029127c-6869-4ccc-88eb-130139acc65d","_postman_id":"a029127c-6869-4ccc-88eb-130139acc65d","description":""},{"name":"customfields","item":[{"name":"usage","item":[{"name":"Custom Fields Get Usage By Ids","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst fieldsRes = await send({\n    url: baseUrl + \"/api/v1/account/customFields\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\npm.expect(fieldsRes.code, \"seed customFields status\").to.eql(200);\nconst fields = fieldsRes.json();\npm.expect(fields, \"customFields\").to.be.an(\"array\").that.is.not.empty;\nconst field = fields[0];\npm.expect(field.id, \"seed customField id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiCustomFieldId\", String(field.id));\npm.environment.set(\"smooveApiCustomFieldSeedName\", String(field.name || \"\"));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const seededId = Number(pm.environment.get(\"smooveApiCustomFieldId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array of usage entries for the seeded field', function () {\n    const json = pm.response.json();\n    pm.expect(seededId, 'seeded customFieldId').to.be.above(0);\n    pm.expect(json).to.be.an('array');\n    json.forEach(function (item, index) {\n        const label = 'item[' + index + ']';\n        pm.expect(item, label).to.be.an('object');\n        pm.expect(item, label + ' missing customFieldId').to.have.property('customFieldId');\n        pm.expect(item, label + ' missing entityType').to.have.property('entityType');\n        pm.expect(item.customFieldId, label + '.customFieldId').to.be.a('number').and.eql(seededId);\n        pm.expect(item.entityType, label + '.entityType').to.be.a('string').and.not.equal('');\n    });\n});\n\npm.test('Seeded field id was used for the request', function () {\n    pm.expect(seededId, 'smooveApiCustomFieldId').to.be.above(0);\n    pm.expect(pm.environment.get(\"smooveApiCustomFieldSeedName\"), 'seed name').to.be.a('string');\n});\n\npm.environment.unset(\"smooveApiCustomFieldSeedName\");"]}}],"id":"4ad9b287-d209-46f6-9963-602c482629ea","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/customfields/usage?ids={{smooveApiCustomFieldId}}","urlObject":{"path":["api","v1","customfields","usage"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"ids","value":"{{smooveApiCustomFieldId}}"}],"variable":[]}},"response":[],"_postman_id":"4ad9b287-d209-46f6-9963-602c482629ea"}],"id":"2b410a54-ad9e-4cd5-85c1-62404fda3f13","_postman_id":"2b410a54-ad9e-4cd5-85c1-62404fda3f13","description":""},{"name":"group-usage","item":[{"name":"Custom Fields Get Usage By Group Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst groupsRes = await send({\n    url: baseUrl + \"/api/v1/account/customFieldGroups\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\npm.expect(groupsRes.code, \"seed customFieldGroups status\").to.eql(200);\nconst groups = groupsRes.json();\npm.expect(groups, \"customFieldGroups\").to.be.an(\"array\").that.is.not.empty;\n\nconst fieldsRes = await send({\n    url: baseUrl + \"/api/v1/account/customFields\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\npm.expect(fieldsRes.code, \"seed customFields status\").to.eql(200);\nconst fields = fieldsRes.json();\npm.expect(fields, \"customFields\").to.be.an(\"array\").that.is.not.empty;\n\n// Prefer a group that actually owns at least one field.\nconst groupIdsWithFields = {};\nfields.forEach(function (f) {\n    if (f && f.groupId != null) groupIdsWithFields[String(f.groupId)] = true;\n});\nconst group = groups.find(function (g) { return groupIdsWithFields[String(g.id)]; }) || groups[0];\npm.expect(group.id, \"seed group id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiCustomFieldGroupId\", String(group.id));\npm.environment.set(\"smooveApiCustomFieldGroupSeedName\", String(group.name || \"\"));\n\nconst fieldIdsInGroup = fields\n    .filter(function (f) { return Number(f.groupId) === Number(group.id); })\n    .map(function (f) { return Number(f.id); });\npm.environment.set(\"smooveApiCustomFieldGroupFieldIds\", fieldIdsInGroup.join(\",\"));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const seededGroupId = Number(pm.environment.get(\"smooveApiCustomFieldGroupId\"));\nconst fieldIdsInGroup = (pm.environment.get(\"smooveApiCustomFieldGroupFieldIds\") || \"\")\n    .split(\",\")\n    .filter(Boolean)\n    .map(Number);\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array of usage entries for fields in the seeded group', function () {\n    const json = pm.response.json();\n    pm.expect(seededGroupId, 'seeded group id').to.be.above(0);\n    pm.expect(fieldIdsInGroup.length, 'fields in seeded group').to.be.above(0);\n    pm.expect(json).to.be.an('array');\n    json.forEach(function (item, index) {\n        const label = 'item[' + index + ']';\n        pm.expect(item, label).to.be.an('object');\n        pm.expect(item, label + ' missing customFieldId').to.have.property('customFieldId');\n        pm.expect(item, label + ' missing entityType').to.have.property('entityType');\n        pm.expect(item.customFieldId, label + '.customFieldId').to.be.a('number');\n        pm.expect(fieldIdsInGroup, label + '.customFieldId in group').to.include(item.customFieldId);\n        pm.expect(item.entityType, label + '.entityType').to.be.a('string').and.not.equal('');\n    });\n});\n\npm.test('Seeded group owns at least one custom field', function () {\n    pm.expect(seededGroupId, 'smooveApiCustomFieldGroupId').to.be.above(0);\n    pm.expect(fieldIdsInGroup.length, 'group field count').to.be.above(0);\n    pm.expect(pm.environment.get(\"smooveApiCustomFieldGroupSeedName\"), 'seed name').to.be.a('string').and.not.equal('');\n});\n\npm.environment.unset(\"smooveApiCustomFieldGroupSeedName\");\npm.environment.unset(\"smooveApiCustomFieldGroupFieldIds\");"]}}],"id":"62ce6fe9-9396-48c6-bc23-44cadcf18175","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/customfields/group-usage?id={{smooveApiCustomFieldGroupId}}","urlObject":{"path":["api","v1","customfields","group-usage"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"id","value":"{{smooveApiCustomFieldGroupId}}"}],"variable":[]}},"response":[],"_postman_id":"62ce6fe9-9396-48c6-bc23-44cadcf18175"}],"id":"50988782-3241-483d-b946-19996dba1ab0","_postman_id":"50988782-3241-483d-b946-19996dba1ab0","description":""}],"id":"7f475ff8-8b39-4b7f-8903-93c56b057965","_postman_id":"7f475ff8-8b39-4b7f-8903-93c56b057965","description":""},{"name":"domains","item":[{"name":"verify","item":[{"name":"{domainId}","item":[{"name":"Domains Verify","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/domains\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\npm.expect(listRes.code, \"seed domains list status\").to.eql(200);\nconst domains = listRes.json();\npm.expect(domains, \"domains\").to.be.an(\"array\").that.is.not.empty;\nconst domain = domains.find(function (d) {\n    return typeof d.name === \"string\" && d.name.toLowerCase().includes(\"postman\");\n}) || domains[0];\npm.expect(domain.id, \"seed domain id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiDomainId\", String(domain.id));\npm.environment.set(\"smooveApiDomainVerifyName\", String(domain.name));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst domainId = Number(pm.environment.get(\"smooveApiDomainId\"));\nconst expectedName = pm.environment.get(\"smooveApiDomainVerifyName\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/domains\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\n\npm.test('Verified domain remains listed with DNS records after verify', function () {\n    pm.expect(domainId, 'domainId').to.be.above(0);\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    const domains = listRes.json();\n    pm.expect(domains, 'domains').to.be.an('array');\n    const found = domains.find(function (d) { return Number(d.id) === domainId; });\n    pm.expect(found, 'verified domain still listed').to.be.an('object');\n    pm.expect(found.name, 'name').to.eql(expectedName);\n    pm.expect(found.dnsRecords, 'dnsRecords').to.be.an('array');\n    pm.expect(found.dnsRecords.length, 'dnsRecords length').to.eql(3);\n});\n\npm.environment.unset(\"smooveApiDomainVerifyName\");"]}}],"id":"35374a13-0250-4756-a363-466c44d5fa55","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[],"url":"{{smooveApiBaseURL}}/api/v1/domains/verify/{{smooveApiDomainId}}","urlObject":{"path":["api","v1","domains","verify","{{smooveApiDomainId}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiDomainId}}","key":"domainId"}]}},"response":[],"_postman_id":"35374a13-0250-4756-a363-466c44d5fa55"}],"id":"675752e4-28ad-419c-806a-2c659c5fd281","_postman_id":"675752e4-28ad-419c-806a-2c659c5fd281","description":""}],"id":"7d2be4d0-c5d5-43d6-b5bf-262c4ac6df94","_postman_id":"7d2be4d0-c5d5-43d6-b5bf-262c4ac6df94","description":""},{"name":"Domains Get Domains","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const dnsRecordTypes = ['Txt', 'CName', 'Unknown'];\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is a non-empty array of domains with expected shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'domains length').to.be.above(0);\n    const item = json[0];\n    ['id', 'name', 'dnsRecords'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.name, 'name').to.be.a('string').and.not.equal('');\n    pm.expect(item.dnsRecords, 'dnsRecords').to.be.an('array');\n    pm.expect(item.dnsRecords.length, 'dnsRecords length').to.eql(3);\n    item.dnsRecords.forEach(function (record, index) {\n        const label = 'dnsRecords[' + index + ']';\n        ['isVerified', 'dnsRecordType', 'name', 'hostName', 'value'].forEach(function (key) {\n            pm.expect(record, label + ' missing ' + key).to.have.property(key);\n        });\n        pm.expect(record.isVerified, label + '.isVerified').to.be.a('boolean');\n        pm.expect(record.dnsRecordType, label + '.dnsRecordType').to.be.a('string');\n        pm.expect(dnsRecordTypes, label + '.dnsRecordType value').to.include(record.dnsRecordType);\n        pm.expect(record.name, label + '.name').to.be.a('string').and.not.equal('');\n        pm.expect(record.hostName, label + '.hostName').to.be.a('string').and.not.equal('');\n        pm.expect(record.value, label + '.value').to.be.a('string').and.not.equal('');\n    });\n});\n\npm.test('Domain names are unique and dns host names reference the domain', function () {\n    const json = pm.response.json();\n    const names = json.map(function (d) { return d.name; });\n    pm.expect(new Set(names).size, 'unique domain names').to.eql(names.length);\n    const item = json[0];\n    item.dnsRecords.forEach(function (record) {\n        pm.expect(record.hostName.toLowerCase(), 'hostName contains domain').to.include(item.name.toLowerCase());\n    });\n});"]}}],"id":"c22cff61-eefa-48c5-95fd-07f0f4f9abfe","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/domains","urlObject":{"path":["api","v1","domains"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c22cff61-eefa-48c5-95fd-07f0f4f9abfe"},{"name":"Domains Add Domain","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}\n\nconst domainName = \"postman-\" + ts + \".1.1.1.1.nip.io\";\npm.variables.set(\"smooveApiDomainName\", domainName);\npm.request.body.update(JSON.stringify({\n    name: domainName\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expectedName = pm.variables.get(\"smooveApiDomainName\");\nconst dnsRecordTypes = ['Txt', 'CName', 'Unknown'];\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Created domain echoes the requested name with DNS records', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'name', 'dnsRecords'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(json.name, 'name').to.eql(expectedName);\n    pm.expect(json.dnsRecords, 'dnsRecords').to.be.an('array');\n    pm.expect(json.dnsRecords.length, 'dnsRecords length').to.eql(3);\n    json.dnsRecords.forEach(function (item, index) {\n        const label = 'dnsRecords[' + index + ']';\n        ['isVerified', 'dnsRecordType', 'name', 'hostName', 'value'].forEach(function (key) {\n            pm.expect(item, label + ' missing ' + key).to.have.property(key);\n        });\n        pm.expect(item.isVerified, label + '.isVerified').to.be.a('boolean');\n        pm.expect(item.dnsRecordType, label + '.dnsRecordType').to.be.a('string');\n        pm.expect(dnsRecordTypes, label + '.dnsRecordType value').to.include(item.dnsRecordType);\n        pm.expect(item.name, label + '.name').to.be.a('string').and.not.equal('');\n        pm.expect(item.hostName, label + '.hostName').to.be.a('string');\n        pm.expect(item.hostName.toLowerCase(), label + '.hostName contains domain').to.include(expectedName.toLowerCase());\n        pm.expect(item.value, label + '.value').to.be.a('string').and.not.equal('');\n        pm.expect(item.isVerified, label + '.isVerified for new domain').to.eql(false);\n    });\n});\n\nconst created = pm.response.json();\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/domains\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test('Created domain appears in GET /domains', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    const domains = listRes.json();\n    pm.expect(domains, 'domains').to.be.an('array');\n    const found = domains.find(function (d) { return Number(d.id) === Number(created.id); });\n    pm.expect(found, 'created domain in list').to.be.an('object');\n    pm.expect(found.name, 'listed name').to.eql(expectedName);\n});\n\n// DomainsController has no DELETE route; attempt cleanup for leftover postman domains if an admin path exists.\npm.sendRequest({\n    url: baseUrl + \"/api/v1/domains/\" + created.id,\n    method: \"DELETE\",\n    header: { \"Cookie\": `jvlpsi=${cookie};` }\n}, function () { /* best-effort cleanup; 404 is expected */ });"]}}],"id":"14d1b980-f9e4-4ccb-8695-4dcc9b464ba1","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"postman-placeholder.example.com\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/domains","urlObject":{"path":["api","v1","domains"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"14d1b980-f9e4-4ccb-8695-4dcc9b464ba1"}],"id":"1bcda1ca-c006-4a2e-aa74-170cf94ab459","_postman_id":"1bcda1ca-c006-4a2e-aa74-170cf94ab459","description":""},{"name":"leadGeneration","item":[{"name":"{id}","item":[{"name":"restore","item":[{"name":"Lead Generations Restore","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst title = \"Postman LG Restore \" + suffix;\n\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction headers() {\n    return {\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    };\n}\n\nconst html =\n    \"<!DOCTYPE html><html><head><title>\" + title + \"</title></head><body>\" +\n    \"<form data-smoove-form action=\\\"https://www.smoove.io\\\" method=\\\"post\\\">\" +\n    \"<input type=\\\"email\\\" name=\\\"email\\\" placeholder=\\\"Enter your email\\\">\" +\n    \"<button type=\\\"submit\\\">Submit</button></form></body></html>\";\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration/save\",\n    method: \"POST\",\n    header: headers(),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            id: 0,\n            html: html,\n            leadGenerationType: \"lp\",\n            isDuplicate: false\n        })\n    }\n});\npm.expect(createRes.code, \"Smoove.Api create landing page status\").to.eql(200);\nconst leadId = Number(createRes.json().id);\npm.expect(leadId, \"created lead generation id\").to.be.above(0);\n\nconst deleteRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration\",\n    method: \"DELETE\",\n    header: headers(),\n    body: { mode: \"raw\", raw: JSON.stringify({ ids: [leadId] }) }\n});\npm.expect(deleteRes.code, \"soft-delete lead generation status\").to.eql(200);\n\npm.environment.set(\"smooveApiLeadGenerationIdToRestore\", String(leadId));\npm.environment.set(\"smooveApiLeadGenerationTitleToRestore\", title);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expectedId = Number(pm.environment.get(\"smooveApiLeadGenerationIdToRestore\"));\nconst expectedTitle = pm.environment.get(\"smooveApiLeadGenerationTitleToRestore\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    ['id', 'title', 'isDeleted', 'type', 'formContent', 'subscriptions', 'customUrls', 'dateModified', 'visits', 'isPublished', 'clicks', 'conversions', 'conversionRate', 'clickthroughRate', 'builderType'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.title, 'title').to.be.a('string');\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.type, 'type').to.be.a('string');\n    pm.expect(json.formContent, 'formContent').to.be.a('string');\n    pm.expect(json.subscriptions, 'subscriptions').to.be.a('number');\n    pm.expect(json.customUrls, 'customUrls').to.be.an('array');\n    pm.expect(json.dateModified, 'dateModified').to.be.a('string');\n    pm.expect(json.visits, 'visits').to.be.a('number');\n    pm.expect(json.isPublished, 'isPublished').to.be.a('boolean');\n    pm.expect(json.clicks, 'clicks').to.be.a('number');\n    pm.expect(json.conversions, 'conversions').to.be.a('number');\n    pm.expect(json.conversionRate, 'conversionRate').to.be.a('number');\n    pm.expect(json.clickthroughRate, 'clickthroughRate').to.be.a('number');\n    pm.expect(json.builderType, 'builderType').to.be.a('string');\n});\n\npm.test('Restored item echoes seed and is not deleted', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.eql(expectedId);\n    pm.expect(json.title, 'title').to.eql(expectedTitle);\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n});\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration/\" + expectedId + \"?slim=1\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` }\n});\n\npm.test('Follow-up GET confirms restore', function () {\n    pm.expect(getRes.code, \"get-by-id status\").to.eql(200);\n    const body = getRes.json();\n    pm.expect(body.id, \"id\").to.eql(expectedId);\n    pm.expect(body.isDeleted, \"isDeleted\").to.eql(false);\n    pm.expect(body.title, \"title\").to.eql(expectedTitle);\n});\n\nconst cleanupRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration\",\n    method: \"DELETE\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    },\n    body: { mode: \"raw\", raw: JSON.stringify({ ids: [expectedId] }) }\n});\npm.test(\"Cleanup: restored lead generation soft-deleted again\", function () {\n    pm.expect([200, 201, 204]).to.include(cleanupRes.code);\n});\n\npm.environment.unset(\"smooveApiLeadGenerationIdToRestore\");\npm.environment.unset(\"smooveApiLeadGenerationTitleToRestore\");"]}}],"id":"7613917e-9294-4e01-8baf-b7adc303221f","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/:id/restore","urlObject":{"path":["api","v1","leadGeneration",":id","restore"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiLeadGenerationIdToRestore}}","key":"id"}]}},"response":[],"_postman_id":"7613917e-9294-4e01-8baf-b7adc303221f"}],"id":"43d5f785-a94d-4dde-a1fb-df0754c65180","_postman_id":"43d5f785-a94d-4dde-a1fb-df0754c65180","description":""},{"name":"url","item":[{"name":"Lead Generations Get Lead Generation Url","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration?isDeleted=false&page=1&pageSize=1\",\n    method: \"GET\",\n    header: { Cookie: `jvlpsi=${cookie};`, Accept: \"application/json\" }\n});\npm.expect(listRes.code, \"list status\").to.eql(200);\nconst item = listRes.json().results && listRes.json().results[0];\npm.expect(item && item.id, \"seed lead generation id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiLeadGenerationId\", String(item.id));\n\nlet contactId = pm.environment.get(\"smooveApiContactId\");\nif (!contactId) {\n    const ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const createRes = await send({\n        url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n        method: \"POST\",\n        header: { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` },\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({\n                email: \"postman.lg.url.\" + ts + \"@smoove.smoove-api.postman.test\",\n                firstname: \"Postman\",\n                lastname: \"LeadGenUrl\",\n                mailPermissions: true,\n                unsubscribed: false,\n                isDeleted: false\n            })\n        }\n    });\n    pm.expect([200, 201], \"create contact status\").to.include(createRes.code);\n    contactId = String(createRes.json().id);\n    pm.environment.set(\"smooveApiContactId\", contactId);\n}\npm.expect(contactId, \"smooveApiContactId\").to.be.ok;\ntry {\n    pm.request.url.query.upsert({ key: \"contactId\", value: String(contactId) });\n} catch (e) {}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has result url string', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing result').to.have.property('result');\n    pm.expect(json.result, 'result').to.be.a('string');\n});\n\npm.test('Result is a non-empty contact-scoped url', function () {\n    const json = pm.response.json();\n    pm.expect(json.result.trim().length, 'result length').to.be.at.least(1);\n    pm.expect(json.result, 'result').to.match(/smoove\\.io|viplus|members|lp\\.vp4\\.me/i);\n});"]}}],"id":"bf1feb3c-c3ef-4103-8b7f-6903de234709","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/:id/url?contactId={{smooveApiContactId}}","urlObject":{"path":["api","v1","leadGeneration",":id","url"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"contactId","value":"{{smooveApiContactId}}"}],"variable":[{"type":"any","value":"{{smooveApiLeadGenerationId}}","key":"id"}]}},"response":[],"_postman_id":"bf1feb3c-c3ef-4103-8b7f-6903de234709"}],"id":"0bde30ad-ab44-4aec-ad68-c05434b8e8e6","_postman_id":"0bde30ad-ab44-4aec-ad68-c05434b8e8e6","description":""},{"name":"Lead Generations Get By Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration?isDeleted=false&page=1&pageSize=1\",\n    method: \"GET\",\n    header: { Cookie: `jvlpsi=${cookie};`, Accept: \"application/json\" }\n});\npm.expect(listRes.code, \"list status\").to.eql(200);\nconst item = listRes.json().results && listRes.json().results[0];\npm.expect(item && item.id, \"seed lead generation id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiLeadGenerationId\", String(item.id));\npm.environment.set(\"smooveApiLeadGenerationTitle\", item.title || \"\");"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedId = Number(pm.environment.get(\"smooveApiLeadGenerationId\"));\nconst expectedTitle = pm.environment.get(\"smooveApiLeadGenerationTitle\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'title', 'isDeleted', 'type', 'formContent', 'subscriptions', 'customer', 'customUrls', 'dateModified', 'visits', 'isPublished', 'clicks', 'conversions', 'conversionRate', 'clickthroughRate', 'builderType', 'isAttachedToBusinessJourney'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.title, 'title').to.be.a('string');\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.type, 'type').to.be.a('string');\n    pm.expect(json.formContent, 'formContent').to.be.a('string');\n    pm.expect(json.subscriptions, 'subscriptions').to.be.a('number');\n    pm.expect(json.customer, 'customer').to.be.an('object');\n    pm.expect(json.customUrls, 'customUrls').to.be.an('array');\n    pm.expect(json.dateModified, 'dateModified').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.dateModified)), 'dateModified should be a parseable date').to.equal(false);\n    pm.expect(json.visits, 'visits').to.be.a('number');\n    pm.expect(json.isPublished, 'isPublished').to.be.a('boolean');\n    pm.expect(json.clicks, 'clicks').to.be.a('number');\n    pm.expect(json.conversions, 'conversions').to.be.a('number');\n    pm.expect(json.conversionRate, 'conversionRate').to.be.a('number');\n    pm.expect(json.clickthroughRate, 'clickthroughRate').to.be.a('number');\n    pm.expect(json.builderType, 'builderType').to.be.a('string');\n    pm.expect(json.isAttachedToBusinessJourney, 'isAttachedToBusinessJourney').to.be.a('boolean');\n\n    ['id', 'siteId', 'mainSiteId', 'name', 'email', 'username', 'planType', 'dateCreated'].forEach(function (key) {\n        pm.expect(json.customer, 'missing customer.' + key).to.have.property(key);\n    });\n    pm.expect(json.customer.id, 'customer.id').to.be.a('number');\n    pm.expect(json.customer.siteId, 'customer.siteId').to.be.a('number');\n    pm.expect(json.customer.mainSiteId, 'customer.mainSiteId').to.be.a('number');\n    pm.expect(json.customer.name, 'customer.name').to.be.a('string');\n    pm.expect(json.customer.email, 'customer.email').to.be.a('string');\n    pm.expect(json.customer.username, 'customer.username').to.be.a('string');\n    pm.expect(json.customer.planType, 'customer.planType').to.be.a('string');\n    pm.expect(json.customer.dateCreated, 'customer.dateCreated').to.be.a('string');\n});\n\npm.test('Get-by-id returns the seeded lead generation', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.eql(expectedId);\n    pm.expect(json.title, 'title').to.eql(expectedTitle);\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n    pm.expect(json.type, 'type').to.not.equal('');\n    pm.expect(json.builderType, 'builderType').to.not.equal('');\n    pm.expect(json.customer.siteId, 'customer.siteId').to.be.above(0);\n});"]}}],"id":"3bc2205e-7ca8-45a3-9839-8624eeb9b930","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/:id?slim=1","urlObject":{"path":["api","v1","leadGeneration",":id"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"slim","value":"1"}],"variable":[{"type":"any","value":"{{smooveApiLeadGenerationId}}","key":"id"}]}},"response":[],"_postman_id":"3bc2205e-7ca8-45a3-9839-8624eeb9b930"}],"id":"12fe92bf-f436-4ea1-9cb5-4e40efa28b87","_postman_id":"12fe92bf-f436-4ea1-9cb5-4e40efa28b87","description":""},{"name":"count","item":[{"name":"Lead Generations Get Total Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const listRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/leadGeneration?isDeleted=false&page=1&pageSize=1\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative integer count', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isFinite(value)).to.be.true;\n    pm.expect(Number.isInteger(value), 'count should be an integer').to.be.true;\n    pm.expect(value, 'count').to.be.at.least(0);\n});\n\npm.test('Count equals the total rows of the lead generation list', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    pm.expect(pm.response.json(), 'count').to.eql(listRes.json().rows);\n});"]}}],"id":"c5877251-8056-4322-aa74-39d030e8db38","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/count","urlObject":{"path":["api","v1","leadGeneration","count"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c5877251-8056-4322-aa74-39d030e8db38"}],"id":"38d8b726-1c31-498b-9dc6-f4ee8be1e52f","_postman_id":"38d8b726-1c31-498b-9dc6-f4ee8be1e52f","description":""},{"name":"usage","item":[{"name":"Lead Generations Get Lead Page Usage","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['active', 'deleted', 'total'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.active, 'active').to.be.a('number');\n    pm.expect(json.deleted, 'deleted').to.be.a('number');\n    pm.expect(json.total, 'total').to.be.a('number');\n});\n\npm.test('Usage totals are consistent', function () {\n    const json = pm.response.json();\n    pm.expect(json.active, 'active').to.be.at.least(1);\n    pm.expect(json.deleted, 'deleted').to.be.at.least(0);\n    pm.expect(json.total, 'total').to.eql(json.active + json.deleted);\n});"]}}],"id":"b5348538-397c-4bda-be7e-f5d461c30704","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/usage","urlObject":{"path":["api","v1","leadGeneration","usage"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"b5348538-397c-4bda-be7e-f5d461c30704"}],"id":"0a1671b1-41ad-4d3a-96e4-cdd05a64df44","_postman_id":"0a1671b1-41ad-4d3a-96e4-cdd05a64df44","description":""},{"name":"quota-reached","item":[{"name":"Lead Generations Get Quota Details","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['availableAccountPlanType', 'availableAsUpsale', 'availableOnUpgrade', 'isLimitReached', 'isLimitExceeded', 'availableUnits', 'limit', 'used', 'isUnlimited', 'isAvailable', 'availableAccountPlanName'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.availableAccountPlanType, 'availableAccountPlanType').to.be.a('string');\n    pm.expect(json.availableAsUpsale, 'availableAsUpsale').to.be.a('boolean');\n    pm.expect(json.availableOnUpgrade, 'availableOnUpgrade').to.be.a('boolean');\n    pm.expect(json.isLimitReached, 'isLimitReached').to.be.a('boolean');\n    pm.expect(json.isLimitExceeded, 'isLimitExceeded').to.be.a('boolean');\n    pm.expect(json.availableUnits, 'availableUnits').to.be.a('number');\n    pm.expect(json.limit, 'limit').to.be.a('number');\n    pm.expect(json.used, 'used').to.be.a('number');\n    pm.expect(json.isUnlimited, 'isUnlimited').to.be.a('boolean');\n    pm.expect(json.isAvailable, 'isAvailable').to.be.a('boolean');\n    pm.expect(json.availableAccountPlanName, 'availableAccountPlanName').to.be.a('string');\n});\n\npm.test('Landing-page quota is available with consistent values', function () {\n    const json = pm.response.json();\n    pm.expect(json.isAvailable, 'isAvailable').to.eql(true);\n    pm.expect(json.used, 'used').to.be.at.least(0);\n    pm.expect(json.limit, 'limit').to.be.at.least(0);\n    pm.expect(json.availableUnits, 'availableUnits').to.be.at.least(0);\n    pm.expect(json.availableAccountPlanType, 'availableAccountPlanType').to.not.equal('');\n    pm.expect(json.availableAccountPlanName, 'availableAccountPlanName').to.not.equal('');\n    if (json.isUnlimited) {\n        pm.expect(json.isLimitReached, 'isLimitReached when unlimited').to.eql(false);\n        pm.expect(json.isLimitExceeded, 'isLimitExceeded when unlimited').to.eql(false);\n    } else {\n        pm.expect(json.availableUnits, 'availableUnits').to.eql(json.limit - json.used);\n    }\n});"]}}],"id":"921fb3d9-88b7-4d88-8a21-62bb779eac4e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/quota-reached?type=lp","urlObject":{"path":["api","v1","leadGeneration","quota-reached"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"type","value":"lp"}],"variable":[]}},"response":[],"_postman_id":"921fb3d9-88b7-4d88-8a21-62bb779eac4e"}],"id":"9230331b-4d41-44d9-b76a-e1c95fc74428","_postman_id":"9230331b-4d41-44d9-b76a-e1c95fc74428","description":""},{"name":"form-answers","item":[{"name":"Lead Generations Get Form Answers","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration?isDeleted=false&page=1&pageSize=1\",\n    method: \"GET\",\n    header: { Cookie: `jvlpsi=${cookie};`, Accept: \"application/json\" }\n});\npm.expect(listRes.code, \"list status\").to.eql(200);\nconst item = listRes.json().results && listRes.json().results[0];\npm.expect(item && item.id, \"seed form id\").to.be.a(\"number\").and.above(0);\nconst formId = String(item.id);\npm.environment.set(\"smooveApiLeadGenerationFormId\", formId);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedFormId = Number(pm.environment.get(\"smooveApiLeadGenerationFormId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an object of answer arrays', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    Object.keys(json).forEach(function (key) {\n        pm.expect(json[key], key).to.be.an('array');\n        json[key].forEach(function (answer, index) {\n            ['id', 'formSubmissionId', 'formId', 'formFieldId', 'submittedAt', 'submittedByContactId', 'value'].forEach(function (field) {\n                pm.expect(answer, key + '[' + index + '] missing ' + field).to.have.property(field);\n            });\n            pm.expect(answer.id, 'id').to.be.a('number');\n            pm.expect(answer.formSubmissionId, 'formSubmissionId').to.be.a('number');\n            pm.expect(answer.formId, 'formId').to.be.a('number');\n            pm.expect(answer.formFieldId, 'formFieldId').to.be.a('number');\n            pm.expect(answer.submittedAt, 'submittedAt').to.be.a('string');\n            pm.expect(answer.submittedByContactId, 'submittedByContactId').to.be.a('number');\n            pm.expect(answer.value, 'value').to.be.a('string');\n        });\n    });\n});\n\npm.test('Form answers belong to seeded form when present', function () {\n    const json = pm.response.json();\n    Object.keys(json).forEach(function (key) {\n        json[key].forEach(function (answer) {\n            pm.expect(answer.formId, 'formId').to.eql(expectedFormId);\n            pm.expect(answer.id, 'id').to.be.above(0);\n        });\n    });\n});"]}}],"id":"2a56341c-abec-4876-bfe1-2c2b76c8e376","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/form-answers?formId={{smooveApiLeadGenerationFormId}}&page=1&pageSize=50&unique=false","urlObject":{"path":["api","v1","leadGeneration","form-answers"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"formId","value":"{{smooveApiLeadGenerationFormId}}"},{"key":"page","value":"1"},{"key":"pageSize","value":"50"},{"key":"unique","value":"false"}],"variable":[]}},"response":[],"_postman_id":"2a56341c-abec-4876-bfe1-2c2b76c8e376"}],"id":"81774dfa-bbe2-4130-a982-efac7e5c5a99","_postman_id":"81774dfa-bbe2-4130-a982-efac7e5c5a99","description":""},{"name":"answered-questions","item":[{"name":"Lead Generations Get Answered Questions","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration?isDeleted=false&page=1&pageSize=1\",\n    method: \"GET\",\n    header: { Cookie: `jvlpsi=${cookie};`, Accept: \"application/json\" }\n});\npm.expect(listRes.code, \"list status\").to.eql(200);\nconst item = listRes.json().results && listRes.json().results[0];\npm.expect(item && item.id, \"seed form id\").to.be.a(\"number\").and.above(0);\nconst formId = String(item.id);\npm.environment.set(\"smooveApiLeadGenerationFormId\", formId);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedFormId = Number(pm.environment.get(\"smooveApiLeadGenerationFormId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected item shape when present', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    json.forEach(function (item, index) {\n        ['id', 'formId', 'createdAt', 'value', 'type', 'options'].forEach(function (key) {\n            pm.expect(item, 'item[' + index + '] missing ' + key).to.have.property(key);\n        });\n        pm.expect(item.id, 'id').to.be.a('number');\n        pm.expect(item.formId, 'formId').to.be.a('number');\n        pm.expect(item.createdAt, 'createdAt').to.be.a('string');\n        pm.expect(Number.isNaN(Date.parse(item.createdAt)), 'createdAt should be a parseable date').to.equal(false);\n        pm.expect(item.value, 'value').to.be.a('string');\n        pm.expect(item.type, 'type').to.be.a('string');\n        pm.expect(item.options, 'options').to.be.a('string');\n    });\n});\n\npm.test('Answered questions belong to seeded form or are empty', function () {\n    const json = pm.response.json();\n    json.forEach(function (item) {\n        pm.expect(item.formId, 'formId').to.eql(expectedFormId);\n        pm.expect(item.id, 'id').to.be.above(0);\n    });\n});"]}}],"id":"f6000d9b-3a35-438f-9b4d-8110fbc56c77","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/answered-questions?formId={{smooveApiLeadGenerationFormId}}","urlObject":{"path":["api","v1","leadGeneration","answered-questions"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"formId","value":"{{smooveApiLeadGenerationFormId}}"}],"variable":[]}},"response":[],"_postman_id":"f6000d9b-3a35-438f-9b4d-8110fbc56c77"}],"id":"81857dc9-85de-4d05-b636-0134f1ff6d22","_postman_id":"81857dc9-85de-4d05-b636-0134f1ff6d22","description":""},{"name":"form-submissions-count","item":[{"name":"Lead Generations Get Form Submissions Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration?isDeleted=false&page=1&pageSize=1\",\n    method: \"GET\",\n    header: { Cookie: `jvlpsi=${cookie};`, Accept: \"application/json\" }\n});\npm.expect(listRes.code, \"list status\").to.eql(200);\nconst item = listRes.json().results && listRes.json().results[0];\npm.expect(item && item.id, \"seed form id\").to.be.a(\"number\").and.above(0);\nconst formId = String(item.id);\npm.environment.set(\"smooveApiLeadGenerationFormId\", formId);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst formId = pm.environment.get(\"smooveApiLeadGenerationFormId\");\n\nconst answersRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/leadGeneration/form-answers?formId=\" + formId + \"&page=1&pageSize=50&unique=false\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` }\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative integer consistent with form-answers', function () {\n    const value = pm.response.json();\n    pm.expect(value, 'submissions count body').to.be.a('number');\n    pm.expect(Number.isInteger(value), 'integer').to.eql(true);\n    pm.expect(value).to.be.at.least(0);\n\n    pm.expect(answersRes.code, \"form-answers status\").to.eql(200);\n    const answers = answersRes.json();\n    pm.expect(answers).to.be.an('object');\n    const hasAnswers = Object.keys(answers).some(function (k) { return Array.isArray(answers[k]) && answers[k].length > 0; });\n    if (!hasAnswers) {\n        pm.expect(value, 'count when no answers').to.eql(0);\n    }\n});"]}}],"id":"9059640a-f7af-4298-aee9-d8caf3d67065","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/form-submissions-count?formId={{smooveApiLeadGenerationFormId}}","urlObject":{"path":["api","v1","leadGeneration","form-submissions-count"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"formId","value":"{{smooveApiLeadGenerationFormId}}"}],"variable":[]}},"response":[],"_postman_id":"9059640a-f7af-4298-aee9-d8caf3d67065"}],"id":"7063d325-86f3-43e9-9704-43f12ad7b819","_postman_id":"7063d325-86f3-43e9-9704-43f12ad7b819","description":""},{"name":"formQuestionsWithAnswers","item":[{"name":"Lead Generations Get Form Questions With Answers","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration?isDeleted=false&page=1&pageSize=1\",\n    method: \"GET\",\n    header: { Cookie: `jvlpsi=${cookie};`, Accept: \"application/json\" }\n});\npm.expect(listRes.code, \"list status\").to.eql(200);\nconst item = listRes.json().results && listRes.json().results[0];\npm.expect(item && item.id, \"seed form id\").to.be.a(\"number\").and.above(0);\nconst formId = String(item.id);\npm.environment.set(\"smooveApiLeadGenerationFormId\", formId);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with question/answers shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    json.forEach(function (item, index) {\n        pm.expect(item, 'item[' + index + '] missing question').to.have.property('question');\n        pm.expect(item, 'item[' + index + '] missing answers').to.have.property('answers');\n        pm.expect(item.question, 'question').to.be.an('object');\n        pm.expect(item.answers, 'answers').to.be.an('array');\n        ['id', 'formId', 'createdAt', 'value', 'type'].forEach(function (key) {\n            pm.expect(item.question, 'question missing ' + key).to.have.property(key);\n        });\n        pm.expect(item.question.id, 'question.id').to.be.a('number');\n        pm.expect(item.question.formId, 'question.formId').to.be.a('number');\n        pm.expect(item.question.createdAt, 'question.createdAt').to.be.a('string');\n        pm.expect(item.question.value, 'question.value').to.be.a('string');\n        pm.expect(item.question.type, 'question.type').to.be.a('string');\n        item.answers.forEach(function (answer, aIndex) {\n            ['id', 'formId', 'value'].forEach(function (key) {\n                pm.expect(answer, 'answers[' + aIndex + '] missing ' + key).to.have.property(key);\n            });\n            pm.expect(answer.id, 'answer.id').to.be.a('number');\n            pm.expect(answer.formId, 'answer.formId').to.be.a('number');\n            pm.expect(answer.value, 'answer.value').to.be.a('string');\n        });\n    });\n});\n\npm.test('Seeded form returns a defined questions-with-answers list', function () {\n    const json = pm.response.json();\n    const expectedFormId = Number(pm.environment.get(\"smooveApiLeadGenerationFormId\"));\n    json.forEach(function (item) {\n        pm.expect(item.question.formId, 'question.formId').to.eql(expectedFormId);\n    });\n});"]}}],"id":"14211cea-b72b-44d9-b653-b84088fb7c6d","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/formQuestionsWithAnswers?formId={{smooveApiLeadGenerationFormId}}","urlObject":{"path":["api","v1","leadGeneration","formQuestionsWithAnswers"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"formId","value":"{{smooveApiLeadGenerationFormId}}"}],"variable":[]}},"response":[],"_postman_id":"14211cea-b72b-44d9-b653-b84088fb7c6d"}],"id":"0d32f2bb-9757-4bf9-a7e5-89d7b55ad2f6","_postman_id":"0d32f2bb-9757-4bf9-a7e5-89d7b55ad2f6","description":""},{"name":"forms-for-contact","item":[{"name":"{contactId}","item":[{"name":"Lead Generations Get Forms By Contact Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nlet contactId = pm.environment.get(\"smooveApiContactId\");\nconst looksValid = contactId && String(contactId).indexOf(\"{{\") === -1 && Number(contactId) > 0;\nif (looksValid) {\n    const getRes = await send({\n        url: baseUrl + \"/api/v1/contacts/\" + contactId,\n        method: \"GET\",\n        header: { Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` }\n    });\n    if (getRes.code !== 200) {\n        contactId = null;\n    }\n} else {\n    contactId = null;\n}\n\nif (!contactId) {\n    const ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const createRes = await send({\n        url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n        method: \"POST\",\n        header: { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` },\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({\n                email: \"postman.lg.forms.\" + ts + \"@smoove.smoove-api.postman.test\",\n                firstname: \"Postman\",\n                lastname: \"LeadGen\",\n                mailPermissions: true,\n                unsubscribed: false,\n                isDeleted: false\n            })\n        }\n    });\n    pm.expect([200, 201], \"create contact status\").to.include(createRes.code);\n    const created = createRes.json();\n    pm.expect(created && created.id, \"seed contact id\").to.be.a(\"number\").and.above(0);\n    contactId = String(created.id);\n    pm.environment.set(\"smooveApiContactId\", contactId);\n}\npm.expect(contactId, \"smooveApiContactId\").to.be.ok;"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json, 'forms-for-contact body').to.be.an('array');\n    json.forEach(function (item, index) {\n        ['formId', 'submissionsCount', 'formName', 'submissions'].forEach(function (key) {\n            pm.expect(item, 'item[' + index + '] missing ' + key).to.have.property(key);\n        });\n        pm.expect(item.formId, 'formId').to.be.a('number');\n        pm.expect(item.submissionsCount, 'submissionsCount').to.be.a('number');\n        pm.expect(item.formName, 'formName').to.be.a('string');\n        pm.expect(item.submissions, 'submissions').to.be.an('array');\n        pm.expect(item.submissions.length, 'submissions length').to.eql(item.submissionsCount);\n        item.submissions.forEach(function (nestedItem, nIndex) {\n            ['formSubmissionId', 'formId', 'timestamp', 'formName'].forEach(function (key) {\n                pm.expect(nestedItem, 'submissions[' + nIndex + '] missing ' + key).to.have.property(key);\n            });\n            pm.expect(nestedItem.formSubmissionId, 'formSubmissionId').to.be.a('number');\n            pm.expect(nestedItem.formId, 'formId').to.be.a('number').and.eql(item.formId);\n            pm.expect(nestedItem.timestamp, 'timestamp').to.be.a('string');\n            pm.expect(Number.isNaN(Date.parse(nestedItem.timestamp)), 'timestamp should be a parseable date').to.equal(false);\n            pm.expect(nestedItem.formName, 'formName').to.be.a('string');\n        });\n    });\n});\n\npm.test('Forms for contact have positive ids when present', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    json.forEach(function (item) {\n        pm.expect(item.formId, 'formId').to.be.above(0);\n        pm.expect(item.submissionsCount, 'submissionsCount').to.be.at.least(0);\n    });\n});"]}}],"id":"e2bc0540-7874-40f6-a3cf-46db39b8787a","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/forms-for-contact/:contactId","urlObject":{"path":["api","v1","leadGeneration","forms-for-contact",":contactId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiContactId}}","key":"contactId"}]}},"response":[],"_postman_id":"e2bc0540-7874-40f6-a3cf-46db39b8787a"}],"id":"57c1b060-fca7-4a1f-8313-243192c0dbc5","_postman_id":"57c1b060-fca7-4a1f-8313-243192c0dbc5","description":""}],"id":"5244a371-0aa0-4e4e-8e94-4e115efd6761","_postman_id":"5244a371-0aa0-4e4e-8e94-4e115efd6761","description":""},{"name":"form-answers-count-for-contact","item":[{"name":"{contactId}","item":[{"name":"Lead Generations Get Form Answers Count By Contact Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nlet contactId = pm.environment.get(\"smooveApiContactId\");\nconst looksValid = contactId && String(contactId).indexOf(\"{{\") === -1 && Number(contactId) > 0;\nif (looksValid) {\n    const getRes = await send({\n        url: baseUrl + \"/api/v1/contacts/\" + contactId,\n        method: \"GET\",\n        header: { Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` }\n    });\n    if (getRes.code !== 200) {\n        contactId = null;\n    }\n} else {\n    contactId = null;\n}\n\nif (!contactId) {\n    const ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const createRes = await send({\n        url: baseUrl + \"/api/v1/contacts?suppressWarnings=true\",\n        method: \"POST\",\n        header: { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` },\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({\n                email: \"postman.lg.count.\" + ts + \"@smoove.smoove-api.postman.test\",\n                firstname: \"Postman\",\n                lastname: \"LeadGenCount\",\n                mailPermissions: true,\n                unsubscribed: false,\n                isDeleted: false\n            })\n        }\n    });\n    pm.expect([200, 201], \"create contact status\").to.include(createRes.code);\n    const created = createRes.json();\n    pm.expect(created && created.id, \"seed contact id\").to.be.a(\"number\").and.above(0);\n    contactId = String(created.id);\n    pm.environment.set(\"smooveApiContactId\", contactId);\n}\npm.expect(contactId, \"smooveApiContactId\").to.be.ok;"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst contactId = pm.environment.get(\"smooveApiContactId\");\nconst headers = { Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` };\n\nconst formsRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/leadGeneration/forms-for-contact/\" + contactId,\n    method: \"GET\",\n    header: headers\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative integer matching forms-for-contact totals', function () {\n    const value = pm.response.json();\n    pm.expect(value, 'answers count body').to.be.a('number');\n    pm.expect(Number.isInteger(value), 'integer').to.eql(true);\n    pm.expect(value).to.be.at.least(0);\n\n    pm.expect(formsRes.code, \"forms-for-contact status\").to.eql(200);\n    const forms = formsRes.json();\n    pm.expect(forms, 'forms-for-contact body').to.be.an('array');\n    const submissionsSum = forms.reduce(function (sum, item) {\n        return sum + Number(item.submissionsCount || 0);\n    }, 0);\n    pm.expect(value, 'answers count').to.eql(submissionsSum);\n});"]}}],"id":"2b7fd5dd-083a-4c96-8b81-f93b2f80dcce","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/form-answers-count-for-contact/:contactId","urlObject":{"path":["api","v1","leadGeneration","form-answers-count-for-contact",":contactId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiContactId}}","key":"contactId"}]}},"response":[],"_postman_id":"2b7fd5dd-083a-4c96-8b81-f93b2f80dcce"}],"id":"746cdfcb-a2dc-478c-8b55-8612a98dd55c","_postman_id":"746cdfcb-a2dc-478c-8b55-8612a98dd55c","description":""}],"id":"254a64bc-497a-411e-8e21-02292b6886cd","_postman_id":"254a64bc-497a-411e-8e21-02292b6886cd","description":""},{"name":"lead-pages-statistics","item":[{"name":"{leadGenerationType}","item":[{"name":"Lead Generations Get Lead Pages Statistics By Type","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['visits', 'uniqueVisits', 'subscriptions', 'uniqueSubscriptions', 'purchases', 'uniquePurchases', 'conversions', 'uniqueConversions', 'uniqueClicks', 'clicks', 'from', 'to', 'rates'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.visits, 'visits').to.be.a('number');\n    pm.expect(json.uniqueVisits, 'uniqueVisits').to.be.a('number');\n    pm.expect(json.subscriptions, 'subscriptions').to.be.a('number');\n    pm.expect(json.uniqueSubscriptions, 'uniqueSubscriptions').to.be.a('number');\n    pm.expect(json.purchases, 'purchases').to.be.a('number');\n    pm.expect(json.uniquePurchases, 'uniquePurchases').to.be.a('number');\n    pm.expect(json.conversions, 'conversions').to.be.a('number');\n    pm.expect(json.uniqueConversions, 'uniqueConversions').to.be.a('number');\n    pm.expect(json.uniqueClicks, 'uniqueClicks').to.be.a('number');\n    pm.expect(json.clicks, 'clicks').to.be.a('number');\n    pm.expect(json.from, 'from').to.be.a('string');\n    pm.expect(json.to, 'to').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.from)), 'from should be a parseable date').to.equal(false);\n    pm.expect(Number.isNaN(Date.parse(json.to)), 'to should be a parseable date').to.equal(false);\n    pm.expect(json.rates, 'rates').to.be.an('object');\n    pm.expect(json.rates, 'missing conversionRate').to.have.property('conversionRate');\n    pm.expect(json.rates, 'missing clickthroughRate').to.have.property('clickthroughRate');\n    pm.expect(json.rates.conversionRate, 'conversionRate').to.be.a('number');\n    pm.expect(json.rates.clickthroughRate, 'clickthroughRate').to.be.a('number');\n});\n\npm.test('Aggregate landing-page stats are non-negative with ordered date range', function () {\n    const json = pm.response.json();\n    ['visits', 'uniqueVisits', 'subscriptions', 'uniqueSubscriptions', 'purchases', 'uniquePurchases', 'conversions', 'uniqueConversions', 'uniqueClicks', 'clicks'].forEach(function (key) {\n        pm.expect(json[key], key).to.be.at.least(0);\n    });\n    pm.expect(json.uniqueVisits, 'uniqueVisits').to.be.at.most(json.visits);\n    pm.expect(Date.parse(json.to), 'to').to.be.at.least(Date.parse(json.from));\n    pm.expect(json.rates.conversionRate, 'conversionRate').to.be.at.least(0);\n    pm.expect(json.rates.clickthroughRate, 'clickthroughRate').to.be.at.least(0);\n});"]}}],"id":"015a3b80-eca9-4911-b152-ab8db637b7b5","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/lead-pages-statistics/:leadGenerationType","urlObject":{"path":["api","v1","leadGeneration","lead-pages-statistics",":leadGenerationType"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"lp","key":"leadGenerationType"}]}},"response":[],"_postman_id":"015a3b80-eca9-4911-b152-ab8db637b7b5"}],"id":"94614e3e-7361-49fc-a4f3-5b03f0bf2a36","_postman_id":"94614e3e-7361-49fc-a4f3-5b03f0bf2a36","description":""}],"id":"9383c878-a74d-4aaf-a8fe-42ef98a2e67a","_postman_id":"9383c878-a74d-4aaf-a8fe-42ef98a2e67a","description":""},{"name":"statistics","item":[{"name":"{leadGenerationItemId}","item":[{"name":"Lead Generations Get Lead Page Statistics By Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration?isDeleted=false&page=1&pageSize=1\",\n    method: \"GET\",\n    header: { Cookie: `jvlpsi=${cookie};`, Accept: \"application/json\" }\n});\npm.expect(listRes.code, \"list status\").to.eql(200);\nconst item = listRes.json().results && listRes.json().results[0];\npm.expect(item && item.id, \"seed lead generation id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiLeadGenerationId\", String(item.id));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['visits', 'uniqueVisits', 'subscriptions', 'uniqueSubscriptions', 'url', 'rates', 'statistics'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.visits, 'visits').to.be.a('number');\n    pm.expect(json.uniqueVisits, 'uniqueVisits').to.be.a('number');\n    pm.expect(json.subscriptions, 'subscriptions').to.be.a('number');\n    pm.expect(json.uniqueSubscriptions, 'uniqueSubscriptions').to.be.a('number');\n    pm.expect(json.url, 'url').to.be.a('string');\n    pm.expect(json.rates, 'rates').to.be.an('object');\n    pm.expect(json.rates, 'missing conversionRate').to.have.property('conversionRate');\n    pm.expect(json.rates, 'missing clickthroughRate').to.have.property('clickthroughRate');\n    pm.expect(json.rates.conversionRate, 'conversionRate').to.be.a('number');\n    pm.expect(json.rates.clickthroughRate, 'clickthroughRate').to.be.a('number');\n    pm.expect(json.statistics, 'statistics').to.be.an('array');\n    if (json.statistics.length) {\n        const nestedItem = json.statistics[0];\n        ['visits', 'uniqueVisits', 'subscriptions', 'uniqueSubscriptions', 'purchases', 'uniquePurchases', 'conversions', 'uniqueConversions', 'uniqueClicks', 'clicks', 'from', 'to', 'rates'].forEach(function (key) {\n            pm.expect(nestedItem, 'missing ' + key).to.have.property(key);\n        });\n        pm.expect(nestedItem.visits, 'visits').to.be.a('number');\n        pm.expect(nestedItem.uniqueVisits, 'uniqueVisits').to.be.a('number');\n        pm.expect(nestedItem.subscriptions, 'subscriptions').to.be.a('number');\n        pm.expect(nestedItem.uniqueSubscriptions, 'uniqueSubscriptions').to.be.a('number');\n        pm.expect(nestedItem.purchases, 'purchases').to.be.a('number');\n        pm.expect(nestedItem.uniquePurchases, 'uniquePurchases').to.be.a('number');\n        pm.expect(nestedItem.conversions, 'conversions').to.be.a('number');\n        pm.expect(nestedItem.uniqueConversions, 'uniqueConversions').to.be.a('number');\n        pm.expect(nestedItem.uniqueClicks, 'uniqueClicks').to.be.a('number');\n        pm.expect(nestedItem.clicks, 'clicks').to.be.a('number');\n        pm.expect(nestedItem.from, 'from').to.be.a('string');\n        pm.expect(nestedItem.to, 'to').to.be.a('string');\n        pm.expect(nestedItem.rates, 'rates').to.be.an('object');\n    }\n});\n\npm.test('Item statistics values are consistent', function () {\n    const json = pm.response.json();\n    pm.expect(json.url, 'url').to.not.equal('');\n    pm.expect(json.visits, 'visits').to.be.at.least(0);\n    pm.expect(json.uniqueVisits, 'uniqueVisits').to.be.at.most(json.visits);\n    pm.expect(json.subscriptions, 'subscriptions').to.be.at.least(0);\n    pm.expect(json.uniqueSubscriptions, 'uniqueSubscriptions').to.be.at.most(json.subscriptions);\n    pm.expect(json.rates.conversionRate, 'conversionRate').to.be.at.least(0);\n    pm.expect(json.rates.clickthroughRate, 'clickthroughRate').to.be.at.least(0);\n});"]}}],"id":"6e7b1f2f-1d1d-4321-b64f-80e5290eb6a5","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/statistics/:leadGenerationItemId","urlObject":{"path":["api","v1","leadGeneration","statistics",":leadGenerationItemId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiLeadGenerationId}}","key":"leadGenerationItemId"}]}},"response":[],"_postman_id":"6e7b1f2f-1d1d-4321-b64f-80e5290eb6a5"}],"id":"41dbdf82-ffe1-4eaa-90cc-f549504199a5","_postman_id":"41dbdf82-ffe1-4eaa-90cc-f549504199a5","description":""}],"id":"038f836f-bf0a-4900-8136-50cf151036d0","_postman_id":"038f836f-bf0a-4900-8136-50cf151036d0","description":""},{"name":"save","item":[{"name":"Lead Generations Save","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst title = \"Postman LG Save \" + suffix;\n\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\n// The landing page name is derived from the <title> of the saved html.\nconst html =\n    \"<!DOCTYPE html><html><head><title>\" + title + \"</title></head><body>\" +\n    \"<form data-smoove-form action=\\\"https://www.smoove.io\\\" method=\\\"post\\\">\" +\n    \"<input type=\\\"email\\\" name=\\\"email\\\" placeholder=\\\"Enter your email\\\">\" +\n    \"<button type=\\\"submit\\\">Submit</button></form></body></html>\";\n\npm.environment.set(\"smooveApiLeadGenerationTitleToSave\", title);\npm.request.body.update(JSON.stringify({\n    id: 0,\n    leadGenerationType: \"lp\",\n    html: html,\n    isDuplicate: false\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst expectedTitle = pm.environment.get(\"smooveApiLeadGenerationTitleToSave\");\nconst json = pm.response.json();\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response time is less than 30000ms\", function () {\n    pm.expect(pm.response.responseTime).to.be.below(30000);\n});\n\npm.test(\"Content-Type is application/json\", function () {\n    pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");\n});\n\npm.test(\"Response contains all required fields\", function () {\n    pm.expect(json).to.include.all.keys(\"id\", \"url\", \"name\", \"html\", \"formValidation\");\n});\n\npm.test(\"Field types are correct\", function () {\n    pm.expect(json.id).to.be.a(\"number\");\n    pm.expect(json.url).to.be.a(\"string\");\n    pm.expect(json.name).to.be.a(\"string\");\n    pm.expect(json.html).to.be.a(\"string\");\n    pm.expect(json.formValidation).to.be.an(\"object\");\n    pm.expect(json.formValidation.verdict).to.be.a(\"string\");\n    pm.expect(json.formValidation.verdictReasons).to.be.an(\"array\");\n});\n\npm.test(\"Field values are valid\", function () {\n    pm.expect(Number.isInteger(json.id), \"id should be an integer\").to.be.true;\n    pm.expect(json.id, \"id\").to.be.above(0);\n    pm.expect(json.url, \"url\").to.match(/^https?:\\/\\/.+/);\n    pm.expect(json.name, \"name is derived from the html title\").to.eql(expectedTitle);\n    pm.expect(json.html, \"html\").to.include(expectedTitle);\n    pm.expect([\"valid\", \"invalid\", \"noForm\"]).to.include(json.formValidation.verdict);\n});\n\ntry {\n    // The saved landing page must be readable back through the lead generation list API.\n    const getRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/leadGeneration/\" + json.id + \"?slim=1\",\n        method: \"GET\",\n        header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n    });\n\n    pm.test(\"Saved landing page can be fetched by id\", function () {\n        pm.expect(getRes.code, \"get-by-id status\").to.eql(200);\n        pm.expect(getRes.json().id, \"id\").to.eql(json.id);\n        pm.expect(getRes.json().title, \"title\").to.eql(expectedTitle);\n    });\n} finally {\n    // Cleanup: soft-delete the landing page created by this request, even if the GET failed.\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/leadGeneration\",\n        method: \"DELETE\",\n        header: { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" },\n        body: { mode: \"raw\", raw: JSON.stringify({ ids: [json.id] }) }\n    });\n    pm.test(\"Cleanup: saved landing page soft-deleted\", function () {\n        pm.expect([200, 201, 204]).to.include(cleanupRes.code);\n    });\n    pm.environment.unset(\"smooveApiLeadGenerationTitleToSave\");\n}"]}}],"id":"39e1f834-a774-43c0-9d52-910a847876d2","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"id\": 0,\n  \"leadGenerationType\": \"lp\",\n  \"html\": \"\",\n  \"isDuplicate\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/save","urlObject":{"path":["api","v1","leadGeneration","save"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"39e1f834-a774-43c0-9d52-910a847876d2"},{"name":"Lead Generations Save Unauthenticated","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 401\", function () {\n    pm.response.to.have.status(401);\n});\n\npm.test(\"Response time is less than 20000ms\", function () {\n    pm.expect(pm.response.responseTime).to.be.below(20000);\n});\n\npm.test(\"Error message is correct\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.have.property(\"message\");\n    pm.expect(json.message).to.be.a(\"string\").and.not.empty;\n    pm.expect(json.message).to.eql(\"Invalid authorization credentials\");\n});"]}}],"id":"24ae280c-7c28-4a7e-8f8a-99a757df1849","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"id\": 0,\n  \"leadGenerationType\": \"lp\",\n  \"html\": \"<!DOCTYPE html><html><head><title>Unauthenticated save</title></head><body></body></html>\",\n  \"isDuplicate\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration/save","urlObject":{"path":["api","v1","leadGeneration","save"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"24ae280c-7c28-4a7e-8f8a-99a757df1849"}],"id":"be96b9ae-3463-4007-8822-661e57017638","_postman_id":"be96b9ae-3463-4007-8822-661e57017638","description":""},{"name":"Lead Generations Bulk Delete","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst title = \"Postman LG BulkDelete \" + suffix;\n\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst html =\n    \"<!DOCTYPE html><html><head><title>\" + title + \"</title></head><body>\" +\n    \"<form data-smoove-form action=\\\"https://www.smoove.io\\\" method=\\\"post\\\">\" +\n    \"<input type=\\\"email\\\" name=\\\"email\\\" placeholder=\\\"Enter your email\\\">\" +\n    \"<button type=\\\"submit\\\">Submit</button></form></body></html>\";\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration/save\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            id: 0,\n            html: html,\n            leadGenerationType: \"lp\",\n            isDuplicate: false\n        })\n    }\n});\npm.expect(createRes.code, \"Smoove.Api create landing page status\").to.eql(200);\nconst leadId = Number(createRes.json().id);\npm.expect(leadId, \"created lead generation id\").to.be.above(0);\n\npm.environment.set(\"smooveApiLeadGenerationIdToDelete\", String(leadId));\npm.environment.set(\"smooveApiLeadGenerationTitleToDelete\", title);\npm.request.body.update(JSON.stringify({ ids: [leadId] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expectedId = Number(pm.environment.get(\"smooveApiLeadGenerationIdToDelete\"));\nconst expectedTitle = pm.environment.get(\"smooveApiLeadGenerationTitleToDelete\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with deleted lead generation shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"array\");\n    pm.expect(json.length, \"deleted lead generations length\").to.be.at.least(1);\n    const item = json.find(function (c) { return Number(c.id) === expectedId; });\n    pm.expect(item, \"deleted item\").to.be.an(\"object\");\n    pm.expect(item, \"missing id\").to.have.property(\"id\");\n    pm.expect(item, \"missing title\").to.have.property(\"title\");\n    pm.expect(item.id, \"id\").to.be.a(\"number\");\n    pm.expect(item.title, \"title\").to.be.a(\"string\");\n});\n\npm.test('Deleted item echoes seeded id and title', function () {\n    const json = pm.response.json();\n    const item = json.find(function (c) { return Number(c.id) === expectedId; });\n    pm.expect(item.id, \"id\").to.eql(expectedId);\n    pm.expect(item.title, \"title\").to.eql(expectedTitle);\n});\n\nconst getRes = await send({\n    url: baseUrl + \"/api/v1/leadGeneration/\" + expectedId + \"?slim=1\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` }\n});\n\npm.test('Follow-up GET shows soft-deleted flag', function () {\n    pm.expect(getRes.code, \"get-by-id status\").to.eql(200);\n    const body = getRes.json();\n    pm.expect(body.id, \"id\").to.eql(expectedId);\n    pm.expect(body.isDeleted, \"isDeleted\").to.eql(true);\n    pm.expect(body.title, \"title\").to.eql(expectedTitle);\n});\n\npm.environment.unset(\"smooveApiLeadGenerationIdToDelete\");\npm.environment.unset(\"smooveApiLeadGenerationTitleToDelete\");"]}}],"id":"2a9b434a-536e-4be9-9e78-2b849a560d50","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration","urlObject":{"path":["api","v1","leadGeneration"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"ids","value":""}],"variable":[]}},"response":[],"_postman_id":"2a9b434a-536e-4be9-9e78-2b849a560d50"},{"name":"Lead Generations Get Lead Generations","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination values match the request and first result shape', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.rows, 'rows').to.be.at.least(0);\n    pm.expect(json.results.length, 'results length').to.be.at.most(json.size);\n    if (json.rows > 0) {\n        pm.expect(json.pages, 'pages').to.be.at.least(1);\n        pm.expect(json.results.length, 'results length').to.be.at.least(1);\n        const item = json.results[0];\n        ['id', 'title', 'isDeleted', 'type', 'formContent', 'subscriptions', 'customer', 'url', 'customUrls', 'dateModified', 'visits', 'isPublished', 'clicks', 'conversions', 'conversionRate', 'clickthroughRate', 'builderType', 'isAttachedToBusinessJourney'].forEach(function (key) {\n            pm.expect(item, 'missing ' + key).to.have.property(key);\n        });\n        pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n        pm.expect(item.title, 'title').to.be.a('string');\n        pm.expect(item.isDeleted, 'isDeleted').to.eql(false);\n        pm.expect(item.type, 'type').to.be.a('string').and.not.equal('');\n        pm.expect(item.formContent, 'formContent').to.be.a('string');\n        pm.expect(item.subscriptions, 'subscriptions').to.be.a('number').and.at.least(0);\n        pm.expect(item.customer, 'customer').to.be.an('object');\n        pm.expect(item.url, 'url').to.be.a('string');\n        pm.expect(item.customUrls, 'customUrls').to.be.an('array');\n        pm.expect(item.dateModified, 'dateModified').to.be.a('string');\n        pm.expect(Number.isNaN(Date.parse(item.dateModified)), 'dateModified should be a parseable date').to.equal(false);\n        pm.expect(item.visits, 'visits').to.be.a('number').and.at.least(0);\n        pm.expect(item.isPublished, 'isPublished').to.be.a('boolean');\n        pm.expect(item.clicks, 'clicks').to.be.a('number').and.at.least(0);\n        pm.expect(item.conversions, 'conversions').to.be.a('number').and.at.least(0);\n        pm.expect(item.conversionRate, 'conversionRate').to.be.a('number');\n        pm.expect(item.clickthroughRate, 'clickthroughRate').to.be.a('number');\n        pm.expect(item.builderType, 'builderType').to.be.a('string').and.not.equal('');\n        pm.expect(item.isAttachedToBusinessJourney, 'isAttachedToBusinessJourney').to.be.a('boolean');\n        pm.expect(item.customer, 'missing customer.siteId').to.have.property('siteId');\n        pm.expect(item.customer.siteId, 'customer.siteId').to.be.a('number').and.above(0);\n    }\n});"]}}],"id":"a30dca73-28ed-4e2f-a0d5-0ac48881439e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/leadGeneration?isDeleted=false&page=1&pageSize=50&ignoreSiteId=false&includeCustomerInfo=false&accountCountry=0&includeVisits=false","urlObject":{"path":["api","v1","leadGeneration"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"isDeleted","value":"false"},{"key":"page","value":"1"},{"key":"pageSize","value":"50"},{"key":"ignoreSiteId","value":"false"},{"key":"includeCustomerInfo","value":"false"},{"key":"accountCountry","value":"0"},{"key":"includeVisits","value":"false"}],"variable":[]}},"response":[],"_postman_id":"a30dca73-28ed-4e2f-a0d5-0ac48881439e"}],"id":"c9b880a3-da9c-4437-9246-a2dfb96300d4","_postman_id":"c9b880a3-da9c-4437-9246-a2dfb96300d4","description":""},{"name":"lists","item":[{"name":"{id}","item":[{"name":"Lists Get","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.variables.get(\"smooveApiBaseURL\");\n\nif (!baseUrl || baseUrl.includes(\"{{\")) {\n    throw new Error(\"smooveApiBaseURL is not resolved to a real URL.\");\n}\n\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.headers.upsert({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst headers = {};\npm.request.headers.each((header) => {\n    if (header && header.key && header.disabled !== true) {\n        headers[header.key] = header.value;\n    }\n});\n\nconst listsRes = await pm.sendRequest({\n    url: `${baseUrl}/api/v1/lists?page=1&size=50&sort=asc`,\n    method: \"GET\",\n    header: headers\n});\npm.expect(listsRes.code, \"lists status\").to.eql(200);\n\nconst results = Array.isArray(listsRes.json().results) ? listsRes.json().results : [];\nconst validItem = results.find(item => item && Number(item.id) > 0);\npm.expect(validItem, \"a list with a valid id\").to.be.an(\"object\");\n\npm.environment.set(\"smooveApiListId\", String(validItem.id));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['isActive', 'contactsCount', 'isPublic', 'isPortal', 'isDynamic', 'isEvaluationInProgress', 'allowRegistration', 'id', 'name'].forEach(function (key) {\n            pm.expect(json, 'missing ' + key).to.have.property(key);\n        });\n        pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n        pm.expect(json.contactsCount, 'contactsCount').to.be.a('number').and.at.least(0);\n        pm.expect(json.isPublic, 'isPublic').to.be.a('boolean');\n        pm.expect(json.isPortal, 'isPortal').to.be.a('boolean');\n        pm.expect(json.isDynamic, 'isDynamic').to.be.a('boolean');\n        pm.expect(json.isEvaluationInProgress, 'isEvaluationInProgress').to.be.a('boolean');\n        pm.expect(json.allowRegistration, 'allowRegistration').to.be.a('boolean');\n        pm.expect(json.id, 'id').to.be.a('number').and.above(0);\n        pm.expect(json.name, 'name').to.be.a('string').and.not.empty;\n        pm.expect(json.description == null || typeof json.description === 'string', 'description').to.equal(true);\n        pm.expect(json.publicName == null || typeof json.publicName === 'string', 'publicName').to.equal(true);\n        pm.expect(json.publicDescription == null || typeof json.publicDescription === 'string', 'publicDescription').to.equal(true);\n        if (json.lastEvaluatedAt != null && json.lastEvaluatedAt !== '') {\n            pm.expect(Number.isNaN(Date.parse(json.lastEvaluatedAt)), 'lastEvaluatedAt parseable').to.equal(false);\n        }\n        if (json.createdAt) {\n            pm.expect(Number.isNaN(Date.parse(json.createdAt)), 'createdAt parseable').to.equal(false);\n        }\n        if (json.updatedAt) {\n            pm.expect(Number.isNaN(Date.parse(json.updatedAt)), 'updatedAt parseable').to.equal(false);\n        }\n});\n\npm.test('List id matches the requested id', function () {\n    const json = pm.response.json();\n    const expectedId = Number(pm.environment.get('smooveApiListId'));\n    pm.expect(json.id, 'id').to.eql(expectedId);\n});"]}}],"id":"8a7d4417-33cf-4461-8cba-129b740ee042","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"text"}}},"url":"{{smooveApiBaseURL}}/api/v1/lists/{{smooveApiListId}}","urlObject":{"path":["api","v1","lists","{{smooveApiListId}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8a7d4417-33cf-4461-8cba-129b740ee042"},{"name":"Lists Delete","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nconst headers = { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` };\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\nconst createRes = await pm.sendRequest({\n    url: `${baseUrl}/api/v1/lists`,\n    method: \"POST\",\n    header: headers,\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            isActive: true,\n            contactsCount: 0,\n            isPublic: true,\n            isPortal: false,\n            isDynamic: false,\n            isEvaluationInProgress: false,\n            allowRegistration: true,\n            name: `name_${ts}`,\n            description: `desc_${ts}`,\n            publicName: `pubname_${ts}`,\n            publicDescription: \"string\",\n            groupFilterCondition: \"string\"\n        })\n    }\n});\npm.expect(createRes.code, \"create list status\").to.eql(200);\nconst listId = createRes.json().id;\n\npm.environment.set(\"smooveApiListId\", listId);\npm.environment.set(\"smooveApiCreatedListName\", `name_${ts}`);\npm.environment.set(\"smooveApiCreatedListDescription\", `desc_${ts}`);\npm.environment.set(\"smooveApiCreatedListPublicName\", `pubname_${ts}`);\n\nconst getRes = await pm.sendRequest({ url: `${baseUrl}/api/v1/lists/${listId}`, method: \"GET\", header: headers });\npm.expect(getRes.code, \"created list found before delete\").to.eql(200);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst deletedListId = Number(pm.environment.get('smooveApiListId'));\npm.test('Deleted list id was created before delete', function () {\n    pm.expect(deletedListId).to.be.a('number');\n    pm.expect(deletedListId).to.be.greaterThan(0);\n});\n\nconst baseUrl = pm.environment.get('smooveApiBaseURL');\nconst cookie = pm.environment.get('smooveApiCookie');\nconst getRes = await send({\n    url: baseUrl + '/api/v1/lists/' + deletedListId,\n    method: 'GET',\n    header: { Accept: 'application/json', Cookie: 'jvlpsi=' + cookie + ';' }\n});\n\npm.test('Deleted list is gone on follow-up GET', function () {\n    pm.expect([404, 400]).to.include(getRes.code);\n});"]}}],"id":"cb93e625-11f6-40ae-a134-a04635c01664","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/lists/{{smooveApiListId}}?deleteContacts=false","urlObject":{"path":["api","v1","lists","{{smooveApiListId}}"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"deleteContacts","value":"false"}],"variable":[]}},"response":[],"_postman_id":"cb93e625-11f6-40ae-a134-a04635c01664"},{"name":"Lists Add Or Update","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction uniqueSuffix() {\n    return Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst suffix = uniqueSuffix();\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/lists\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            name: \"postman_list_upd_\" + suffix,\n            description: \"temp list for update test\"\n        })\n    }\n});\nif (!createRes || createRes.code !== 200) {\n    throw new Error(\"Failed to create list before update\");\n}\nconst listId = createRes.json().id;\nif (!listId) throw new Error(\"Create list returned no id\");\npm.environment.set(\"smooveApiListId\", String(listId));\n\npm.request.body.update(JSON.stringify({\n    isActive: true,\n    contactsCount: 0,\n    isPublic: false,\n    isPortal: false,\n    isDynamic: false,\n    isEvaluationInProgress: false,\n    allowRegistration: false,\n    id: Number(listId),\n    name: \"postman_update_\" + suffix,\n    description: \"Updated by Postman test\",\n    publicName: \"postman_update_pub_\" + suffix,\n    publicDescription: \"temp\"\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['isActive', 'contactsCount', 'isPublic', 'isPortal', 'isDynamic', 'isEvaluationInProgress', 'allowRegistration', 'id', 'name'].forEach(function (key) {\n            pm.expect(json, 'missing ' + key).to.have.property(key);\n        });\n        pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n        pm.expect(json.contactsCount, 'contactsCount').to.be.a('number').and.at.least(0);\n        pm.expect(json.isPublic, 'isPublic').to.be.a('boolean');\n        pm.expect(json.isPortal, 'isPortal').to.be.a('boolean');\n        pm.expect(json.isDynamic, 'isDynamic').to.be.a('boolean');\n        pm.expect(json.isEvaluationInProgress, 'isEvaluationInProgress').to.be.a('boolean');\n        pm.expect(json.allowRegistration, 'allowRegistration').to.be.a('boolean');\n        pm.expect(json.id, 'id').to.be.a('number').and.above(0);\n        pm.expect(json.name, 'name').to.be.a('string').and.not.empty;\n        pm.expect(json.description == null || typeof json.description === 'string', 'description').to.equal(true);\n        pm.expect(json.publicName == null || typeof json.publicName === 'string', 'publicName').to.equal(true);\n        pm.expect(json.publicDescription == null || typeof json.publicDescription === 'string', 'publicDescription').to.equal(true);\n        if (json.lastEvaluatedAt != null && json.lastEvaluatedAt !== '') {\n            pm.expect(Number.isNaN(Date.parse(json.lastEvaluatedAt)), 'lastEvaluatedAt parseable').to.equal(false);\n        }\n        if (json.createdAt) {\n            pm.expect(Number.isNaN(Date.parse(json.createdAt)), 'createdAt parseable').to.equal(false);\n        }\n        if (json.updatedAt) {\n            pm.expect(Number.isNaN(Date.parse(json.updatedAt)), 'updatedAt parseable').to.equal(false);\n        }\n});\n\npm.test('Updated list echoes request identity', function () {\n    const json = pm.response.json();\n    const expectedId = Number(pm.environment.get('smooveApiListId'));\n    pm.expect(json.id, 'id').to.eql(expectedId);\n    pm.expect(json.name, 'name').to.match(/^postman_update_/);\n    pm.expect(json.description, 'description').to.eql('Updated by Postman test');\n    pm.expect(json.isActive, 'isActive').to.eql(true);\n    pm.expect(json.isPublic, 'isPublic').to.eql(false);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get('smooveApiBaseURL');\n    const cookie = pm.environment.get('smooveApiCookie');\n    const cleanupId = pm.environment.get('smooveApiListId');\n    if (!cleanupId) {\n        pm.test('Cleanup skipped: could not resolve list id', function () {\n            pm.expect.fail('Missing list id for cleanup');\n        });\n        return;\n    }\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + '/api/v1/lists/' + cleanupId + '?deleteContacts=false',\n        method: 'DELETE',\n        header: {\n            Cookie: 'jvlpsi=' + cookie + ';',\n            Accept: 'application/json'\n        }\n    });\n    pm.test('Cleanup: list deleted successfully', function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n    pm.environment.unset('smooveApiListId');\n}\n\nawait cleanUp();"]}}],"id":"53925752-2660-4019-9cd2-d0f74ed1a6ce","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"isActive\": true,\n  \"contactsCount\": 0,\n  \"isPublic\": false,\n  \"isPortal\": false,\n  \"isDynamic\": false,\n  \"isEvaluationInProgress\": false,\n  \"allowRegistration\": false,\n  \"name\": \"postman_update_placeholder\",\n  \"description\": \"Updated by Postman test\",\n  \"publicName\": \"postman_update_pub_placeholder\",\n  \"publicDescription\": \"temp\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/lists/{{smooveApiListId}}","urlObject":{"path":["api","v1","lists","{{smooveApiListId}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"53925752-2660-4019-9cd2-d0f74ed1a6ce"}],"id":"fb1d50b9-2d19-4be8-8744-330fd7e51b3a","_postman_id":"fb1d50b9-2d19-4be8-8744-330fd7e51b3a","description":""},{"name":"merge","item":[{"name":"Lists Merge","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nconst mergeName = `postman-merged-${Date.now()}`;\npm.environment.set(\"smooveApiMergeName\", mergeName);\n\nconst headers = { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` };\n\nasync function createList(label) {\n    const res = await pm.sendRequest({\n        url: `${baseUrl}/api/v1/lists`,\n        method: \"POST\",\n        header: headers,\n        body: { mode: \"raw\", raw: JSON.stringify({ name: `postman-list-${label}-${Date.now()}` }) }\n    });\n    pm.expect(res.code, \"create list \" + label).to.eql(200);\n    return res.json().id;\n}\n\nconst id1 = await createList(1);\nconst id2 = await createList(2);\n\npm.environment.set(\"smooveApiMergeListId1\", id1);\npm.environment.set(\"smooveApiMergeListId2\", id2);\npm.environment.set(\"smooveApiMergeIds\", `${id1},${id2}`);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['isActive', 'contactsCount', 'isPublic', 'isPortal', 'isDynamic', 'isEvaluationInProgress', 'allowRegistration', 'id'].forEach(function (key) {\n            pm.expect(json, 'missing ' + key).to.have.property(key);\n        });\n        pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n        pm.expect(json.contactsCount, 'contactsCount').to.be.a('number').and.at.least(0);\n        pm.expect(json.isPublic, 'isPublic').to.be.a('boolean');\n        pm.expect(json.isPortal, 'isPortal').to.be.a('boolean');\n        pm.expect(json.isDynamic, 'isDynamic').to.be.a('boolean');\n        pm.expect(json.isEvaluationInProgress, 'isEvaluationInProgress').to.be.a('boolean');\n        pm.expect(json.allowRegistration, 'allowRegistration').to.be.a('boolean');\n        pm.expect(json.id, 'id').to.be.a('number').and.above(0);\n});\n\nconst mergedId = pm.response.json().id;\nconst expectedName = pm.environment.get('smooveApiMergeName');\nconst baseUrl = pm.environment.get('smooveApiBaseURL');\nconst cookie = pm.environment.get('smooveApiCookie');\n\nconst getRes = await send({\n    url: baseUrl + '/api/v1/lists/' + mergedId,\n    method: 'GET',\n    header: { Accept: 'application/json', Cookie: 'jvlpsi=' + cookie + ';' }\n});\n\npm.test('Merged list can be read back with the requested name', function () {\n    pm.expect(getRes.code, 'get merged list status').to.eql(200);\n    const json = getRes.json();\n    pm.expect(json.id, 'id').to.eql(mergedId);\n    pm.expect(json.name, 'name').to.eql(expectedName);\n});\n\nasync function cleanUp() {\n    const ids = [\n        mergedId,\n        pm.environment.get('smooveApiMergeListId1'),\n        pm.environment.get('smooveApiMergeListId2')\n    ].filter(Boolean);\n    for (const id of ids) {\n        await pm.sendRequest({\n            url: baseUrl + '/api/v1/lists/' + id + '?deleteContacts=false',\n            method: 'DELETE',\n            header: { Cookie: 'jvlpsi=' + cookie + ';', Accept: 'application/json' }\n        });\n    }\n}\n\nawait cleanUp();"]}}],"id":"230ed735-8f99-4c7a-8017-ee3e0f162319","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/lists/merge?ids={{smooveApiMergeIds}}&name={{smooveApiMergeName}}&strategy=Union","urlObject":{"path":["api","v1","lists","merge"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"ids","value":"{{smooveApiMergeIds}}"},{"key":"name","value":"{{smooveApiMergeName}}"},{"key":"strategy","value":"Union"}],"variable":[]}},"response":[],"_postman_id":"230ed735-8f99-4c7a-8017-ee3e0f162319"}],"id":"eed942b9-8627-4a87-8982-66465933f594","_postman_id":"eed942b9-8627-4a87-8982-66465933f594","description":""},{"name":"check-usage","item":[{"name":"Lists Check Usage","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array').and.not.empty;\n    const item = json[0];\n    ['listId', 'autoResponders', 'automations'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.listId, 'listId').to.be.a('number').and.above(0);\n    pm.expect(item.autoResponders, 'autoResponders').to.be.an('array');\n    pm.expect(item.automations, 'automations').to.be.an('array');\n    const expectedId = Number(pm.environment.get('smooveApiListId'));\n    if (expectedId > 0) {\n        pm.expect(item.listId, 'listId matches request').to.eql(expectedId);\n    }\n});"]}},{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\nlet listId = pm.environment.get(\"smooveApiListId\");\nif (!listId || String(listId).includes(\"{{\")) {\n    const listRes = await send({\n        url: baseUrl + \"/api/v1/lists?page=1&pageSize=1\",\n        method: \"GET\",\n        header: { \"Cookie\": `jvlpsi=${cookie};`, \"Accept\": \"application/json\" }\n    });\n    let json = null; try { json = listRes && listRes.json(); } catch (e) {}\n    const item = json && (json.results && json.results[0] || (Array.isArray(json) && json[0]) || json);\n    listId = item && (item.id || item.listId);\n    if (listId) pm.environment.set(\"smooveApiListId\", String(listId));\n}\nif (!listId) { throw new Error(\"No list id available for check-usage\"); }"]}}],"id":"32ff55e6-8ac0-40b4-94b9-2f89260837d3","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/lists/check-usage?ids={{smooveApiListId}}","urlObject":{"path":["api","v1","lists","check-usage"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"ids","value":"{{smooveApiListId}}"}],"variable":[]}},"response":[],"_postman_id":"32ff55e6-8ac0-40b4-94b9-2f89260837d3"}],"id":"9f5ed504-da25-4115-9568-2ae4a20774da","_postman_id":"9f5ed504-da25-4115-9568-2ae4a20774da","description":""},{"name":"count","item":[{"name":"Lists Get Total Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const listRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/lists?Page=1&PageSize=1\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative integer count', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isFinite(value)).to.be.true;\n    pm.expect(Number.isInteger(value), 'integer').to.eql(true);\n});\n\npm.test('Count equals the total rows of the lists list', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    pm.expect(pm.response.json(), 'count').to.eql(listRes.json().rows);\n});"]}}],"id":"d4710b75-0eca-4652-acb0-f41edf721ab8","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/lists/count","urlObject":{"path":["api","v1","lists","count"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d4710b75-0eca-4652-acb0-f41edf721ab8"}],"id":"586485e5-cec0-4688-920e-84a02ad8f773","_postman_id":"586485e5-cec0-4688-920e-84a02ad8f773","description":""},{"name":"ValidateUniqueListName","item":[{"name":"Lists Validate Unique List Name","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response schema is boolean', function () {\n    let value;\n    try { value = pm.response.json(); } catch (e) { value = pm.response.text().trim(); }\n    if (typeof value === 'string') {\n        const n = value.toLowerCase();\n        if (n === 'true' || n === '1') value = true;\n        else if (n === 'false' || n === '0') value = false;\n    }\n    pm.expect(value).to.be.a('boolean');\n});\n\nconst baseUrl = pm.environment.get('smooveApiBaseURL');\nconst cookie = pm.environment.get('smooveApiCookie');\nconst headers = { Accept: 'application/json', Cookie: 'jvlpsi=' + cookie + ';' };\n\nconst listRes = await pm.sendRequest({\n    url: baseUrl + '/api/v1/lists?page=1&size=1&sort=asc',\n    method: 'GET',\n    header: headers\n});\nconst list = listRes.json().results[0];\nconst takenRes = await pm.sendRequest({\n    url: baseUrl + '/api/v1/lists/ValidateUniqueListName?pattern=' + encodeURIComponent(list.name) + '&id=0',\n    method: 'GET',\n    header: headers\n});\nconst ownNameRes = await pm.sendRequest({\n    url: baseUrl + '/api/v1/lists/ValidateUniqueListName?pattern=' + encodeURIComponent(list.name) + '&id=' + list.id,\n    method: 'GET',\n    header: headers\n});\n\npm.test('Existing list name is not unique for a new list (id=0)', function () {\n    pm.expect(listRes.code, 'lists status').to.eql(200);\n    pm.expect(list && list.name, 'seed list name').to.be.a('string').and.not.empty;\n    pm.expect(takenRes.code, 'validate status').to.eql(200);\n    pm.expect(takenRes.json(), 'existing name must be non-unique').to.eql(false);\n});\n\npm.test('A list may keep its own name', function () {\n    pm.expect(ownNameRes.code, 'validate status').to.eql(200);\n    pm.expect(ownNameRes.json(), 'same list id may keep its name').to.eql(true);\n});"]}}],"id":"17309151-2e86-458b-ba42-942e27219ddb","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/lists/ValidateUniqueListName?pattern=postman-test&id={{smooveApiListId}}","urlObject":{"path":["api","v1","lists","ValidateUniqueListName"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"pattern","value":"postman-test"},{"key":"id","value":"{{smooveApiListId}}"}],"variable":[]}},"response":[],"_postman_id":"17309151-2e86-458b-ba42-942e27219ddb"}],"id":"0509f5f5-cbf3-46b6-9f7e-e043a2559ba2","_postman_id":"0509f5f5-cbf3-46b6-9f7e-e043a2559ba2","description":""},{"name":"Lists Get Lists","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number').and.at.least(1);\n    pm.expect(json.results, 'results').to.be.an('array').and.not.empty;\n});\n\npm.test('First result has all expected fields and types', function () {\n    const json = pm.response.json().results[0];\n    ['isActive', 'contactsCount', 'isPublic', 'isPortal', 'isDynamic', 'isEvaluationInProgress', 'allowRegistration', 'id', 'name'].forEach(function (key) {\n            pm.expect(json, 'missing ' + key).to.have.property(key);\n        });\n        pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n        pm.expect(json.contactsCount, 'contactsCount').to.be.a('number').and.at.least(0);\n        pm.expect(json.isPublic, 'isPublic').to.be.a('boolean');\n        pm.expect(json.isPortal, 'isPortal').to.be.a('boolean');\n        pm.expect(json.isDynamic, 'isDynamic').to.be.a('boolean');\n        pm.expect(json.isEvaluationInProgress, 'isEvaluationInProgress').to.be.a('boolean');\n        pm.expect(json.allowRegistration, 'allowRegistration').to.be.a('boolean');\n        pm.expect(json.id, 'id').to.be.a('number').and.above(0);\n        pm.expect(json.name, 'name').to.be.a('string').and.not.empty;\n        pm.expect(json.description == null || typeof json.description === 'string', 'description').to.equal(true);\n        pm.expect(json.publicName == null || typeof json.publicName === 'string', 'publicName').to.equal(true);\n        pm.expect(json.publicDescription == null || typeof json.publicDescription === 'string', 'publicDescription').to.equal(true);\n        if (json.lastEvaluatedAt != null && json.lastEvaluatedAt !== '') {\n            pm.expect(Number.isNaN(Date.parse(json.lastEvaluatedAt)), 'lastEvaluatedAt parseable').to.equal(false);\n        }\n        if (json.createdAt) {\n            pm.expect(Number.isNaN(Date.parse(json.createdAt)), 'createdAt parseable').to.equal(false);\n        }\n        if (json.updatedAt) {\n            pm.expect(Number.isNaN(Date.parse(json.updatedAt)), 'updatedAt parseable').to.equal(false);\n        }\n});"]}}],"id":"1604746f-e274-4122-aeb6-bcda180191cb","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/lists?&page=1&size=50&sort=asc","urlObject":{"path":["api","v1","lists"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":null,"value":""},{"key":"page","value":"1"},{"key":"size","value":"50"},{"key":"sort","value":"asc"}],"variable":[]}},"response":[],"_postman_id":"1604746f-e274-4122-aeb6-bcda180191cb"},{"name":"Lists Add","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction uniqueSuffix() {\n    return Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = uniqueSuffix();\npm.request.body.update(JSON.stringify({\n    name: \"Postman test list \" + suffix,\n    description: \"Created by Postman test \" + suffix\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['isActive', 'contactsCount', 'isPublic', 'isPortal', 'isDynamic', 'isEvaluationInProgress', 'allowRegistration', 'id'].forEach(function (key) {\n            pm.expect(json, 'missing ' + key).to.have.property(key);\n        });\n        pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n        pm.expect(json.contactsCount, 'contactsCount').to.be.a('number').and.at.least(0);\n        pm.expect(json.isPublic, 'isPublic').to.be.a('boolean');\n        pm.expect(json.isPortal, 'isPortal').to.be.a('boolean');\n        pm.expect(json.isDynamic, 'isDynamic').to.be.a('boolean');\n        pm.expect(json.isEvaluationInProgress, 'isEvaluationInProgress').to.be.a('boolean');\n        pm.expect(json.allowRegistration, 'allowRegistration').to.be.a('boolean');\n        pm.expect(json.id, 'id').to.be.a('number').and.above(0);\n});\n\npm.test('Created list has a valid id and zero contacts', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.contactsCount, 'contactsCount').to.eql(0);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get('smooveApiBaseURL');\n    const cookie = pm.environment.get('smooveApiCookie');\n    let cleanupId;\n    try {\n        cleanupId = Number(pm.response.json().id);\n    } catch (e) {\n        cleanupId = null;\n    }\n    if (!cleanupId) {\n        pm.test('Cleanup skipped: could not resolve list id', function () {\n            pm.expect.fail('Missing list id for cleanup');\n        });\n        return;\n    }\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + '/api/v1/lists/' + cleanupId + '?deleteContacts=false',\n        method: 'DELETE',\n        header: {\n            Cookie: 'jvlpsi=' + cookie + ';',\n            Accept: 'application/json'\n        }\n    });\n    pm.test('Cleanup: list deleted successfully', function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n    pm.environment.unset('smooveApiListId');\n}\n\nawait cleanUp();"]}}],"id":"5f667bdc-7417-4d11-8066-57cc02b6d052","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Cookie","value":"jvlpsi={{smooveApiCookie}};"},{"key":"Accept","value":"application/json"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"Postman test list placeholder\",\n  \"description\": \"Created by Postman test\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/lists","urlObject":{"path":["api","v1","lists"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"5f667bdc-7417-4d11-8066-57cc02b6d052"}],"id":"83b17eb1-13c1-4509-99f5-6a6523dc57d5","_postman_id":"83b17eb1-13c1-4509-99f5-6a6523dc57d5","description":""},{"name":"notifications","item":[{"name":"administratorId","item":[{"name":"Notifications Get Notifications By Administrator Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array of notification objects', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    json.forEach(function (item, index) {\n        const label = 'notifications[' + index + ']';\n        pm.expect(item, label).to.be.an('object');\n        ['id', 'administratorId', 'siteId', 'importance', 'markedAsRead', 'seenAt', 'sentAt', 'body', 'type'].forEach(function (key) {\n            pm.expect(item, label + ' missing ' + key).to.have.property(key);\n        });\n        pm.expect(item.id, label + '.id').to.be.a('number');\n        pm.expect(item.administratorId, label + '.administratorId').to.be.a('number');\n        pm.expect(item.siteId, label + '.siteId').to.be.a('number');\n        pm.expect(item.importance, label + '.importance').to.be.a('string');\n        pm.expect(item.markedAsRead, label + '.markedAsRead').to.be.a('boolean');\n        pm.expect(item.seenAt, label + '.seenAt').to.be.a('string');\n        pm.expect(item.sentAt, label + '.sentAt').to.be.a('string');\n        pm.expect(item.body, label + '.body').to.be.a('string');\n        pm.expect(item.type, label + '.type').to.be.a('string');\n    });\n});\n\npm.test('Notification items have real identity values when present', function () {\n    const json = pm.response.json();\n    if (!json.length) {\n        return;\n    }\n    const item = json[0];\n    pm.expect(item.id, 'id').to.be.above(0);\n    pm.expect(item.siteId, 'siteId').to.be.above(0);\n    pm.expect(item.body, 'body').to.not.equal('');\n    pm.expect(item.type, 'type').to.not.equal('');\n    pm.expect(item.importance, 'importance').to.not.equal('');\n    pm.expect(Number.isNaN(Date.parse(item.sentAt)), 'sentAt parseable').to.eql(false);\n    const ids = json.map(function (n) { return n.id; });\n    pm.expect(new Set(ids).size, 'unique notification ids').to.eql(ids.length);\n});"]}}],"id":"655d8521-feb4-43e9-a423-1fc736ab10df","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/notifications/administratorId","urlObject":{"path":["api","v1","notifications","administratorId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"655d8521-feb4-43e9-a423-1fc736ab10df"}],"id":"3a67d93f-51ee-45ba-9142-b112df3ec541","_postman_id":"3a67d93f-51ee-45ba-9142-b112df3ec541","description":""},{"name":"siteId","item":[{"name":"Notifications Get Notifications By Site Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedSiteId = Number(pm.environment.get(\"smooveApiSiteId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is a non-empty array of notification objects', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'notifications length').to.be.at.least(1);\n    json.forEach(function (item, index) {\n        const label = 'notifications[' + index + ']';\n        pm.expect(item, label).to.be.an('object');\n        ['id', 'administratorId', 'siteId', 'importance', 'markedAsRead', 'seenAt', 'sentAt', 'body', 'type'].forEach(function (key) {\n            pm.expect(item, label + ' missing ' + key).to.have.property(key);\n        });\n        pm.expect(item.id, label + '.id').to.be.a('number');\n        pm.expect(item.administratorId, label + '.administratorId').to.be.a('number');\n        pm.expect(item.siteId, label + '.siteId').to.be.a('number');\n        pm.expect(item.importance, label + '.importance').to.be.a('string');\n        pm.expect(item.markedAsRead, label + '.markedAsRead').to.be.a('boolean');\n        pm.expect(item.seenAt, label + '.seenAt').to.be.a('string');\n        pm.expect(item.sentAt, label + '.sentAt').to.be.a('string');\n        pm.expect(item.body, label + '.body').to.be.a('string');\n        pm.expect(item.type, label + '.type').to.be.a('string');\n    });\n});\n\npm.test('Notifications belong to the authenticated site with real values', function () {\n    const json = pm.response.json();\n    const item = json[0];\n    pm.expect(item.id, 'id').to.be.above(0);\n    pm.expect(item.siteId, 'siteId').to.eql(expectedSiteId);\n    pm.expect(item.body, 'body').to.not.equal('');\n    pm.expect(item.type, 'type').to.not.equal('');\n    pm.expect(item.importance, 'importance').to.not.equal('');\n    pm.expect(Number.isNaN(Date.parse(item.sentAt)), 'sentAt parseable').to.eql(false);\n    json.forEach(function (n, index) {\n        pm.expect(n.siteId, 'notifications[' + index + '].siteId').to.eql(expectedSiteId);\n    });\n    const ids = json.map(function (n) { return n.id; });\n    pm.expect(new Set(ids).size, 'unique notification ids').to.eql(ids.length);\n});"]}}],"id":"7aa4703d-8e4c-40fb-8f79-34b02a993671","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/notifications/siteId","urlObject":{"path":["api","v1","notifications","siteId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7aa4703d-8e4c-40fb-8f79-34b02a993671"}],"id":"24749c08-db80-4a4c-b5fe-d2a8c707d12b","_postman_id":"24749c08-db80-4a4c-b5fe-d2a8c707d12b","description":""},{"name":"{id}","item":[{"name":"markAsRead","item":[{"name":"Notifications Mark As Read","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/notifications/siteId\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\npm.expect(listRes.code, \"seed notifications list\").to.eql(200);\nconst list = listRes.json();\npm.expect(list, \"notifications\").to.be.an(\"array\");\npm.expect(list.length, \"notifications length\").to.be.at.least(1);\nconst target = list[0];\npm.expect(target.id, \"notification id\").to.be.above(0);\n// Endpoint toggles markedAsRead (true->false and false->true).\npm.environment.set(\"smooveApiNotificationId\", String(target.id));\npm.environment.set(\"smooveApiNotificationWasRead\", String(Boolean(target.markedAsRead)));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst notificationId = Number(pm.environment.get(\"smooveApiNotificationId\"));\nconst wasRead = pm.environment.get(\"smooveApiNotificationWasRead\") === \"true\";\nconst expectedRead = !wasRead;\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/notifications/siteId\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\n\npm.test('Follow-up GET shows markedAsRead toggled by the write', function () {\n    pm.expect(notificationId, 'notification id').to.be.above(0);\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    const list = listRes.json();\n    pm.expect(list, 'notifications').to.be.an('array');\n    const item = list.find(function (n) { return Number(n.id) === notificationId; });\n    pm.expect(item, 'notification still listed').to.be.an('object');\n    pm.expect(item.markedAsRead, 'markedAsRead toggled').to.eql(expectedRead);\n    pm.expect(item.seenAt, 'seenAt').to.be.a('string').and.not.equal('');\n    pm.expect(Number.isNaN(Date.parse(item.seenAt)), 'seenAt parseable').to.eql(false);\n});\n\n// Restore read state so later markAllAsRead / list tests stay stable.\nif (expectedRead === false) {\n    await send({\n        url: baseUrl + \"/api/v1/notifications/\" + notificationId + \"/markAsRead\",\n        method: \"PUT\",\n        header: { Cookie: \"jvlpsi=\" + cookie + \";\" }\n    });\n}\n\npm.environment.unset(\"smooveApiNotificationId\");\npm.environment.unset(\"smooveApiNotificationWasRead\");"]}}],"id":"80efa403-621f-4b9d-9c4f-9ac09a81c7a8","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[],"url":"{{smooveApiBaseURL}}/api/v1/notifications/{{smooveApiNotificationId}}/markAsRead","urlObject":{"path":["api","v1","notifications","{{smooveApiNotificationId}}","markAsRead"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiNotificationId}}","key":"id"}]}},"response":[],"_postman_id":"80efa403-621f-4b9d-9c4f-9ac09a81c7a8"}],"id":"8334aa1b-7215-4b23-9673-8cf3190359f8","_postman_id":"8334aa1b-7215-4b23-9673-8cf3190359f8","description":""}],"id":"3e276ecd-7c9f-4a76-8b7a-bb76d79b33af","_postman_id":"3e276ecd-7c9f-4a76-8b7a-bb76d79b33af","description":""},{"name":"markAllAsRead","item":[{"name":"Notifications Mark All As Read","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/notifications/siteId\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\n\npm.test('Follow-up GET shows all site notifications marked as read', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    const list = listRes.json();\n    pm.expect(list, 'notifications').to.be.an('array');\n    pm.expect(list.length, 'notifications length').to.be.at.least(1);\n    list.forEach(function (item, index) {\n        pm.expect(item.markedAsRead, 'notifications[' + index + '].markedAsRead').to.eql(true);\n    });\n});"]}}],"id":"4a67b06d-e404-4644-b97a-7984ef681b4a","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[],"url":"{{smooveApiBaseURL}}/api/v1/notifications/markAllAsRead","urlObject":{"path":["api","v1","notifications","markAllAsRead"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"4a67b06d-e404-4644-b97a-7984ef681b4a"}],"id":"8a0f788e-d4c8-4c8f-90e8-f80a7f4d111c","_postman_id":"8a0f788e-d4c8-4c8f-90e8-f80a7f4d111c","description":""}],"id":"400b0a2b-fc5a-4784-977f-542e99b31b3f","_postman_id":"400b0a2b-fc5a-4784-977f-542e99b31b3f","description":""},{"name":"omnichannelMessages","item":[{"name":"search","item":[{"name":"Omnichannel Messages Search","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination echoes request page and pageSize with saved messages', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.rows, 'rows').to.be.above(0);\n    pm.expect(json.results.length, 'results length').to.be.above(0);\n    pm.expect(json.results.length, 'results length vs size').to.be.at.most(json.size);\n    pm.expect(json.pages, 'pages').to.be.at.least(1);\n});\n\npm.test('First result has required message fields and types', function () {\n    const item = pm.response.json().results[0];\n    ['id', 'siteId', 'administratorId', 'campaignName', 'content', 'templateReferenceId', 'templateParameters', 'type', 'state', 'hasStarted', 'hasTrackLinks', 'from', 'apiKey', 'isBpmn', 'isScheduled', 'addUnsubscribeLink', 'recipients', 'totalSent', 'totalFailed', 'hasAnyResponse'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.siteId, 'siteId').to.be.a('number').and.above(0);\n    pm.expect(item.administratorId, 'administratorId').to.be.a('number');\n    pm.expect(item.campaignName, 'campaignName').to.be.a('string');\n    pm.expect(item.content, 'content').to.be.a('string');\n    pm.expect(item.templateReferenceId, 'templateReferenceId').to.be.a('number');\n    pm.expect(item.templateParameters, 'templateParameters').to.be.a('string');\n    pm.expect(item.type, 'type').to.be.a('string').and.not.equal('');\n    pm.expect(item.state, 'state').to.eql('saved');\n    pm.expect(item.hasStarted, 'hasStarted').to.be.a('boolean');\n    pm.expect(item.hasTrackLinks, 'hasTrackLinks').to.be.a('boolean');\n    pm.expect(item.from, 'from').to.be.a('string');\n    pm.expect(item.apiKey, 'apiKey').to.be.a('string');\n    pm.expect(item.isBpmn, 'isBpmn').to.be.a('boolean');\n    pm.expect(item.isScheduled, 'isScheduled').to.be.a('boolean');\n    pm.expect(item.addUnsubscribeLink, 'addUnsubscribeLink').to.be.a('boolean');\n    pm.expect(item.recipients, 'recipients').to.be.an('array');\n    pm.expect(item.totalSent, 'totalSent').to.be.a('number').and.at.least(0);\n    pm.expect(item.totalFailed, 'totalFailed').to.be.a('number').and.at.least(0);\n    pm.expect(item.hasAnyResponse, 'hasAnyResponse').to.be.a('boolean');\n});"]}}],"id":"cb2b4ddb-f36b-429c-aaeb-ef75244eb218","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/search?messageState=2&page=1&pageSize=50","urlObject":{"path":["api","v1","omnichannelMessages","search"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"messageState","value":"2"},{"key":"page","value":"1"},{"key":"pageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"cb2b4ddb-f36b-429c-aaeb-ef75244eb218"}],"id":"4d6f6796-57ee-494a-a97e-7add86b750c8","_postman_id":"4d6f6796-57ee-494a-a97e-7add86b750c8","description":""},{"name":"whatsapp-approved","item":[{"name":"Omnichannel Messages Is Whats App Approved","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Whats App approval matches the expectation for this environment', function () {\n    pm.expect(pm.response.json(), 'whatsapp-approved').to.eql(pm.environment.get('smooveApiExpectedWhatsAppApproved') === 'true');\n});"]}}],"id":"01505e96-24f5-4148-bc99-f93c602798f3","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/whatsapp-approved","urlObject":{"path":["api","v1","omnichannelMessages","whatsapp-approved"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"01505e96-24f5-4148-bc99-f93c602798f3"}],"id":"25657b25-f048-4313-9b83-608b1021e8e6","_postman_id":"25657b25-f048-4313-9b83-608b1021e8e6","description":""},{"name":"count","item":[{"name":"Omnichannel Messages Get Total Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/omnichannelMessages/search?messageState=2&page=1&pageSize=1\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: `jvlpsi=${cookie};`\n    }\n});\npm.expect(listRes.code, \"seed search status\").to.eql(200);\nconst rows = listRes.json().rows;\npm.expect(rows, \"seed search rows\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiOmnichannelExpectedMessageCount\", String(rows));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const listRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/omnichannelMessages/search?messageState=2&Page=1&PageSize=1\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\n\nconst expected = Number(pm.environment.get(\"smooveApiOmnichannelExpectedMessageCount\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Count matches saved-message search rows', function () {\n    const value = pm.response.json();\n    pm.expect(value, 'count').to.be.a('number');\n    pm.expect(Number.isFinite(value), 'finite count').to.eql(true);\n    pm.expect(value, 'count').to.eql(expected);\n    pm.expect(value, 'count').to.be.above(0);\n});\n\npm.environment.unset(\"smooveApiOmnichannelExpectedMessageCount\");\n\npm.test('Count equals the total rows of the omnichannel messages list', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    pm.expect(pm.response.json(), 'count').to.eql(listRes.json().rows);\n});"]}}],"id":"20a505ba-1b87-47a4-ae6b-d6b6ca98bce2","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/count?messageState=2","urlObject":{"path":["api","v1","omnichannelMessages","count"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"messageState","value":"2"}],"variable":[]}},"response":[],"_postman_id":"20a505ba-1b87-47a4-ae6b-d6b6ca98bce2"}],"id":"0a388b6d-90e2-439c-9e3e-e2185eacf1d1","_postman_id":"0a388b6d-90e2-439c-9e3e-e2185eacf1d1","description":""},{"name":"templates","item":[{"name":"{templateId}","item":[{"name":"submit","item":[],"id":"452a4dac-15bd-4bcc-8a80-615013d5e70e","_postman_id":"452a4dac-15bd-4bcc-8a80-615013d5e70e","description":""}],"id":"53a0a19c-f3de-4527-a2c4-eb4d323f4083","_postman_id":"53a0a19c-f3de-4527-a2c4-eb4d323f4083","description":""},{"name":"sample-media","item":[{"name":"{fingerprint}","item":[{"name":"Omnichannel Messages Delete Template Sample Media","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\n// pm.sendRequest rejects file formdata (\"Invalid input for model\") in the CLI sandbox,\n// so upload a tiny embedded PNG as a raw multipart body instead.\nconst pngBase64 = \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==\";\nconst boundary = \"----PostmanOmniSampleMedia\" + Date.now();\nfunction b64ToBinaryString(b64) {\n    if (typeof Buffer !== \"undefined\") {\n        return Buffer.from(b64, \"base64\").toString(\"binary\");\n    }\n    const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n    let str = \"\";\n    let i = 0;\n    b64 = b64.replace(/[^A-Za-z0-9+/=]/g, \"\");\n    while (i < b64.length) {\n        const enc1 = chars.indexOf(b64.charAt(i++));\n        const enc2 = chars.indexOf(b64.charAt(i++));\n        const enc3 = chars.indexOf(b64.charAt(i++));\n        const enc4 = chars.indexOf(b64.charAt(i++));\n        const chr1 = (enc1 << 2) | (enc2 >> 4);\n        const chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n        const chr3 = ((enc3 & 3) << 6) | enc4;\n        str += String.fromCharCode(chr1);\n        if (enc3 !== 64) str += String.fromCharCode(chr2);\n        if (enc4 !== 64) str += String.fromCharCode(chr3);\n    }\n    return str;\n}\nconst fileBinary = b64ToBinaryString(pngBase64);\nconst multipart =\n    \"--\" + boundary + \"\\r\\n\" +\n    \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"tiny.png\\\"\\r\\n\" +\n    \"Content-Type: image/png\\r\\n\\r\\n\" +\n    fileBinary +\n    \"\\r\\n--\" + boundary + \"\\r\\n\" +\n    \"Content-Disposition: form-data; name=\\\"mediaType\\\"\\r\\n\\r\\n\" +\n    \"IMAGE\" +\n    \"\\r\\n--\" + boundary + \"--\\r\\n\";\n\nconst uploadRes = await send({\n    url: baseUrl + \"/api/v1/omnichannelMessages/templates/sample-media\",\n    method: \"POST\",\n    header: {\n        Cookie: `jvlpsi=${cookie};`,\n        \"Content-Type\": \"multipart/form-data; boundary=\" + boundary\n    },\n    body: {\n        mode: \"raw\",\n        raw: multipart\n    }\n});\npm.expect(uploadRes.code, \"seed upload status\").to.eql(200);\nconst uploaded = uploadRes.json();\npm.expect(uploaded && uploaded.fingerprint, \"seed fingerprint\").to.be.a(\"string\").and.have.lengthOf.at.least(8);\npm.environment.set(\"smooveApiOmnichannelSampleMediaFingerprint\", uploaded.fingerprint);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const fingerprint = pm.environment.get(\"smooveApiOmnichannelSampleMediaFingerprint\");\n\npm.test('Status code is 204', function () {\n    pm.response.to.have.status(204);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\npm.test('Delete targeted the seeded fingerprint', function () {\n    pm.expect(fingerprint, 'seeded fingerprint').to.be.a('string').and.have.lengthOf.at.least(8);\n});\n\npm.environment.unset(\"smooveApiOmnichannelSampleMediaFingerprint\");"]}}],"id":"dc8a5684-a9e2-4a79-9744-f7be3e86d880","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/templates/sample-media/:fingerprint","urlObject":{"path":["api","v1","omnichannelMessages","templates","sample-media",":fingerprint"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiOmnichannelSampleMediaFingerprint}}","key":"fingerprint"}]}},"response":[],"_postman_id":"dc8a5684-a9e2-4a79-9744-f7be3e86d880"}],"id":"0ec25131-6971-4547-9a13-45dd4706e1c3","_postman_id":"0ec25131-6971-4547-9a13-45dd4706e1c3","description":""},{"name":"Omnichannel Messages Upload Template Sample Media","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['fingerprint', 'fileName'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.fingerprint, 'fingerprint').to.be.a('string');\n    pm.expect(json.fileName, 'fileName').to.be.a('string');\n});\n\npm.test('Upload returns a fingerprint and the uploaded file name', function () {\n    const json = pm.response.json();\n    pm.expect(json.fingerprint, 'fingerprint').to.have.lengthOf.at.least(8);\n    pm.expect(json.fileName, 'fileName').to.eql('tiny.png');\n});\n\nconst fingerprint = pm.response.json() && pm.response.json().fingerprint;\nif (fingerprint) {\n    const deleteRes = await send({\n        url: baseUrl + \"/api/v1/omnichannelMessages/templates/sample-media/\" + encodeURIComponent(fingerprint),\n        method: \"DELETE\",\n        header: {\n            Accept: \"application/json\",\n            Cookie: `jvlpsi=${cookie};`\n        }\n    });\n    pm.test('Cleanup deletes the uploaded sample media', function () {\n        pm.expect([200, 204]).to.include(deleteRes.code);\n    });\n}"]}}],"id":"f40139f3-96a9-4678-8ee4-ab03c95d4fb6","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"text/plain"}],"body":{"mode":"formdata","formdata":[{"type":"file","key":"file","src":"postman/fixtures/tiny.png"},{"type":"text","key":"mediaType","value":"IMAGE"}]},"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/templates/sample-media","urlObject":{"path":["api","v1","omnichannelMessages","templates","sample-media"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f40139f3-96a9-4678-8ee4-ab03c95d4fb6"}],"id":"cae7a76e-cbd9-4bfe-8bdd-f91ec27e9d24","_postman_id":"cae7a76e-cbd9-4bfe-8bdd-f91ec27e9d24","description":""},{"name":"media-status-callback","item":[{"name":"Omnichannel Messages Handle Template Media Status Callback","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});"]}}],"id":"945a8474-6195-42a4-85fa-ba93cc208470","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"mediaReferenceId\": 1,\n  \"statusId\": 1,\n  \"statusDesc\": \"completed\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/templates/media-status-callback","urlObject":{"path":["api","v1","omnichannelMessages","templates","media-status-callback"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"945a8474-6195-42a4-85fa-ba93cc208470"}],"id":"d046f66f-32de-4f6e-a3e8-a8185a10cba8","_postman_id":"d046f66f-32de-4f6e-a3e8-a8185a10cba8","description":""},{"name":"Omnichannel Messages Create Template","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst suffix = String(Date.now()) + Math.random().toString(36).slice(2, 6);\nconst payload = {\n    body: \"Hello {{1}}, welcome! postman-\" + suffix,\n    header: \"Welcome\",\n    footer: \"Smoove\",\n    buttons: \"[]\",\n    headerType: \"TEXT\",\n    headerMediaType: \"\",\n    sampleMediaFingerprint: \"\",\n    sampleMediaFileName: \"\",\n    category: 1,\n    language: \"en\"\n};\npm.environment.set(\"smooveApiOmnichannelTemplateBody\", payload.body);\npm.request.body.update(JSON.stringify(payload));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst expectedBody = pm.environment.get(\"smooveApiOmnichannelTemplateBody\");\nconst expectedSiteId = Number(pm.environment.get(\"smooveApiSiteId\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 201', function () {\n    pm.response.to.have.status(201);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'siteId', 'body', 'header', 'footer', 'buttons', 'name', 'category', 'status', 'statusDesc', 'isDeleted', 'createdAt', 'language', 'messageType'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.siteId, 'siteId').to.be.a('number');\n    pm.expect(json.body, 'body').to.be.a('string');\n    pm.expect(json.header, 'header').to.be.a('string');\n    pm.expect(json.footer, 'footer').to.be.a('string');\n    pm.expect(json.buttons, 'buttons').to.be.a('string');\n    pm.expect(json.name, 'name').to.be.a('string');\n    pm.expect(json.category, 'category').to.be.a('string');\n    pm.expect(json.status, 'status').to.be.a('string');\n    pm.expect(json.statusDesc, 'statusDesc').to.be.a('string');\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.createdAt, 'createdAt').to.be.a('string');\n    pm.expect(json.language, 'language').to.be.a('string');\n    pm.expect(json.messageType, 'messageType').to.be.a('number');\n});\n\npm.test('Created template echoes the request values', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.siteId, 'siteId').to.eql(expectedSiteId);\n    pm.expect(json.body, 'body').to.eql(expectedBody);\n    pm.expect(json.header, 'header').to.eql('Welcome');\n    pm.expect(json.footer, 'footer').to.eql('Smoove');\n    pm.expect(json.buttons, 'buttons').to.eql('[]');\n    pm.expect(json.category, 'category').to.eql('marketing');\n    pm.expect(json.status, 'status').to.eql('saved');\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n    pm.expect(json.language, 'language').to.eql('en');\n    pm.expect(json.name, 'name').to.be.a('string').and.not.equal('');\n    pm.expect(Number.isNaN(Date.parse(json.createdAt)), 'createdAt parseable').to.eql(false);\n});\n\nconst createdId = pm.response.json() && pm.response.json().id;\nif (createdId) {\n    const deleteRes = await send({\n        url: baseUrl + \"/api/v1/omnichannelMessages/template\",\n        method: \"DELETE\",\n        header: {\n            \"Content-Type\": \"application/json\",\n            Accept: \"application/json\",\n            Cookie: `jvlpsi=${cookie};`\n        },\n        body: { mode: \"raw\", raw: JSON.stringify([{ id: Number(createdId) }]) }\n    });\n    pm.test('Cleanup deletes the created template', function () {\n        pm.expect([200, 204]).to.include(deleteRes.code);\n    });\n}\n\npm.environment.unset(\"smooveApiOmnichannelTemplateBody\");"]}}],"id":"3771f167-fe84-459c-8cdc-c7c83b9fd24e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"body\": \"Hello {{1}}, welcome!\",\n  \"header\": \"Welcome\",\n  \"footer\": \"Smoove\",\n  \"buttons\": \"[]\",\n  \"headerType\": \"TEXT\",\n  \"headerMediaType\": \"\",\n  \"sampleMediaFingerprint\": \"\",\n  \"sampleMediaFileName\": \"\",\n  \"category\": 1,\n  \"language\": \"en\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/templates","urlObject":{"path":["api","v1","omnichannelMessages","templates"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3771f167-fe84-459c-8cdc-c7c83b9fd24e"}],"id":"622d72ed-c53b-40d9-bf53-2e3e5c99c77b","_postman_id":"622d72ed-c53b-40d9-bf53-2e3e5c99c77b","description":""},{"name":"restore","item":[],"id":"c7a46475-33b8-4567-9f49-fdd7d9b997f0","_postman_id":"c7a46475-33b8-4567-9f49-fdd7d9b997f0","description":""},{"name":"statistics","item":[{"name":"{messageId}","item":[{"name":"Omnichannel Messages Get Message Statistics","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/omnichannelMessages/search?messageState=2&page=1&pageSize=1\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: `jvlpsi=${cookie};`\n    }\n});\npm.expect(listRes.code, \"seed search status\").to.eql(200);\nconst item = listRes.json().results && listRes.json().results[0];\npm.expect(item && item.id, \"seed message id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiOmnichannelStatsMessageId\", String(item.id));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedMessageId = Number(pm.environment.get(\"smooveApiOmnichannelStatsMessageId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['messageId', 'sent', 'received', 'read', 'failed', 'unknown'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.messageId, 'messageId').to.be.a('number');\n    pm.expect(json.sent, 'sent').to.be.a('number');\n    pm.expect(json.received, 'received').to.be.a('number');\n    pm.expect(json.read, 'read').to.be.a('number');\n    pm.expect(json.failed, 'failed').to.be.a('number');\n    pm.expect(json.unknown, 'unknown').to.be.a('number');\n});\n\npm.test('Statistics belong to the seeded message with non-negative counters', function () {\n    const json = pm.response.json();\n    pm.expect(json.messageId, 'messageId').to.eql(expectedMessageId);\n    pm.expect(json.sent, 'sent').to.be.at.least(0);\n    pm.expect(json.received, 'received').to.be.at.least(0);\n    pm.expect(json.read, 'read').to.be.at.least(0);\n    pm.expect(json.failed, 'failed').to.be.at.least(0);\n    pm.expect(json.unknown, 'unknown').to.be.at.least(0);\n});\n\npm.environment.unset(\"smooveApiOmnichannelStatsMessageId\");"]}}],"id":"cbd0c279-f5e3-48ef-9ea9-ba552ac41753","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/statistics/:messageId","urlObject":{"path":["api","v1","omnichannelMessages","statistics",":messageId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiOmnichannelStatsMessageId}}","key":"messageId"}]}},"response":[],"_postman_id":"cbd0c279-f5e3-48ef-9ea9-ba552ac41753"}],"id":"13076d12-62f7-462e-9492-3b89d39592ac","_postman_id":"13076d12-62f7-462e-9492-3b89d39592ac","description":""}],"id":"12e377dd-5ece-4e72-b4ee-d9e3460e9a0c","_postman_id":"12e377dd-5ece-4e72-b4ee-d9e3460e9a0c","description":""},{"name":"message-responses","item":[{"name":"Omnichannel Messages Get Message Responses","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/omnichannelMessages/search?messageState=2&page=1&pageSize=1\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: `jvlpsi=${cookie};`\n    }\n});\npm.expect(listRes.code, \"seed search status\").to.eql(200);\nconst item = listRes.json().results && listRes.json().results[0];\npm.expect(item && item.id, \"seed message id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiOmnichannelMessageId\", String(item.id));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedMessageId = Number(pm.environment.get(\"smooveApiOmnichannelMessageId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination echoes request page and pageSize for seeded message', function () {\n    const json = pm.response.json();\n    pm.expect(expectedMessageId, 'seeded messageId').to.be.above(0);\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.rows, 'rows').to.be.at.least(0);\n    pm.expect(json.results.length, 'results length vs size').to.be.at.most(json.size);\n});\n\npm.test('First response has required fields when present', function () {\n    const json = pm.response.json();\n    if (!json.results.length) {\n        return;\n    }\n    const item = json.results[0];\n    ['id', 'messageId', 'contactId', 'contactFirstName', 'contactLastName', 'cellPhone', 'receivedAt', 'content', 'contentType'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.messageId, 'messageId').to.eql(expectedMessageId);\n    pm.expect(item.contactId, 'contactId').to.be.a('number');\n    pm.expect(item.contactFirstName, 'contactFirstName').to.be.a('string');\n    pm.expect(item.contactLastName, 'contactLastName').to.be.a('string');\n    pm.expect(item.cellPhone, 'cellPhone').to.be.a('string');\n    pm.expect(item.receivedAt, 'receivedAt').to.be.a('string');\n    pm.expect(item.content, 'content').to.be.a('string');\n    pm.expect(item.contentType, 'contentType').to.be.a('string');\n});\n\npm.environment.unset(\"smooveApiOmnichannelMessageId\");"]}}],"id":"970c35e2-806e-4c82-8e54-7d5c1cd500f0","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/message-responses?messageId={{smooveApiOmnichannelMessageId}}&page=1&pageSize=50","urlObject":{"path":["api","v1","omnichannelMessages","message-responses"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"messageId","value":"{{smooveApiOmnichannelMessageId}}"},{"key":"page","value":"1"},{"key":"pageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"970c35e2-806e-4c82-8e54-7d5c1cd500f0"}],"id":"152d3f2d-50c5-445c-8b63-7878854adc05","_postman_id":"152d3f2d-50c5-445c-8b63-7878854adc05","description":""},{"name":"search-templates","item":[{"name":"Omnichannel Messages Search Templates","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination echoes request page and pageSize with templates present', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(50);\n    pm.expect(json.rows, 'rows').to.be.above(0);\n    pm.expect(json.results.length, 'results length').to.be.above(0);\n    pm.expect(json.results.length, 'results length vs size').to.be.at.most(json.size);\n    pm.expect(json.pages, 'pages').to.be.a('number').and.at.least(0);\n});\n\npm.test('First result has required template fields and types', function () {\n    const item = pm.response.json().results[0];\n    ['id', 'siteId', 'body', 'name', 'category', 'status', 'statusDesc', 'isDeleted', 'createdAt', 'messageType'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.siteId, 'siteId').to.be.a('number');\n    pm.expect(item.body, 'body').to.be.a('string').and.not.equal('');\n    pm.expect(item.name, 'name').to.be.a('string').and.not.equal('');\n    pm.expect(item.category, 'category').to.be.a('string').and.not.equal('');\n    pm.expect(item.status, 'status').to.be.a('string').and.not.equal('');\n    pm.expect(item.statusDesc, 'statusDesc').to.be.a('string');\n    pm.expect(item.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(item.createdAt, 'createdAt').to.be.a('string').and.not.equal('');\n    pm.expect(Number.isNaN(Date.parse(item.createdAt)), 'createdAt parseable').to.eql(false);\n    pm.expect(item.messageType, 'messageType').to.be.a('number');\n});"]}}],"id":"86310048-7838-4e1c-bea8-442591b2db3b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/search-templates?page=1&pageSize=50&includeMediaTemplates=true","urlObject":{"path":["api","v1","omnichannelMessages","search-templates"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"50"},{"key":"includeMediaTemplates","value":"true"}],"variable":[]}},"response":[],"_postman_id":"86310048-7838-4e1c-bea8-442591b2db3b"}],"id":"836795b7-36ea-4104-b693-9c9c24ff24b3","_postman_id":"836795b7-36ea-4104-b693-9c9c24ff24b3","description":""},{"name":"template","item":[{"name":"Omnichannel Messages Bulk Delete Templates","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction headers(extra) {\n    return Object.assign({\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    }, extra || {});\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst marker = \"postman-del-\" + ts;\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/omnichannelMessages/templates\",\n    method: \"POST\",\n    header: headers(),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            body: \"Hello {{1}}, \" + marker,\n            header: \"Welcome\",\n            footer: \"Smoove\",\n            buttons: \"[]\",\n            headerType: \"TEXT\",\n            headerMediaType: \"\",\n            sampleMediaFingerprint: \"\",\n            sampleMediaFileName: \"\",\n            category: 1,\n            language: \"en\"\n        })\n    }\n});\npm.expect(createRes.code, \"create template status\").to.be.oneOf([200, 201]);\nconst created = createRes.json();\nconst id = created && created.id;\npm.expect(id, \"created template id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiOmnichannelTemplateIdToDelete\", String(id));\npm.environment.set(\"smooveApiOmnichannelTemplateDeleteMarker\", marker);\npm.request.body.update(JSON.stringify([{ id: Number(id) }]));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst deletedId = Number(pm.environment.get(\"smooveApiOmnichannelTemplateIdToDelete\"));\nconst marker = pm.environment.get(\"smooveApiOmnichannelTemplateDeleteMarker\") || \"\";\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response reports the template was deleted', function () {\n    pm.expect(pm.response.json(), 'delete result').to.eql(true);\n});\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/omnichannelMessages/search-templates?pattern=\" + encodeURIComponent(marker) + \"&page=1&pageSize=50&includeMediaTemplates=true\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: `jvlpsi=${cookie};`\n    }\n});\n\npm.test('Deleted template is gone from search-templates', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    const results = listRes.json().results || [];\n    const stillThere = results.some(function (t) { return Number(t.id) === deletedId; });\n    pm.expect(stillThere, 'template still listed after delete').to.eql(false);\n});\n\npm.environment.unset(\"smooveApiOmnichannelTemplateIdToDelete\");\npm.environment.unset(\"smooveApiOmnichannelTemplateDeleteMarker\");"]}}],"id":"d98fc261-68f7-4e74-a763-de0c5dfee31e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"[]","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/template","urlObject":{"path":["api","v1","omnichannelMessages","template"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d98fc261-68f7-4e74-a763-de0c5dfee31e"}],"id":"b1e65612-1909-44ad-8aa0-4fdac5db36de","_postman_id":"b1e65612-1909-44ad-8aa0-4fdac5db36de","description":""},{"name":"count-templates","item":[{"name":"Omnichannel Messages Count Templates","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/omnichannelMessages/search-templates?page=1&pageSize=1&includeMediaTemplates=true\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: `jvlpsi=${cookie};`\n    }\n});\npm.expect(listRes.code, \"seed search-templates status\").to.eql(200);\nconst rows = listRes.json().rows;\npm.expect(rows, \"seed search-templates rows\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiOmnichannelExpectedTemplateCount\", String(rows));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expected = Number(pm.environment.get(\"smooveApiOmnichannelExpectedTemplateCount\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Count matches search-templates rows', function () {\n    const value = pm.response.json();\n    pm.expect(value, 'count').to.be.a('number');\n    pm.expect(Number.isFinite(value), 'finite count').to.eql(true);\n    pm.expect(value, 'count').to.eql(expected);\n    pm.expect(value, 'count').to.be.above(0);\n});\n\npm.environment.unset(\"smooveApiOmnichannelExpectedTemplateCount\");"]}}],"id":"c6b36df7-afb0-4614-bb50-70b6e9cbf7f7","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/count-templates?page=1&pageSize=50","urlObject":{"path":["api","v1","omnichannelMessages","count-templates"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"c6b36df7-afb0-4614-bb50-70b6e9cbf7f7"}],"id":"4d5e24ce-bd61-4005-9127-9c06ac5b3aaf","_postman_id":"4d5e24ce-bd61-4005-9127-9c06ac5b3aaf","description":""},{"name":"billings","item":[{"name":"Omnichannel Messages Get Billings","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination echoes request page and pageSize', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.eql(1);\n    pm.expect(json.size, 'size').to.eql(300);\n    pm.expect(json.results.length, 'results length vs size').to.be.at.most(json.size);\n    if (json.rows === 0) {\n        pm.expect(json.results.length, 'empty page when rows=0').to.eql(0);\n    }\n});\n\npm.test('First billing result has required fields when present', function () {\n    const json = pm.response.json();\n    if (!json.results.length) {\n        return;\n    }\n    const item = json.results[0];\n    ['siteId', 'messageEnumType', 'messageType', 'calculatedAt', 'direction', 'quantity', 'pricePerUnit', 'price', 'category'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.siteId, 'siteId').to.be.a('number');\n    // API may serialize named enum values as strings and unknown/zero as numbers.\n    pm.expect(['string', 'number'], 'messageEnumType type').to.include(typeof item.messageEnumType);\n    if (typeof item.messageEnumType === 'string') {\n        pm.expect(item.messageEnumType, 'messageEnumType').to.not.equal('');\n    }\n    pm.expect(item.messageType, 'messageType').to.be.a('number');\n    pm.expect(item.calculatedAt, 'calculatedAt').to.be.a('string').and.not.equal('');\n    pm.expect(Number.isNaN(Date.parse(item.calculatedAt)), 'calculatedAt parseable').to.eql(false);\n    // Direction is an enum; wire format may be string name or numeric value.\n    pm.expect(['string', 'number'], 'direction type').to.include(typeof item.direction);\n    if (typeof item.direction === 'string') {\n        pm.expect(item.direction, 'direction').to.not.equal('');\n    }\n    pm.expect(item.quantity, 'quantity').to.be.a('number');\n    pm.expect(item.pricePerUnit, 'pricePerUnit').to.be.a('number');\n    pm.expect(item.price, 'price').to.be.a('number');\n    pm.expect(item.category, 'category').to.be.a('string');\n});"]}}],"id":"d87cb041-c178-4ccd-a3de-a2a7749c5685","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages/billings?page=1&pageSize=300","urlObject":{"path":["api","v1","omnichannelMessages","billings"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"300"}],"variable":[]}},"response":[],"_postman_id":"d87cb041-c178-4ccd-a3de-a2a7749c5685"}],"id":"16907480-b803-4b9b-b88a-678e7c9285a4","_postman_id":"16907480-b803-4b9b-b88a-678e7c9285a4","description":""},{"name":"Omnichannel Messages Bulk Delete","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\n// The admin API has no create-message endpoint, so seed an unsent (saved) WhatsApp campaign through the public REST API.\nconst createRes = await pm.sendRequest({\n    url: \"https://\" + pm.environment.get(\"restApiUrl\") + \"/v1/Messages/Whatsapp/Create?sendNow=false\",\n    method: \"POST\",\n    header: { apikey: pm.environment.get(\"restApiKeyForAutomationTests\"), \"Content-Type\": \"application/json\" },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            toMembersByCell: [\"0510000000\"],\n            templateId: Number(pm.environment.get(\"TemplateIdForWhatsApp\")),\n            templateMessageParams: [],\n            fromNumber: Number(pm.environment.get(\"WhatsAppVirtualNumber\"))\n        })\n    }\n});\npm.expect(createRes.code, \"seed saved omnichannel message status\").to.eql(200);\nconst messageId = createRes.json().id;\npm.expect(messageId, \"seeded message id\").to.be.a(\"number\").and.above(0);\n\npm.environment.set(\"smooveApiOmnichannelMessageIdToDelete\", String(messageId));\npm.request.body.update(JSON.stringify({ ids: [messageId] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const deletedId = Number(pm.environment.get(\"smooveApiOmnichannelMessageIdToDelete\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\nconst listRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/omnichannelMessages/search?Page=1&PageSize=100&IsDeleted=false\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Response object has all expected fields and types\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    [\"current\", \"pages\", \"size\", \"rows\", \"results\"].forEach(function (key) {\n        pm.expect(json, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(json.current, \"current\").to.be.a(\"number\");\n    pm.expect(json.pages, \"pages\").to.be.a(\"number\");\n    pm.expect(json.size, \"size\").to.be.a(\"number\");\n    pm.expect(json.rows, \"rows\").to.be.a(\"number\");\n    pm.expect(json.results, \"results\").to.be.an(\"array\");\n});\n\npm.test(\"Delete response includes the seeded message id\", function () {\n    const found = pm.response.json().results.some(function (m) { return m.id === deletedId; });\n    pm.expect(found, \"deleted id in response results\").to.eql(true);\n});\n\npm.test(\"Soft-deleted message is gone from active search\", function () {\n    pm.expect(listRes.code, \"list status\").to.eql(200);\n    const stillThere = listRes.json().results.some(function (m) { return m.id === deletedId; });\n    pm.expect(stillThere, \"message still active after delete\").to.eql(false);\n});\n\n// The seeded message stays soft-deleted: restore returns 500/502 on DEV and there is no permanent delete.\npm.environment.unset(\"smooveApiOmnichannelMessageIdToDelete\");"]}}],"id":"a94321c1-dc2c-4675-bc5d-f85ee30d662a","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/omnichannelMessages","urlObject":{"path":["api","v1","omnichannelMessages"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a94321c1-dc2c-4675-bc5d-f85ee30d662a"}],"id":"b93d51a9-082a-4389-b276-8eb5661b39a3","_postman_id":"b93d51a9-082a-4389-b276-8eb5661b39a3","description":""},{"name":"payments","item":[{"name":"{siteId}","item":[{"name":"calcPayment","item":[{"name":"Payments Calculate Payment","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedToDate = pm.environment.get(\"smooveApiPaymentToDate\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected calc payment item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'calc payment length').to.be.at.least(1);\n\n    const item = json[0];\n    ['totalAmount', 'datePaid', 'serviceGroupId', 'amount', 'commissionRate', 'dollarToNisRate', 'currency'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.totalAmount, 'totalAmount').to.be.a('number');\n    pm.expect(item.datePaid, 'datePaid').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.datePaid)), 'datePaid parseable').to.equal(false);\n    pm.expect(item.serviceGroupId, 'serviceGroupId').to.be.a('number');\n    pm.expect(item.amount, 'amount').to.be.a('number');\n    pm.expect(item.commissionRate, 'commissionRate').to.be.a('number');\n    pm.expect(item.dollarToNisRate, 'dollarToNisRate').to.be.a('number');\n    pm.expect(item.currency, 'currency').to.be.a('string');\n});\n\npm.test('Calc payment echoes toDate and has real amounts', function () {\n    const json = pm.response.json();\n    const item = json[0];\n    // API stamps datePaid from the requested toDate (no timezone suffix).\n    const expectedDay = String(expectedToDate).slice(0, 10);\n    pm.expect(String(item.datePaid).slice(0, 10), 'datePaid day').to.eql(expectedDay);\n    pm.expect(item.currency.trim(), 'currency').to.not.equal('');\n    pm.expect(item.totalAmount, 'totalAmount').to.be.at.least(0);\n    const sumAmounts = json.reduce(function (acc, row) { return acc + row.amount; }, 0);\n    pm.expect(sumAmounts, 'sum of amounts').to.be.above(0);\n});"]}}],"id":"8a153cf2-240e-42d1-a681-22a0fd445b92","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{smooveApiBaseURL}}/api/v1/payments/:siteId/calcPayment?fromDate={{smooveApiPaymentFromDate}}&toDate={{smooveApiPaymentToDate}}","urlObject":{"path":["api","v1","payments",":siteId","calcPayment"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"fromDate","value":"{{smooveApiPaymentFromDate}}"},{"key":"toDate","value":"{{smooveApiPaymentToDate}}"}],"variable":[{"type":"any","value":"{{smooveApiPaymentSiteId}}","key":"siteId"}]}},"response":[],"_postman_id":"8a153cf2-240e-42d1-a681-22a0fd445b92"}],"id":"d368835c-d715-46e6-ace2-e5e7fd3cf9ed","_postman_id":"d368835c-d715-46e6-ace2-e5e7fd3cf9ed","description":""},{"name":"savePayment","item":[],"id":"3b6f3868-1aab-4283-9041-aa7931c26b06","_postman_id":"3b6f3868-1aab-4283-9041-aa7931c26b06","description":""},{"name":"getPaymentDetails","item":[{"name":"Payments Get Payment Details","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected payment detail item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'payment details length').to.be.at.least(1);\n\n    const item = json[0];\n    ['invoiceDate', 'amount', 'commissionRate', 'serviceGroupId', 'affiliate', 'service', 'currency'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.invoiceDate, 'invoiceDate').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.invoiceDate)), 'invoiceDate parseable').to.equal(false);\n    pm.expect(item.amount, 'amount').to.be.a('number');\n    pm.expect(item.commissionRate, 'commissionRate').to.be.a('number');\n    pm.expect(item.serviceGroupId, 'serviceGroupId').to.be.a('number');\n    pm.expect(item.currency, 'currency').to.be.a('string');\n\n    pm.expect(item.affiliate, 'affiliate').to.be.an('object');\n    ['siteId', 'maxContacts', 'customerId', 'affiliator', 'userName'].forEach(function (key) {\n        pm.expect(item.affiliate, 'affiliate missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.affiliate.siteId, 'affiliate.siteId').to.be.a('number');\n    pm.expect(item.affiliate.maxContacts, 'affiliate.maxContacts').to.be.a('number');\n    pm.expect(item.affiliate.customerId, 'affiliate.customerId').to.be.a('number');\n    pm.expect(item.affiliate.affiliator, 'affiliate.affiliator').to.be.a('string');\n    pm.expect(item.affiliate.userName, 'affiliate.userName').to.be.a('string');\n\n    pm.expect(item.service, 'service').to.be.an('object');\n    ['serviceID', 'serviceCustomerID', 'serviceItemListID', 'serviceIsShow', 'serviceIsActive', 'serviceStartDate', 'serviceEndDate', 'serviceShowName', 'servicePrice', 'serviceCurrency'].forEach(function (key) {\n        pm.expect(item.service, 'service missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.service.serviceID, 'serviceID').to.be.a('number');\n    pm.expect(item.service.serviceCustomerID, 'serviceCustomerID').to.be.a('number');\n    pm.expect(item.service.serviceItemListID, 'serviceItemListID').to.be.a('number');\n    pm.expect(item.service.serviceIsShow, 'serviceIsShow').to.be.a('boolean');\n    pm.expect(item.service.serviceIsActive, 'serviceIsActive').to.be.a('boolean');\n    pm.expect(item.service.serviceStartDate, 'serviceStartDate').to.be.a('string');\n    pm.expect(item.service.serviceEndDate, 'serviceEndDate').to.be.a('string');\n    pm.expect(item.service.serviceShowName, 'serviceShowName').to.be.a('string');\n    pm.expect(item.service.servicePrice, 'servicePrice').to.be.a('string');\n    pm.expect(item.service.serviceCurrency, 'serviceCurrency').to.be.a('string');\n});\n\npm.test('Payment details have real affiliate and amount values', function () {\n    const json = pm.response.json();\n    const item = json[0];\n    pm.expect(item.affiliate.siteId, 'affiliate.siteId').to.be.above(0);\n    pm.expect(item.affiliate.customerId, 'affiliate.customerId').to.be.above(0);\n    pm.expect(item.affiliate.affiliator, 'affiliator').to.not.equal('');\n    pm.expect(item.affiliate.userName, 'userName').to.not.equal('');\n    pm.expect(item.service.serviceID, 'serviceID').to.be.above(0);\n    pm.expect(item.currency.trim(), 'currency').to.not.equal('');\n    pm.expect(item.commissionRate, 'commissionRate').to.be.at.least(0);\n});"]}}],"id":"84f95836-33fd-494b-a274-e79ff3558ac2","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{smooveApiBaseURL}}/api/v1/payments/:siteId/getPaymentDetails?fromDate={{smooveApiPaymentFromDate}}&toDate={{smooveApiPaymentToDate}}&dollarToNisRate={{smooveApiPaymentDollarToNisRate}}","urlObject":{"path":["api","v1","payments",":siteId","getPaymentDetails"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"fromDate","value":"{{smooveApiPaymentFromDate}}"},{"key":"toDate","value":"{{smooveApiPaymentToDate}}"},{"key":"dollarToNisRate","value":"{{smooveApiPaymentDollarToNisRate}}"}],"variable":[{"type":"any","value":"{{smooveApiPaymentSiteId}}","key":"siteId"}]}},"response":[],"_postman_id":"84f95836-33fd-494b-a274-e79ff3558ac2"}],"id":"a8c7983b-cf6b-4036-99b0-fcefea79cbfe","_postman_id":"a8c7983b-cf6b-4036-99b0-fcefea79cbfe","description":""},{"name":"Payments Get Payments History","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected payment history item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'payments history length').to.be.at.least(1);\n\n    const item = json[0];\n    ['commissionId', 'totalAmount', 'datePaid', 'serviceGroupId', 'amount', 'commissionRate', 'dollarToNisRate', 'currency'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.commissionId, 'commissionId').to.be.a('number');\n    pm.expect(item.totalAmount, 'totalAmount').to.be.a('number');\n    pm.expect(item.datePaid, 'datePaid').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.datePaid)), 'datePaid parseable').to.equal(false);\n    pm.expect(item.serviceGroupId, 'serviceGroupId').to.be.a('number');\n    pm.expect(item.amount, 'amount').to.be.a('number');\n    pm.expect(item.commissionRate, 'commissionRate').to.be.a('number');\n    pm.expect(item.dollarToNisRate, 'dollarToNisRate').to.be.a('number');\n    pm.expect(item.currency, 'currency').to.be.a('string');\n});\n\npm.test('Payment history items have real commission values', function () {\n    const json = pm.response.json();\n    const item = json[0];\n    pm.expect(item.commissionId, 'commissionId').to.be.above(0);\n    pm.expect(item.currency.trim(), 'currency').to.not.equal('');\n    pm.expect(item.commissionRate, 'commissionRate').to.be.at.least(0);\n    const ids = json.map(function (p) { return p.commissionId; });\n    pm.expect(ids.some(function (id) { return id > 0; }), 'at least one commissionId > 0').to.equal(true);\n});"]}}],"id":"309a1841-58c7-4e10-9ee0-dd3f52fd36b2","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{smooveApiBaseURL}}/api/v1/payments/:siteId","urlObject":{"path":["api","v1","payments",":siteId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiPaymentSiteId}}","key":"siteId"}]}},"response":[],"_postman_id":"309a1841-58c7-4e10-9ee0-dd3f52fd36b2"}],"id":"f54da008-a9e0-4ee0-b3e2-f96e4d9f602a","_postman_id":"f54da008-a9e0-4ee0-b3e2-f96e4d9f602a","description":""},{"name":"invoicesHistory","item":[{"name":"Payments Get Invoices And Receipts History","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected invoice/receipt history item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'invoices history length').to.be.at.least(1);\n\n    const item = json[0];\n    ['ReferenceID', 'ReferenceType', 'ReferenceDate', 'TotalAmount', 'AmountApplied'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.ReferenceID, 'ReferenceID').to.be.a('number');\n    pm.expect(item.ReferenceType, 'ReferenceType').to.be.a('string');\n    pm.expect(item.ReferenceDate, 'ReferenceDate').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.ReferenceDate)), 'ReferenceDate parseable').to.equal(false);\n    pm.expect(item.TotalAmount, 'TotalAmount').to.be.a('number');\n    pm.expect(item.AmountApplied, 'AmountApplied').to.be.a('number');\n});\n\npm.test('History items have real reference ids and types', function () {\n    const json = pm.response.json();\n    const item = json[0];\n    pm.expect(item.ReferenceID, 'ReferenceID').to.be.above(0);\n    pm.expect(item.ReferenceType, 'ReferenceType').to.not.equal('');\n    const types = json.map(function (row) { return row.ReferenceType; });\n    pm.expect(types.some(function (t) { return t === 'Invoice' || t === 'Receipt'; }), 'has Invoice or Receipt').to.equal(true);\n});"]}}],"id":"559e5754-1609-4cc6-b61f-b76f438f7a69","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{smooveApiBaseURL}}/api/v1/payments/invoicesHistory?siteId={{smooveApiAccountSiteId}}","urlObject":{"path":["api","v1","payments","invoicesHistory"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"siteId","value":"{{smooveApiAccountSiteId}}"}],"variable":[]}},"response":[],"_postman_id":"559e5754-1609-4cc6-b61f-b76f438f7a69"}],"id":"4a56351e-6ae4-4f5e-ac8b-43a2b1e6e224","_postman_id":"4a56351e-6ae4-4f5e-ac8b-43a2b1e6e224","description":""},{"name":"invoice","item":[{"name":"{invoiceId}","item":[{"name":"send","item":[{"name":"Payments Send Invoice","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst siteId = pm.environment.get(\"smooveApiAccountSiteId\");\n\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\n// Prefer known AtpBusiness invoice/customer pair; fall back to invoicesHistory.\nlet invoiceId = pm.environment.get(\"AtpBusiness_ServiceInvoiceId\") || \"0\";\nlet customerId = Number(pm.environment.get(\"AtpBusiness_ServiceCustomerId\") || 0);\n\nif (!invoiceId || invoiceId === \"0\" || !customerId) {\n    const historyRes = await send({\n        url: baseUrl + \"/api/v1/payments/invoicesHistory?siteId=\" + encodeURIComponent(siteId),\n        method: \"GET\",\n        header: {\n            Accept: \"application/json\",\n            Cookie: `jvlpsi=${cookie};`\n        }\n    });\n\n    if (historyRes.code === 200) {\n        const data = historyRes.json();\n        const items = Array.isArray(data) ? data : [];\n        for (let i = 0; i < items.length; i++) {\n            const item = items[i] || {};\n            if ((!invoiceId || invoiceId === \"0\") && item.ReferenceType === \"Invoice\" && item.ReferenceID) {\n                invoiceId = String(item.ReferenceID);\n            }\n            if (invoiceId && invoiceId !== \"0\") break;\n        }\n    }\n}\n\npm.expect(invoiceId && invoiceId !== \"0\", \"seed invoiceId to send\").to.equal(true);\npm.expect(customerId, \"seed customerId\").to.be.above(0);\n\npm.environment.set(\"smooveApiPaymentInvoiceIdToSend\", String(invoiceId));\npm.environment.set(\"smooveApiPaymentSendCustomerId\", String(customerId));\n\npm.request.body.update(JSON.stringify({ customerId: customerId }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedInvoiceId = String(pm.environment.get(\"smooveApiPaymentInvoiceIdToSend\"));\nconst expectedCustomerId = Number(pm.environment.get(\"smooveApiPaymentSendCustomerId\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst siteId = pm.environment.get(\"smooveApiAccountSiteId\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\nconst invoiceRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/payments/invoice/\" + expectedInvoiceId + \"?siteId=\" + encodeURIComponent(siteId),\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\n// AtpBusiness InvoiceService.SendInvoice returns true once the email is sent, false when it threw.\npm.test('Send invoice reports success', function () {\n    pm.expect(pm.response.json(), 'body').to.eql(true);\n});\n\npm.test('Sent invoice still resolvable via GET', function () {\n    pm.expect(expectedCustomerId, 'seeded customerId').to.be.above(0);\n    pm.expect(invoiceRes.code, 'follow-up GET status').to.eql(200);\n    pm.expect(invoiceRes.json().Invoice.InvoiceID, 'InvoiceID').to.eql(Number(expectedInvoiceId));\n});\n\n[\"smooveApiPaymentInvoiceIdToSend\", \"smooveApiPaymentSendCustomerId\"].forEach(function (k) {\n    pm.environment.unset(k);\n});"]}}],"id":"fdf25bb6-a56b-4ee5-8aa5-ec1e4b781e3c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"customerId\": 0\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/payments/invoice/:invoiceId/send?siteId={{smooveApiAccountSiteId}}","urlObject":{"path":["api","v1","payments","invoice",":invoiceId","send"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"siteId","value":"{{smooveApiAccountSiteId}}"}],"variable":[{"type":"any","value":"{{smooveApiPaymentInvoiceIdToSend}}","key":"invoiceId"}]}},"response":[],"_postman_id":"fdf25bb6-a56b-4ee5-8aa5-ec1e4b781e3c"}],"id":"3d43cad8-1bac-4621-85da-89583a4c6bdb","_postman_id":"3d43cad8-1bac-4621-85da-89583a4c6bdb","description":""},{"name":"Payments Get Invoice Details","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst siteId = pm.environment.get(\"smooveApiAccountSiteId\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nlet invoiceId = pm.environment.get(\"AtpBusiness_ServiceInvoiceId\") || \"0\";\n\nconst historyRes = await send({\n    url: baseUrl + \"/api/v1/payments/invoicesHistory?siteId=\" + encodeURIComponent(siteId),\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\n\nif (historyRes.code === 200) {\n    const data = historyRes.json();\n    const items = Array.isArray(data) ? data : [];\n    for (let i = 0; i < items.length; i++) {\n        const item = items[i] || {};\n        if (item.ReferenceType === \"Invoice\" && item.ReferenceID) {\n            invoiceId = String(item.ReferenceID);\n            break;\n        }\n    }\n}\n\npm.expect(invoiceId && invoiceId !== \"0\", \"seed invoiceId\").to.equal(true);\npm.environment.set(\"smooveApiPaymentInvoiceId\", String(invoiceId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedInvoiceId = Number(pm.environment.get(\"smooveApiPaymentInvoiceId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response has Invoice and InvoiceDetails with expected shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing Invoice').to.have.property('Invoice');\n    pm.expect(json, 'missing InvoiceDetails').to.have.property('InvoiceDetails');\n    pm.expect(json.Invoice, 'Invoice').to.be.an('object');\n    pm.expect(json.InvoiceDetails, 'InvoiceDetails').to.be.an('array');\n\n    const inv = json.Invoice;\n    ['InvoiceID', 'InvoiceCustomerID', 'InvoiceCustomerName', 'InvoiceDate', 'InvoiceCurrency', 'InvoiceTotal', 'InvoicePaid'].forEach(function (key) {\n        pm.expect(inv, 'Invoice missing ' + key).to.have.property(key);\n    });\n    pm.expect(inv.InvoiceID, 'InvoiceID').to.be.a('number');\n    pm.expect(inv.InvoiceCustomerID, 'InvoiceCustomerID').to.be.a('number');\n    pm.expect(inv.InvoiceCustomerName, 'InvoiceCustomerName').to.be.a('string');\n    pm.expect(inv.InvoiceDate, 'InvoiceDate').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(inv.InvoiceDate)), 'InvoiceDate parseable').to.equal(false);\n    pm.expect(inv.InvoiceCurrency, 'InvoiceCurrency').to.be.a('string');\n    pm.expect(inv.InvoiceTotal, 'InvoiceTotal').to.be.a('number');\n    pm.expect(inv.InvoicePaid, 'InvoicePaid').to.be.a('boolean');\n});\n\npm.test('InvoiceID echoes the requested invoice id', function () {\n    const json = pm.response.json();\n    pm.expect(json.Invoice.InvoiceID, 'InvoiceID').to.eql(expectedInvoiceId);\n    pm.expect(json.Invoice.InvoiceCustomerID, 'InvoiceCustomerID').to.be.above(0);\n    pm.expect(json.Invoice.InvoiceCustomerName, 'InvoiceCustomerName').to.not.equal('');\n    pm.expect(json.Invoice.InvoiceCurrency.trim(), 'InvoiceCurrency').to.not.equal('');\n});\n\npm.environment.unset(\"smooveApiPaymentInvoiceId\");"]}}],"id":"952a8642-eb83-4cb2-b7c5-1261ad9211e2","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{smooveApiBaseURL}}/api/v1/payments/invoice/:invoiceId?siteId={{smooveApiAccountSiteId}}","urlObject":{"path":["api","v1","payments","invoice",":invoiceId"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"siteId","value":"{{smooveApiAccountSiteId}}"}],"variable":[{"type":"any","value":"{{smooveApiPaymentInvoiceId}}","key":"invoiceId"}]}},"response":[],"_postman_id":"952a8642-eb83-4cb2-b7c5-1261ad9211e2"}],"id":"0d8b487c-92b6-4331-bbd6-fea414054db3","_postman_id":"0d8b487c-92b6-4331-bbd6-fea414054db3","description":""}],"id":"97d2cd0e-6612-43ba-8ef9-3cf919e26cdc","_postman_id":"97d2cd0e-6612-43ba-8ef9-3cf919e26cdc","description":""},{"name":"receipt","item":[{"name":"{receiptId}","item":[{"name":"send","item":[{"name":"Payments Send Receipt","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst siteId = pm.environment.get(\"smooveApiAccountSiteId\");\n\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\n// Prefer known AtpBusiness receipt/customer pair; fall back to invoicesHistory.\nlet receiptId = pm.environment.get(\"AtpBusiness_ServiceReceiptId\") || \"0\";\nlet customerId = Number(pm.environment.get(\"AtpBusiness_ServiceCustomerId\") || 0);\n\nif (!receiptId || receiptId === \"0\" || !customerId) {\n    const historyRes = await send({\n        url: baseUrl + \"/api/v1/payments/invoicesHistory?siteId=\" + encodeURIComponent(siteId),\n        method: \"GET\",\n        header: {\n            Accept: \"application/json\",\n            Cookie: `jvlpsi=${cookie};`\n        }\n    });\n\n    if (historyRes.code === 200) {\n        const data = historyRes.json();\n        const items = Array.isArray(data) ? data : [];\n        for (let i = 0; i < items.length; i++) {\n            const item = items[i] || {};\n            if ((!receiptId || receiptId === \"0\") && item.ReferenceType === \"Receipt\" && item.ReferenceID) {\n                receiptId = String(item.ReferenceID);\n            }\n            if (receiptId && receiptId !== \"0\") break;\n        }\n    }\n}\n\npm.expect(receiptId && receiptId !== \"0\", \"seed receiptId to send\").to.equal(true);\npm.expect(customerId, \"seed customerId\").to.be.above(0);\n\npm.environment.set(\"smooveApiPaymentReceiptIdToSend\", String(receiptId));\npm.environment.set(\"smooveApiPaymentSendCustomerId\", String(customerId));\n\npm.request.body.update(JSON.stringify({ customerId: customerId }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedReceiptId = String(pm.environment.get(\"smooveApiPaymentReceiptIdToSend\"));\nconst expectedCustomerId = Number(pm.environment.get(\"smooveApiPaymentSendCustomerId\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst siteId = pm.environment.get(\"smooveApiAccountSiteId\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\nconst receiptRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/payments/receipt/\" + expectedReceiptId + \"?siteId=\" + encodeURIComponent(siteId),\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\n// AtpBusiness ReceiptService.SendReceipt returns true once the email is sent, false when it threw.\npm.test('Send receipt reports success', function () {\n    pm.expect(pm.response.json(), 'body').to.eql(true);\n});\n\npm.test('Sent receipt still resolvable via GET', function () {\n    pm.expect(expectedCustomerId, 'seeded customerId').to.be.above(0);\n    pm.expect(receiptRes.code, 'follow-up GET status').to.eql(200);\n    pm.expect(receiptRes.json().Receipt.ReceiptID, 'ReceiptID').to.eql(Number(expectedReceiptId));\n});\n\n[\"smooveApiPaymentReceiptIdToSend\", \"smooveApiPaymentSendCustomerId\"].forEach(function (k) {\n    pm.environment.unset(k);\n});"]}}],"id":"dae2af08-3cd7-47f4-a396-464561d6acda","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"customerId\": 0\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/payments/receipt/:receiptId/send?siteId={{smooveApiAccountSiteId}}","urlObject":{"path":["api","v1","payments","receipt",":receiptId","send"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"siteId","value":"{{smooveApiAccountSiteId}}"}],"variable":[{"type":"any","value":"{{smooveApiPaymentReceiptIdToSend}}","key":"receiptId"}]}},"response":[],"_postman_id":"dae2af08-3cd7-47f4-a396-464561d6acda"}],"id":"7caf8466-55aa-47e6-b9f6-8e6d0a7d0432","_postman_id":"7caf8466-55aa-47e6-b9f6-8e6d0a7d0432","description":""},{"name":"Payments Get Receipt Details","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst siteId = pm.environment.get(\"smooveApiAccountSiteId\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedReceiptId = Number(pm.environment.get(\"smooveApiPaymentReceiptId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response has Receipt and ReceiptDetails with expected shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing Receipt').to.have.property('Receipt');\n    pm.expect(json, 'missing ReceiptDetails').to.have.property('ReceiptDetails');\n    pm.expect(json.Receipt, 'Receipt').to.be.an('object');\n    pm.expect(json.ReceiptDetails, 'ReceiptDetails').to.be.an('array');\n\n    const rec = json.Receipt;\n    ['ReceiptID', 'ReceiptCustomerID', 'ReceiptCustomerName', 'ReceiptDate', 'ReceiptCurrency', 'ReceiptTotal'].forEach(function (key) {\n        pm.expect(rec, 'Receipt missing ' + key).to.have.property(key);\n    });\n    pm.expect(rec.ReceiptID, 'ReceiptID').to.be.a('number');\n    pm.expect(rec.ReceiptCustomerID, 'ReceiptCustomerID').to.be.a('number');\n    pm.expect(rec.ReceiptCustomerName, 'ReceiptCustomerName').to.be.a('string');\n    pm.expect(rec.ReceiptDate, 'ReceiptDate').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(rec.ReceiptDate)), 'ReceiptDate parseable').to.equal(false);\n    pm.expect(rec.ReceiptCurrency, 'ReceiptCurrency').to.be.a('string');\n    pm.expect(rec.ReceiptTotal, 'ReceiptTotal').to.be.a('number');\n});\n\npm.test('ReceiptID echoes the requested receipt id', function () {\n    const json = pm.response.json();\n    pm.expect(json.Receipt.ReceiptID, 'ReceiptID').to.eql(expectedReceiptId);\n    pm.expect(json.Receipt.ReceiptCustomerID, 'ReceiptCustomerID').to.be.above(0);\n    pm.expect(json.Receipt.ReceiptCustomerName, 'ReceiptCustomerName').to.not.equal('');\n    // ReceiptCurrency can be \"\" on some live receipts; still must be a string (shape assert).\n    pm.expect(json.ReceiptDetails, 'ReceiptDetails').to.be.an('array');\n});\n\npm.environment.unset(\"smooveApiPaymentReceiptId\");"]}}],"id":"babf171e-8383-4100-a2e6-fa990a159971","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{smooveApiBaseURL}}/api/v1/payments/receipt/:receiptId?siteId={{smooveApiAccountSiteId}}","urlObject":{"path":["api","v1","payments","receipt",":receiptId"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"siteId","value":"{{smooveApiAccountSiteId}}"}],"variable":[{"type":"any","value":"{{smooveApiPaymentReceiptId}}","key":"receiptId"}]}},"response":[],"_postman_id":"babf171e-8383-4100-a2e6-fa990a159971"}],"id":"cdae762c-f00f-4068-8662-bd834222089d","_postman_id":"cdae762c-f00f-4068-8662-bd834222089d","description":""}],"id":"1502abf0-557a-434e-b516-440c3ca04f63","_postman_id":"1502abf0-557a-434e-b516-440c3ca04f63","description":""}],"id":"607b948c-e105-4ca1-bf06-5b71322d72bf","_postman_id":"607b948c-e105-4ca1-bf06-5b71322d72bf","description":""},{"name":"sms","item":[{"name":"search","item":[{"name":"Sms Search","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedSiteId = Number(pm.environment.get(\"smooveApiSiteId\"));\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Pagination fields exist and echo the request\", function () {\n    const json = pm.response.json();\n    [\"current\", \"pages\", \"size\", \"rows\", \"results\"].forEach(function (key) {\n        pm.expect(json, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(json.current, \"current\").to.be.a(\"number\").and.eql(1);\n    pm.expect(json.pages, \"pages\").to.be.a(\"number\").and.at.least(1);\n    pm.expect(json.size, \"size\").to.be.a(\"number\").and.eql(5);\n    pm.expect(json.rows, \"rows\").to.be.a(\"number\").and.at.least(1);\n    pm.expect(json.results, \"results\").to.be.an(\"array\");\n    pm.expect(json.results.length, \"results length\").to.be.at.least(1).and.at.most(5);\n    pm.expect(json.results.length, \"page size vs rows\").to.eql(Math.min(json.rows, json.size));\n});\n\npm.test(\"First result has required fields and status=saved\", function () {\n    const json = pm.response.json();\n    const item = json.results[0];\n    [\"id\", \"siteId\", \"content\", \"sentTime\", \"status\", \"recipients\", \"bounced\",\n        \"sends\", \"messagesSent\", \"trackLinks\", \"isAttachedToBusinessJourney\"].forEach(function (key) {\n        pm.expect(item, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(item.id, \"id\").to.be.a(\"number\").and.above(0);\n    pm.expect(item.siteId, \"siteId\").to.be.a(\"number\");\n    if (expectedSiteId > 0) {\n        pm.expect(item.siteId, \"siteId matches account\").to.eql(expectedSiteId);\n    }\n    pm.expect(item.content, \"content\").to.be.a(\"string\");\n    pm.expect(item.sentTime, \"sentTime\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(item.sentTime)), \"sentTime parseable\").to.eql(false);\n    pm.expect(item.status, \"status\").to.eql(\"saved\");\n    pm.expect(item.recipients, \"recipients\").to.be.a(\"string\");\n    pm.expect(item.bounced, \"bounced\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(item.sends, \"sends\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(item.messagesSent, \"messagesSent\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(item.trackLinks, \"trackLinks\").to.be.a(\"boolean\");\n    pm.expect(item.isAttachedToBusinessJourney, \"isAttachedToBusinessJourney\").to.be.a(\"boolean\");\n});"]}}],"id":"737dafdf-d182-4a0f-acd5-7921cf70f4d9","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/sms/search?Status=saved&Page=1&PageSize=5","urlObject":{"path":["api","v1","sms","search"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"Status","value":"saved"},{"key":"Page","value":"1"},{"key":"PageSize","value":"5"}],"variable":[]}},"response":[],"_postman_id":"737dafdf-d182-4a0f-acd5-7921cf70f4d9"}],"id":"1bc1d15b-f77c-4d41-90bf-1d823e3cff40","_postman_id":"1bc1d15b-f77c-4d41-90bf-1d823e3cff40","description":""},{"name":"count","item":[{"name":"Sms Get Total Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\n// Capture search.rows for the same Status filter so count can be cross-checked.\nconst searchRes = await send({\n    url: baseUrl + \"/api/v1/sms/search?Status=saved&Page=1&PageSize=1\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.expect(searchRes.code, \"seed search for count\").to.eql(200);\nconst searchJson = searchRes.json();\npm.expect(searchJson, \"missing rows\").to.have.property(\"rows\");\npm.environment.set(\"smooveApiSmsSavedRows\", String(searchJson.rows));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const listRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/sms/search?Status=saved&Page=1&PageSize=1\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\n\nconst expectedRows = Number(pm.environment.get(\"smooveApiSmsSavedRows\"));\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is a non-negative number matching search.rows\", function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a(\"number\");\n    pm.expect(Number.isFinite(value)).to.be.true;\n    pm.expect(value, \"saved sms count\").to.be.at.least(1);\n    pm.expect(value, \"count matches search.rows\").to.eql(expectedRows);\n});\n\npm.environment.unset(\"smooveApiSmsSavedRows\");\n\npm.test('Count equals the total rows of the saved sms list', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    pm.expect(pm.response.json(), 'count').to.eql(listRes.json().rows);\n});"]}}],"id":"26a535a0-2307-40e3-bfb7-a964ab06b8ac","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/sms/count?Status=saved","urlObject":{"path":["api","v1","sms","count"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"Status","value":"saved"}],"variable":[]}},"response":[],"_postman_id":"26a535a0-2307-40e3-bfb7-a964ab06b8ac"}],"id":"af89dfd7-bfef-4a6d-80bd-488178bb575e","_postman_id":"af89dfd7-bfef-4a6d-80bd-488178bb575e","description":""},{"name":"sms","item":[{"name":"Sms Get Sms List","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Pagination fields exist and echo pageSize=50\", function () {\n    const json = pm.response.json();\n    [\"current\", \"pages\", \"size\", \"rows\", \"results\"].forEach(function (key) {\n        pm.expect(json, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(json.current, \"current\").to.be.a(\"number\").and.eql(1);\n    pm.expect(json.pages, \"pages\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(json.size, \"size\").to.be.a(\"number\").and.eql(50);\n    pm.expect(json.rows, \"rows\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(json.results, \"results\").to.be.an(\"array\");\n    pm.expect(json.results.length, \"results length\").to.eql(Math.min(json.rows, json.size));\n});\n\npm.test(\"Sent-SMS items have required fields when present\", function () {\n    const json = pm.response.json();\n    if (!json.results.length) {\n        // Live DEV account currently has no non-auto sent SMS with targeted content.\n        pm.expect(json.rows, \"empty rows\").to.eql(0);\n        pm.expect(json.pages, \"empty pages\").to.eql(0);\n        return;\n    }\n    const item = json.results[0];\n    [\"id\", \"siteId\", \"sentTime\", \"bounced\", \"sends\", \"messagesSent\", \"status\",\n        \"content\", \"recipients\"].forEach(function (key) {\n        pm.expect(item, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(item.id, \"id\").to.be.a(\"number\").and.above(0);\n    pm.expect(item.siteId, \"siteId\").to.be.a(\"number\");\n    pm.expect(item.sentTime, \"sentTime\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(item.sentTime)), \"sentTime parseable\").to.eql(false);\n    pm.expect(item.status, \"status\").to.eql(\"sent\");\n    pm.expect(item.content, \"content\").to.be.a(\"string\");\n    pm.expect(item.recipients, \"recipients\").to.be.a(\"string\");\n    pm.expect(item.bounced, \"bounced\").to.be.a(\"number\");\n    pm.expect(item.sends, \"sends\").to.be.a(\"number\");\n    pm.expect(item.messagesSent, \"messagesSent\").to.be.a(\"number\");\n});"]}}],"id":"e5bc03fd-3f4a-4b31-a003-3e264835291e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/sms/sms?page=1&pageSize=50","urlObject":{"path":["api","v1","sms","sms"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"e5bc03fd-3f4a-4b31-a003-3e264835291e"}],"id":"bc43ed47-9d36-49fc-a2b6-5a82be63fee7","_postman_id":"bc43ed47-9d36-49fc-a2b6-5a82be63fee7","description":""},{"name":"restore","item":[{"name":"Sms Restore","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\n// The admin API has no create-SMS endpoint, so seed an unsent (saved) SMS through the public REST API.\n// Retry briefly on 5xx — DEV REST occasionally returns a transient 500 on Messages create.\nlet createRes;\nfor (let attempt = 1; attempt <= 3; attempt++) {\n    createRes = await pm.sendRequest({\n        url: \"https://\" + pm.environment.get(\"restApiUrl\") + \"/v1/Messages?isTts=false&sendNow=false\",\n        method: \"POST\",\n        header: { apikey: pm.environment.get(\"restApiKeyForAutomationTests\"), \"Content-Type\": \"application/json\" },\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({\n                toMembersByCell: [\"0500000000\"],\n                body: \"postman-sms-restore-\" + Date.now() + \"-\" + Math.random().toString(36).slice(2, 8),\n                fromNumber: pm.environment.get(\"smooveApiSmsFromNumber\")\n            })\n        }\n    });\n    if (createRes.code < 500) break;\n    if (attempt < 3) await new Promise(function (r) { setTimeout(r, 500 * attempt); });\n}\npm.expect(createRes.code, \"seed saved sms status\").to.eql(200);\nconst smsId = createRes.json().id;\npm.expect(smsId, \"seeded sms id\").to.be.a(\"number\").and.above(0);\n\n// Soft-delete it so restore has a real target.\nconst deleteRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/sms\",\n    method: \"DELETE\",\n    header: { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" },\n    body: { mode: \"raw\", raw: JSON.stringify({ ids: [smsId] }) }\n});\npm.expect(deleteRes.code, \"soft-delete seeded sms status\").to.eql(200);\npm.expect(deleteRes.json()[0].status, \"seeded sms status after delete\").to.eql(\"deleted\");\n\npm.environment.set(\"smooveApiSmsIdToRestore\", String(smsId));\npm.request.body.update(JSON.stringify({ ids: [smsId] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedId = Number(pm.environment.get(\"smooveApiSmsIdToRestore\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\n// Cleanup: soft-delete the seeded SMS again (the admin API has no permanent delete).\nconst cleanupRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/sms\",\n    method: \"DELETE\",\n    header: { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" },\n    body: { mode: \"raw\", raw: JSON.stringify({ ids: [expectedId] }) }\n});\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Restored SMS echoes id and status=saved\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"array\");\n    pm.expect(json.length, \"restored length\").to.eql(1);\n    const item = json[0];\n    [\"id\", \"siteId\", \"content\", \"sentTime\", \"status\", \"recipients\", \"bounced\",\n        \"sends\", \"messagesSent\"].forEach(function (key) {\n        pm.expect(item, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(item.id, \"restored id\").to.eql(expectedId);\n    pm.expect(item.status, \"restored status\").to.eql(\"saved\");\n    pm.expect(item.siteId, \"siteId\").to.be.a(\"number\").and.above(0);\n    pm.expect(item.content, \"content\").to.be.a(\"string\");\n    pm.expect(item.sentTime, \"sentTime\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(item.sentTime)), \"sentTime parseable\").to.eql(false);\n    pm.expect(item.recipients, \"recipients\").to.be.a(\"string\");\n    pm.expect(item.bounced, \"bounced\").to.be.a(\"number\");\n    pm.expect(item.sends, \"sends\").to.be.a(\"number\");\n    pm.expect(item.messagesSent, \"messagesSent\").to.be.a(\"number\");\n});\n\npm.test(\"Cleanup: seeded SMS soft-deleted again\", function () {\n    pm.expect(cleanupRes.code, \"cleanup status\").to.eql(200);\n});\n\npm.environment.unset(\"smooveApiSmsIdToRestore\");"]}}],"id":"7e7f5bbc-6af4-482f-ad91-45cf08111226","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/sms/restore","urlObject":{"path":["api","v1","sms","restore"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7e7f5bbc-6af4-482f-ad91-45cf08111226"}],"id":"9d0ba3f8-54ea-4786-8f55-9141580d6a46","_postman_id":"9d0ba3f8-54ea-4786-8f55-9141580d6a46","description":""},{"name":"statistics","item":[{"name":"dashboard","item":[{"name":"{date}","item":[{"name":"Sms Get Sms Dashboard Statistics","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst today = new Date().toISOString().slice(0, 10);\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\npm.environment.set(\"smooveApiSmsDashboardDate\", today);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedDate = pm.environment.get(\"smooveApiSmsDashboardDate\");\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Dashboard statistics has required fields and consistent quota math\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    [\"quota\", \"used\", \"left\", \"sent\", \"smsPlanTierType\", \"from\", \"isAnyStatistics\"].forEach(function (key) {\n        pm.expect(json, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(json.quota, \"quota\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(json.used, \"used\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(json.left, \"left\").to.be.a(\"number\");\n    pm.expect(json.sent, \"sent\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(json.smsPlanTierType, \"smsPlanTierType\").to.be.a(\"string\").and.not.empty;\n    pm.expect(json.from, \"from\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(json.from)), \"from parseable\").to.eql(false);\n    pm.expect(json.isAnyStatistics, \"isAnyStatistics\").to.be.a(\"boolean\");\n\n    // Live contract: left tracks remaining send quota (quota - sent), not used.\n    // Do not assert used >= sent — used/sent can diverge on live accounts.\n    pm.expect(json.left, \"left === quota - sent\").to.eql(json.quota - json.sent);\n    // Compare the raw date prefix to avoid UTC vs local Date parsing drift.\n    pm.expect(String(json.from).slice(0, 10), \"from matches requested date\").to.eql(expectedDate);\n});\n\npm.environment.unset(\"smooveApiSmsDashboardDate\");"]}}],"id":"8d75c0c3-72f5-44e2-8eb5-ff80104a2230","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/sms/statistics/dashboard/{{smooveApiSmsDashboardDate}}","urlObject":{"path":["api","v1","sms","statistics","dashboard","{{smooveApiSmsDashboardDate}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiSmsDashboardDate}}","key":"date"}]}},"response":[],"_postman_id":"8d75c0c3-72f5-44e2-8eb5-ff80104a2230"}],"id":"7573b3c8-cd93-495a-b8de-0ca687dddf0e","_postman_id":"7573b3c8-cd93-495a-b8de-0ca687dddf0e","description":""},{"name":"billing","item":[{"name":"{date}","item":[{"name":"Sms Get Sms Dashboard Billings Details For Unlimited Plan","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Billing details object has required fields and real rows\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"object\");\n    pm.expect(json, \"missing smsBillingsDetails\").to.have.property(\"smsBillingsDetails\");\n    pm.expect(json, \"missing firstUpdatedDate\").to.have.property(\"firstUpdatedDate\");\n    pm.expect(json.smsBillingsDetails, \"smsBillingsDetails\").to.be.an(\"array\");\n    pm.expect(json.smsBillingsDetails.length, \"billing rows\").to.be.at.least(1);\n    pm.expect(json.firstUpdatedDate, \"firstUpdatedDate\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(json.firstUpdatedDate)), \"firstUpdatedDate parseable\").to.eql(false);\n\n    const item = json.smsBillingsDetails[0];\n    [\"used\", \"sent\", \"smsPlanTierType\", \"lastUpdatedDate\", \"dateOfCalculation\", \"price\"].forEach(function (key) {\n        pm.expect(item, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(item.used, \"used\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(item.sent, \"sent\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(item.smsPlanTierType, \"smsPlanTierType\").to.be.a(\"string\").and.not.empty;\n    pm.expect(item.lastUpdatedDate, \"lastUpdatedDate\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(item.lastUpdatedDate)), \"lastUpdatedDate parseable\").to.eql(false);\n    pm.expect(item.dateOfCalculation, \"dateOfCalculation\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(item.dateOfCalculation)), \"dateOfCalculation parseable\").to.eql(false);\n    pm.expect(item.price, \"price\").to.be.a(\"number\").and.at.least(0);\n    // Do not assert used >= sent — used/sent can diverge on live accounts.\n});"]}}],"id":"4963debd-346b-497b-b460-f3c29205477f","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/sms/statistics/dashboard/billing/{{smooveApiSmsBillingDate}}","urlObject":{"path":["api","v1","sms","statistics","dashboard","billing","{{smooveApiSmsBillingDate}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiSmsBillingDate}}","key":"date"}]}},"response":[],"_postman_id":"4963debd-346b-497b-b460-f3c29205477f"}],"id":"19cc1d07-aa1e-413b-9fcc-7fec867e74ff","_postman_id":"19cc1d07-aa1e-413b-9fcc-7fec867e74ff","description":""}],"id":"b5977509-b075-430e-885f-66135dca0a5c","_postman_id":"b5977509-b075-430e-885f-66135dca0a5c","description":""}],"id":"59eb377d-1be7-4df6-8541-96d586a136d1","_postman_id":"59eb377d-1be7-4df6-8541-96d586a136d1","description":""}],"id":"2059ae60-f207-4796-b9d7-54b3f6962f29","_postman_id":"2059ae60-f207-4796-b9d7-54b3f6962f29","description":""},{"name":"Sms Bulk Delete","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\n// The admin API has no create-SMS endpoint, so seed an unsent (saved) SMS through the public REST API.\n// Retry briefly on 5xx — DEV REST occasionally returns a transient 500 on Messages create.\nlet createRes;\nfor (let attempt = 1; attempt <= 3; attempt++) {\n    createRes = await pm.sendRequest({\n        url: \"https://\" + pm.environment.get(\"restApiUrl\") + \"/v1/Messages?isTts=false&sendNow=false\",\n        method: \"POST\",\n        header: { apikey: pm.environment.get(\"restApiKeyForAutomationTests\"), \"Content-Type\": \"application/json\" },\n        body: {\n            mode: \"raw\",\n            raw: JSON.stringify({\n                toMembersByCell: [\"0500000000\"],\n                body: \"postman-sms-delete-\" + Date.now() + \"-\" + Math.random().toString(36).slice(2, 8),\n                fromNumber: pm.environment.get(\"smooveApiSmsFromNumber\")\n            })\n        }\n    });\n    if (createRes.code < 500) break;\n    if (attempt < 3) await new Promise(function (r) { setTimeout(r, 500 * attempt); });\n}\npm.expect(createRes.code, \"seed saved sms status\").to.eql(200);\nconst smsId = createRes.json().id;\npm.expect(smsId, \"seeded sms id\").to.be.a(\"number\").and.above(0);\n\npm.environment.set(\"smooveApiSmsIdToDelete\", String(smsId));\npm.request.body.update(JSON.stringify({ ids: [smsId] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedId = Number(pm.environment.get(\"smooveApiSmsIdToDelete\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\nconst activeRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/sms/search?Page=1&PageSize=100&Status=saved&IsDeleted=false\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Deleted SMS echoes id and status=deleted\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"array\");\n    pm.expect(json.length, \"deleted sms length\").to.eql(1);\n    const item = json[0];\n    [\"id\", \"siteId\", \"content\", \"sentTime\", \"status\", \"recipients\", \"bounced\",\n        \"sends\", \"messagesSent\"].forEach(function (key) {\n        pm.expect(item, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(item.id, \"deleted sms id\").to.eql(expectedId);\n    pm.expect(item.status, \"deleted status\").to.eql(\"deleted\");\n    pm.expect(item.siteId, \"siteId\").to.be.a(\"number\").and.above(0);\n    pm.expect(item.content, \"content\").to.be.a(\"string\");\n    pm.expect(item.sentTime, \"sentTime\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(item.sentTime)), \"sentTime parseable\").to.eql(false);\n    pm.expect(item.recipients, \"recipients\").to.be.a(\"string\");\n    pm.expect(item.bounced, \"bounced\").to.be.a(\"number\");\n    pm.expect(item.sends, \"sends\").to.be.a(\"number\");\n    pm.expect(item.messagesSent, \"messagesSent\").to.be.a(\"number\");\n});\n\npm.test(\"Soft-deleted SMS is absent from active saved search\", function () {\n    pm.expect(activeRes.code, \"active search status\").to.eql(200);\n    const stillActive = (activeRes.json().results || []).some(function (s) { return s.id === expectedId; });\n    pm.expect(stillActive, \"sms still in active saved list\").to.eql(false);\n});\n\npm.environment.unset(\"smooveApiSmsIdToDelete\");"]}}],"id":"f619c1de-9858-471b-bc0f-d61c11ed6c03","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"ids\": []\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/sms","urlObject":{"path":["api","v1","sms"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f619c1de-9858-471b-bc0f-d61c11ed6c03"}],"id":"61be3ec1-1184-47e7-834c-be8b42ad5496","_postman_id":"61be3ec1-1184-47e7-834c-be8b42ad5496","description":""},{"name":"throttling","item":[{"name":"groupped","item":[{"name":"Throttlings Get Grouped","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const requestedPage = 1;\nconst requestedPageSize = 50;\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination echoes the request and has real totals', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.eql(requestedPage);\n    pm.expect(json.size, 'size').to.eql(requestedPageSize);\n    pm.expect(json.rows, 'rows').to.be.above(0);\n    pm.expect(json.pages, 'pages').to.be.above(0);\n    pm.expect(json.results.length, 'results length').to.be.above(0);\n    pm.expect(json.results.length, 'results length vs size').to.be.at.most(json.size);\n});\n\npm.test('First result has required fields and consistent customer site', function () {\n    const json = pm.response.json();\n    const item = json.results[0];\n    ['siteId', 'requestCountMonthly', 'lastActivityUsage', 'lastActivityDate', 'customer', 'apiKeys'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.siteId, 'siteId').to.be.a('number').and.above(0);\n    pm.expect(item.requestCountMonthly, 'requestCountMonthly').to.be.a('number').and.above(0);\n    pm.expect(item.lastActivityUsage, 'lastActivityUsage').to.be.a('number').and.above(0);\n    pm.expect(item.lastActivityDate, 'lastActivityDate').to.be.a('string').and.not.equal('');\n    pm.expect(Number.isNaN(Date.parse(item.lastActivityDate)), 'lastActivityDate parseable').to.eql(false);\n    pm.expect(item.apiKeys, 'apiKeys').to.be.an('array');\n    pm.expect(item.customer, 'customer').to.be.an('object');\n    pm.expect(item.customer, 'customer missing id').to.have.property('id');\n    pm.expect(item.customer, 'customer missing siteId').to.have.property('siteId');\n    pm.expect(item.customer, 'customer missing name').to.have.property('name');\n    // Live DEV often returns customer.id === 0 for legacy accounts.\n    pm.expect(item.customer.id, 'customer.id').to.be.a('number');\n    pm.expect(item.customer.siteId, 'customer.siteId').to.eql(item.siteId);\n    pm.expect(item.customer.name, 'customer.name').to.be.a('string').and.not.equal('');\n});"]}}],"id":"da9bbd24-d5f8-433c-990e-8d2fa6d9da6b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/throttling/groupped?page=1&pageSize=50","urlObject":{"path":["api","v1","throttling","groupped"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"da9bbd24-d5f8-433c-990e-8d2fa6d9da6b"}],"id":"5f510e3c-302a-4d10-a4f9-5a4c219e5351","_postman_id":"5f510e3c-302a-4d10-a4f9-5a4c219e5351","description":""},{"name":"details","item":[{"name":"Throttlings Get Details","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedSiteId = Number(pm.environment.get(\"smooveApiSiteId\"));\nconst requestedPage = 1;\nconst requestedPageSize = 50;\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination echoes the request and rows match results', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.eql(requestedPage);\n    pm.expect(json.size, 'size').to.eql(requestedPageSize);\n    pm.expect(json.rows, 'rows').to.be.above(0);\n    pm.expect(json.results.length, 'results length').to.be.above(0);\n    pm.expect(json.results.length, 'results length vs rows').to.be.at.most(json.rows);\n    pm.expect(json.results.length, 'results length vs size').to.be.at.most(json.size);\n});\n\npm.test('Each result has required fields and belongs to the requested site', function () {\n    const json = pm.response.json();\n    json.results.forEach(function (item, index) {\n        const label = 'results[' + index + ']';\n        pm.expect(item, label).to.be.an('object');\n        ['siteId', 'requestCountMonthly', 'controllerName', 'lastActivityDate'].forEach(function (key) {\n            pm.expect(item, label + ' missing ' + key).to.have.property(key);\n        });\n        pm.expect(item.siteId, label + '.siteId').to.be.a('number').and.eql(expectedSiteId);\n        pm.expect(item.requestCountMonthly, label + '.requestCountMonthly').to.be.a('number').and.above(0);\n        pm.expect(item.controllerName, label + '.controllerName').to.be.a('string').and.not.equal('');\n        pm.expect(item.lastActivityDate, label + '.lastActivityDate').to.be.a('string').and.not.equal('');\n        pm.expect(Number.isNaN(Date.parse(item.lastActivityDate)), label + '.lastActivityDate parseable').to.eql(false);\n    });\n});"]}}],"id":"8782d0c2-9052-4930-8246-46764155ecaa","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/throttling/details?accountSiteId={{smooveApiSiteId}}&page=1&pageSize=50","urlObject":{"path":["api","v1","throttling","details"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"accountSiteId","value":"{{smooveApiSiteId}}"},{"key":"page","value":"1"},{"key":"pageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"8782d0c2-9052-4930-8246-46764155ecaa"}],"id":"41520a3f-8102-4829-9a84-1047cb42a564","_postman_id":"41520a3f-8102-4829-9a84-1047cb42a564","description":""}],"id":"09a9ce01-9812-4b30-badf-e3078086437c","_postman_id":"09a9ce01-9812-4b30-badf-e3078086437c","description":""},{"name":"users","item":[{"name":"{userId}","item":[{"name":"Users Delete User","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst newUser = {\n    id: 0,\n    nickName: \"TestUser_Delete\",\n    userName: \"test_user_delete_\" + suffix,\n    email: \"test+delete_\" + suffix + \"@test.email\",\n    cellphone: \"\",\n    requireMfa: false,\n    isMainUser: false,\n    verifiedAt: new Date().toISOString(),\n    invitationsSent: 0,\n    role: \"User\",\n    permissions: {\n        AllowSendEmail: true,\n        AllowSendTestEmail: true,\n        AllowSendSms: true,\n        AllowExport: true\n    },\n    errorMessages: [],\n    amountOfAccounts: 1,\n    hasMultipleAccounts: false,\n    disabledUser: false,\n    disabledRole: false\n};\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst createResponse = await send({\n    url: baseUrl + \"/api/v1/users\",\n    method: \"PUT\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": \"jvlpsi=\" + cookie + \";\"\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify([newUser])\n    }\n});\n\npm.expect(createResponse.code, \"create user before delete\").to.eql(200);\nconst created = createResponse.json();\nconst userId = Array.isArray(created) && created[0] && created[0].id;\npm.expect(Number(userId), \"created user id\").to.be.above(0);\n\npm.environment.set(\"smooveApiUserIdToDelete\", String(userId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst deletedUserId = Number(pm.environment.get(\"smooveApiUserIdToDelete\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/users\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\n\npm.test('Deleted user is removed from the users list', function () {\n    pm.expect(deletedUserId, 'deleted id').to.be.above(0);\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    const users = listRes.json();\n    pm.expect(users, 'users').to.be.an('array');\n    const stillListed = users.some(function (u) { return Number(u.id) === deletedUserId; });\n    pm.expect(stillListed, 'user still in list after delete').to.eql(false);\n});\n\npm.environment.unset(\"smooveApiUserIdToDelete\");"]}}],"id":"9532ca7d-fe07-48ca-895c-9ad37a38417a","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[],"url":"{{smooveApiBaseURL}}/api/v1/users/{{smooveApiUserIdToDelete}}","urlObject":{"path":["api","v1","users","{{smooveApiUserIdToDelete}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9532ca7d-fe07-48ca-895c-9ad37a38417a"}],"id":"5e6daa4e-d2e0-4ba5-ba39-6c767c132b81","_postman_id":"5e6daa4e-d2e0-4ba5-ba39-6c767c132b81","description":""},{"name":"verify","item":[{"name":"{userId}","item":[{"name":"Users Verify","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst userId = Number(pm.environment.get(\"smooveApiUserId\"));\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\npm.expect(userId, \"smooveApiUserId\").to.be.above(0);\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/users\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\npm.expect(listRes.code, \"seed users list\").to.eql(200);\nconst users = listRes.json();\nconst target = users.find(function (u) { return Number(u.id) === userId; });\npm.expect(target, \"verify target user\").to.be.an(\"object\");\npm.environment.set(\"smooveApiPrevInvitationsSent\", String(target.invitationsSent));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["function send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst userId = Number(pm.environment.get(\"smooveApiUserId\"));\nconst prevInvitations = Number(pm.environment.get(\"smooveApiPrevInvitationsSent\"));\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\nlet returnedCount;\npm.test('Response is the incremented invitationsSent count', function () {\n    try {\n        returnedCount = pm.response.json();\n    } catch (e) {\n        returnedCount = Number(pm.response.text().trim());\n    }\n    pm.expect(returnedCount).to.be.a('number');\n    pm.expect(Number.isFinite(returnedCount)).to.eql(true);\n    pm.expect(returnedCount, 'returned invitationsSent').to.eql(prevInvitations + 1);\n});\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/users\",\n    method: \"GET\",\n    header: {\n        Accept: \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    }\n});\n\npm.test('Follow-up GET shows invitationsSent increased by one', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    const users = listRes.json();\n    const target = users.find(function (u) { return Number(u.id) === userId; });\n    pm.expect(target, 'verified user').to.be.an('object');\n    pm.expect(target.invitationsSent, 'invitationsSent after verify').to.eql(prevInvitations + 1);\n    pm.expect(target.invitationsSent, 'invitationsSent matches response').to.eql(returnedCount);\n});\n\npm.environment.unset(\"smooveApiPrevInvitationsSent\");"]}}],"id":"e8ddba1e-4b3e-4741-a5ef-01431d30795c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/users/verify/{{smooveApiUserId}}","urlObject":{"path":["api","v1","users","verify","{{smooveApiUserId}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e8ddba1e-4b3e-4741-a5ef-01431d30795c"}],"id":"6df73bd9-facf-4dcc-88f1-7429f313e454","_postman_id":"6df73bd9-facf-4dcc-88f1-7429f313e454","description":""}],"id":"e8aa3736-43d8-4e9a-8fd5-b44c3518e52b","_postman_id":"e8aa3736-43d8-4e9a-8fd5-b44c3518e52b","description":""},{"name":"Users Get Users","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is a non-empty array of user objects', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'users length').to.be.at.least(1);\n    json.forEach(function (item, index) {\n        const label = 'users[' + index + ']';\n        pm.expect(item, label).to.be.an('object');\n        ['id', 'requireMfa', 'isMainUser', 'role', 'amountOfAccounts', 'hasMultipleAccounts', 'disabledUser', 'disabledRole', 'nickName', 'userName', 'email', 'verifiedAt', 'invitationsSent', 'permissions', 'errorMessages'].forEach(function (key) {\n            pm.expect(item, label + ' missing ' + key).to.have.property(key);\n        });\n        pm.expect(item.id, label + '.id').to.be.a('number');\n        pm.expect(item.requireMfa, label + '.requireMfa').to.be.a('boolean');\n        pm.expect(item.isMainUser, label + '.isMainUser').to.be.a('boolean');\n        pm.expect(item.role, label + '.role').to.be.a('string');\n        pm.expect(item.amountOfAccounts, label + '.amountOfAccounts').to.be.a('number');\n        pm.expect(item.hasMultipleAccounts, label + '.hasMultipleAccounts').to.be.a('boolean');\n        pm.expect(item.disabledUser, label + '.disabledUser').to.be.a('boolean');\n        pm.expect(item.disabledRole, label + '.disabledRole').to.be.a('boolean');\n        pm.expect(item.nickName, label + '.nickName').to.be.a('string');\n        pm.expect(item.userName, label + '.userName').to.be.a('string');\n        pm.expect(item.email, label + '.email').to.be.a('string');\n        pm.expect(item.verifiedAt, label + '.verifiedAt').to.be.a('string');\n        pm.expect(item.invitationsSent, label + '.invitationsSent').to.be.a('number');\n        pm.expect(item.permissions, label + '.permissions').to.be.an('object');\n        pm.expect(item.errorMessages, label + '.errorMessages').to.be.an('array');\n    });\n});\n\npm.test('Users have real identity values', function () {\n    const json = pm.response.json();\n    const item = json[0];\n    pm.expect(item.id, 'id').to.be.above(0);\n    pm.expect(item.userName, 'userName').to.not.equal('');\n    pm.expect(item.email, 'email').to.include('@');\n    pm.expect(item.nickName, 'nickName').to.not.equal('');\n    pm.expect(item.role, 'role').to.not.equal('');\n    pm.expect(item.amountOfAccounts, 'amountOfAccounts').to.be.above(0);\n    pm.expect(Number.isNaN(Date.parse(item.verifiedAt)), 'verifiedAt parseable').to.eql(false);\n    const ids = json.map(function (u) { return u.id; });\n    pm.expect(new Set(ids).size, 'unique user ids').to.eql(ids.length);\n    const mainUsers = json.filter(function (u) { return u.isMainUser === true; });\n    pm.expect(mainUsers.length, 'main users').to.be.at.least(1);\n});"]}}],"id":"389e65d3-1b60-4eb0-a377-b5b7515c8d3c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/users","urlObject":{"path":["api","v1","users"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"389e65d3-1b60-4eb0-a377-b5b7515c8d3c"},{"name":"Users Add Or Update Users","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst payload = {\n    id: 0,\n    nickName: \"TestUser_Postman\",\n    userName: \"test_user_postman_\" + suffix,\n    email: \"test+postman_\" + suffix + \"@test.email\",\n    cellphone: \"\",\n    requireMfa: false,\n    isMainUser: false,\n    verifiedAt: new Date().toISOString(),\n    invitationsSent: 0,\n    role: \"User\",\n    permissions: {\n        AllowSendEmail: true,\n        AllowSendTestEmail: true,\n        AllowSendSms: true,\n        AllowExport: true\n    },\n    errorMessages: [],\n    amountOfAccounts: 1,\n    hasMultipleAccounts: false,\n    disabledUser: false,\n    disabledRole: false\n};\npm.environment.set(\"smooveApiCreatedUserName\", payload.userName);\npm.environment.set(\"smooveApiCreatedUserEmail\", payload.email);\npm.environment.set(\"smooveApiCreatedUserNickName\", payload.nickName);\npm.request.body.update(JSON.stringify([payload]));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedEmail = pm.environment.get(\"smooveApiCreatedUserEmail\");\nconst expectedNickName = pm.environment.get(\"smooveApiCreatedUserNickName\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected user fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'users length').to.eql(1);\n    const item = json[0];\n    ['id', 'requireMfa', 'isMainUser', 'role', 'amountOfAccounts', 'hasMultipleAccounts', 'disabledUser', 'disabledRole', 'nickName', 'userName', 'email', 'cellphone', 'verifiedAt', 'invitationsSent', 'permissions', 'errorMessages'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number');\n    pm.expect(item.requireMfa, 'requireMfa').to.be.a('boolean');\n    pm.expect(item.isMainUser, 'isMainUser').to.be.a('boolean');\n    pm.expect(item.role, 'role').to.be.a('string');\n    pm.expect(item.amountOfAccounts, 'amountOfAccounts').to.be.a('number');\n    pm.expect(item.hasMultipleAccounts, 'hasMultipleAccounts').to.be.a('boolean');\n    pm.expect(item.disabledUser, 'disabledUser').to.be.a('boolean');\n    pm.expect(item.disabledRole, 'disabledRole').to.be.a('boolean');\n    pm.expect(item.nickName, 'nickName').to.be.a('string');\n    pm.expect(item.userName, 'userName').to.be.a('string');\n    pm.expect(item.email, 'email').to.be.a('string');\n    pm.expect(item.cellphone, 'cellphone').to.be.a('string');\n    pm.expect(item.verifiedAt, 'verifiedAt').to.be.a('string');\n    pm.expect(item.invitationsSent, 'invitationsSent').to.be.a('number');\n    pm.expect(item.permissions, 'permissions').to.be.an('object');\n    pm.expect(item.errorMessages, 'errorMessages').to.be.an('array');\n});\n\npm.test('Created user echoes the request identity', function () {\n    const item = pm.response.json()[0];\n    pm.expect(item.id, 'id').to.be.above(0);\n    // API derives userName from email (does not echo the request userName).\n    pm.expect(item.userName, 'userName').to.be.a('string').and.not.equal('');\n    pm.expect(item.email, 'email').to.eql(expectedEmail);\n    pm.expect(item.nickName, 'nickName').to.eql(expectedNickName);\n    pm.expect(item.requireMfa, 'requireMfa').to.eql(false);\n    pm.expect(item.isMainUser, 'isMainUser').to.eql(false);\n    pm.expect(item.role, 'role').to.eql('User');\n    pm.expect(item.disabledUser, 'disabledUser').to.eql(false);\n    pm.expect(item.permissions.AllowSendEmail, 'AllowSendEmail').to.eql(true);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    let cleanupId;\n    try {\n        cleanupId = pm.response.json()[0] && pm.response.json()[0].id;\n    } catch (e) {\n        cleanupId = null;\n    }\n\n    if (!cleanupId) {\n        pm.test(\"Cleanup skipped: could not resolve user id\", function () {\n            pm.expect.fail(\"Missing user id for cleanup\");\n        });\n        return;\n    }\n\n    const cleanupRes = await pm.sendRequest({\n        url: `${baseUrl}/api/v1/users/${cleanupId}`,\n        method: \"DELETE\",\n        header: {\n            \"Cookie\": `jvlpsi=${cookie};`,\n            \"Accept\": \"application/json\"\n        }\n    });\n    pm.test(\"Cleanup: user deleted successfully\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n}\n\nawait cleanUp();\n\n[\"smooveApiCreatedUserName\", \"smooveApiCreatedUserEmail\", \"smooveApiCreatedUserNickName\"].forEach(function (k) {\n    pm.environment.unset(k);\n});"]}}],"id":"6b5a8b6e-a505-4692-a9a9-65a3fe7006d5","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"[\n  {\n    \"id\": 0,\n    \"nickName\": \"TestUser_Postman\",\n    \"userName\": \"test_user_postman_placeholder\",\n    \"email\": \"test+postman_placeholder@test.email\",\n    \"cellphone\": \"\",\n    \"requireMfa\": false,\n    \"isMainUser\": false,\n    \"verifiedAt\": \"2026-01-01T00:00:00.000Z\",\n    \"invitationsSent\": 0,\n    \"role\": \"User\",\n    \"permissions\": {\n      \"AllowSendEmail\": true,\n      \"AllowSendTestEmail\": true,\n      \"AllowSendSms\": true,\n      \"AllowExport\": true\n    },\n    \"errorMessages\": [],\n    \"amountOfAccounts\": 1,\n    \"hasMultipleAccounts\": false,\n    \"disabledUser\": false,\n    \"disabledRole\": false\n  }\n]","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/users","urlObject":{"path":["api","v1","users"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6b5a8b6e-a505-4692-a9a9-65a3fe7006d5"}],"id":"848488d8-c65f-494e-a187-07f04ef5b7b7","_postman_id":"848488d8-c65f-494e-a187-07f04ef5b7b7","description":""},{"name":"virtualnumbers","item":[{"name":"responses","item":[{"name":"Virtual Numbers Search Responses","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nlet virtualNumber = pm.environment.get(\"smooveApiVirtualNumber\") ||\n    pm.environment.get(\"WhatsAppVirtualNumber\");\nif (!virtualNumber) {\n    const listRes = await send({\n        url: baseUrl + \"/api/v1/virtualnumbers/search\",\n        method: \"GET\",\n        header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n    });\n    pm.expect(listRes.code, \"discover virtual numbers\").to.eql(200);\n    const list = listRes.json();\n    pm.expect(list, \"virtual numbers list\").to.be.an(\"array\").and.not.empty;\n    virtualNumber = list[0].virtualNum;\n}\n\nconst dateFrom = pm.environment.get(\"smooveApiDateFrom\");\nconst dateTo = new Date().toISOString();\npm.environment.set(\"smooveApiVirtualNumber\", String(virtualNumber));\npm.environment.set(\"smooveApiVnResponsesDateFrom\", dateFrom);\npm.environment.set(\"smooveApiVnResponsesDateTo\", dateTo);\n\ntry {\n    pm.request.url.query.upsert({ key: \"VirtualNumber\", value: String(virtualNumber) });\n    pm.request.url.query.upsert({ key: \"DateFrom\", value: dateFrom });\n    pm.request.url.query.upsert({ key: \"DateTo\", value: dateTo });\n    pm.request.url.query.upsert({ key: \"Page\", value: \"1\" });\n    pm.request.url.query.upsert({ key: \"PageSize\", value: \"50\" });\n} catch (e) {}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Pagination echoes request and stays internally consistent\", function () {\n    const json = pm.response.json();\n    [\"current\", \"pages\", \"size\", \"rows\", \"results\"].forEach(function (key) {\n        pm.expect(json, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(json.current, \"current\").to.be.a(\"number\").and.eql(1);\n    pm.expect(json.pages, \"pages\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(json.size, \"size\").to.be.a(\"number\").and.eql(50);\n    pm.expect(json.rows, \"rows\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(json.results, \"results\").to.be.an(\"array\");\n    pm.expect(json.results.length, \"results length\").to.be.at.most(json.size);\n    pm.expect(json.results.length, \"page result count\").to.eql(Math.min(json.rows, json.size));\n});\n\npm.test(\"Result items have required fields when responses exist\", function () {\n    const json = pm.response.json();\n    if (!json.results.length) {\n        pm.expect(json.rows, \"empty page rows\").to.eql(0);\n        return;\n    }\n    const item = json.results[0];\n    [\"createdAt\", \"contactId\", \"destination\", \"message\"].forEach(function (key) {\n        pm.expect(item, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(item.createdAt, \"createdAt\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(item.createdAt)), \"createdAt parseable\").to.eql(false);\n    pm.expect(item.contactId, \"contactId\").to.be.a(\"number\");\n    pm.expect(item.destination, \"destination\").to.be.a(\"string\");\n    pm.expect(item.message, \"message\").to.be.a(\"string\");\n});\n\n[\"smooveApiVnResponsesDateFrom\", \"smooveApiVnResponsesDateTo\"].forEach(function (k) {\n    pm.environment.unset(k);\n});"]}}],"id":"c802201b-2820-4c49-ac71-8d04c6ebcd58","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/virtualnumbers/responses?VirtualNumber={{smooveApiVirtualNumber}}&DateFrom={{smooveApiVnResponsesDateFrom}}&DateTo={{smooveApiVnResponsesDateTo}}&Page=1&PageSize=50","urlObject":{"path":["api","v1","virtualnumbers","responses"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"VirtualNumber","value":"{{smooveApiVirtualNumber}}"},{"key":"DateFrom","value":"{{smooveApiVnResponsesDateFrom}}"},{"key":"DateTo","value":"{{smooveApiVnResponsesDateTo}}"},{"key":"Page","value":"1"},{"key":"PageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"c802201b-2820-4c49-ac71-8d04c6ebcd58"}],"id":"3c0efbe3-9292-400d-ba37-20e03ecb9a5d","_postman_id":"3c0efbe3-9292-400d-ba37-20e03ecb9a5d","description":""},{"name":"search","item":[{"name":"Virtual Numbers Search","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\n// Discover a real virtual number on this account so assertions are not empty-array no-ops.\nlet virtualNumber = pm.environment.get(\"WhatsAppVirtualNumber\") ||\n    pm.environment.get(\"smooveApiVirtualNumber\");\nif (!virtualNumber) {\n    const listRes = await send({\n        url: baseUrl + \"/api/v1/virtualnumbers/search\",\n        method: \"GET\",\n        header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n    });\n    pm.expect(listRes.code, \"discover virtual numbers\").to.eql(200);\n    const list = listRes.json();\n    pm.expect(list, \"virtual numbers list\").to.be.an(\"array\").and.not.empty;\n    virtualNumber = list[0].virtualNum;\n}\npm.expect(virtualNumber, \"virtual number to search\").to.be.a(\"string\").and.not.empty;\npm.environment.set(\"smooveApiVirtualNumber\", String(virtualNumber));\ntry {\n    pm.request.url.query.upsert({ key: \"virtualNumber\", value: String(virtualNumber) });\n} catch (e) {}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedNumber = String(pm.environment.get(\"smooveApiVirtualNumber\") || \"\");\nconst expectedSiteId = Number(pm.environment.get(\"smooveApiSiteId\"));\n\npm.test(\"Status code is 200\", function () {\n    pm.response.to.have.status(200);\n});\n\npm.test(\"Response is JSON\", function () {\n    pm.response.to.be.json;\n});\n\npm.test(\"Search returns the requested virtual number with required fields\", function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an(\"array\");\n    pm.expect(json.length, \"result count\").to.be.at.least(1);\n\n    const item = json.find(function (row) {\n        return String(row.virtualNum) === expectedNumber;\n    }) || json[0];\n\n    [\"siteId\", \"provider\", \"virtualNum\", \"apiKey\", \"generalInfo\"].forEach(function (key) {\n        pm.expect(item, \"missing \" + key).to.have.property(key);\n    });\n    pm.expect(item.siteId, \"siteId\").to.be.a(\"number\");\n    pm.expect(item.provider, \"provider\").to.be.a(\"string\").and.not.empty;\n    pm.expect(item.virtualNum, \"virtualNum\").to.be.a(\"string\");\n    pm.expect(item.apiKey, \"apiKey\").to.be.a(\"string\").and.not.empty;\n    pm.expect(item.generalInfo, \"generalInfo\").to.be.an(\"object\");\n\n    pm.expect(String(item.virtualNum), \"virtualNum echoes request\").to.eql(expectedNumber);\n    if (expectedSiteId > 0) {\n        pm.expect(item.siteId, \"siteId matches account\").to.eql(expectedSiteId);\n    }\n\n    const gi = item.generalInfo;\n    [\"id\", \"mainSiteId\", \"isExternalIdEnabled\", \"portalState\", \"contactsQuota\",\n        \"importOptInRequired\", \"planType\", \"dateCreated\", \"locale\", \"domain\",\n        \"resellerId\", \"timeZoneId\", \"maxSendsPerMonth\"].forEach(function (key) {\n        pm.expect(gi, \"generalInfo missing \" + key).to.have.property(key);\n    });\n    pm.expect(gi.id, \"generalInfo.id\").to.be.a(\"number\").and.above(0);\n    pm.expect(gi.mainSiteId, \"mainSiteId\").to.be.a(\"number\");\n    pm.expect(gi.isExternalIdEnabled, \"isExternalIdEnabled\").to.be.a(\"boolean\");\n    pm.expect(gi.portalState, \"portalState\").to.be.a(\"string\").and.not.empty;\n    pm.expect(gi.contactsQuota, \"contactsQuota\").to.be.a(\"number\").and.at.least(0);\n    pm.expect(gi.importOptInRequired, \"importOptInRequired\").to.be.a(\"boolean\");\n    pm.expect(gi.planType, \"planType\").to.be.a(\"string\").and.not.empty;\n    pm.expect(gi.dateCreated, \"dateCreated\").to.be.a(\"string\");\n    pm.expect(Number.isNaN(Date.parse(gi.dateCreated)), \"dateCreated parseable\").to.eql(false);\n    pm.expect(gi.locale, \"locale\").to.be.a(\"string\").and.not.empty;\n    pm.expect(gi.domain, \"domain\").to.be.a(\"string\").and.not.empty;\n    pm.expect(gi.resellerId, \"resellerId\").to.be.a(\"number\");\n    pm.expect(gi.timeZoneId, \"timeZoneId\").to.be.a(\"string\").and.not.empty;\n    pm.expect(gi.maxSendsPerMonth, \"maxSendsPerMonth\").to.be.a(\"number\");\n    pm.expect(gi.id, \"generalInfo.id matches siteId\").to.eql(item.siteId);\n});"]}}],"id":"3d1a81e5-c7e6-440a-88f1-9c36437092e1","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/virtualnumbers/search?virtualNumber={{smooveApiVirtualNumber}}","urlObject":{"path":["api","v1","virtualnumbers","search"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"virtualNumber","value":"{{smooveApiVirtualNumber}}"}],"variable":[]}},"response":[],"_postman_id":"3d1a81e5-c7e6-440a-88f1-9c36437092e1"}],"id":"9bc577bd-7d46-4b78-abe7-50f14608f8ba","_postman_id":"9bc577bd-7d46-4b78-abe7-50f14608f8ba","description":""}],"id":"fdbc0878-f5a1-462d-a4ab-e8773b2c23c1","_postman_id":"fdbc0878-f5a1-462d-a4ab-e8773b2c23c1","description":""},{"name":"whatsapp","item":[{"name":"contacts","item":[{"name":"{contactId}","item":[{"name":"Whats App Get Contact","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\nasync function createContact(label, extra) {\n    const res = await call(\"POST\", baseUrl + \"/api/v1/contacts?suppressWarnings=true\", Object.assign({\n        email: \"postman.\" + label + \".\" + suffix + \"@smoove.smoove-api.postman.test\",\n        firstname: \"Postman\",\n        lastname: label,\n        mailPermissions: true,\n        unsubscribed: false,\n        isDeleted: false\n    }, extra));\n    pm.expect(res.code, \"create contact status\").to.be.oneOf([200, 201]);\n    const id = res.json().id;\n    pm.expect(id, \"created contact id\").to.be.above(0);\n    return id;\n}\n\n// A unique phone number per run, so the seeded contact never clashes with an existing one.\nconst cellPhone = \"9725\" + String(Math.floor(Math.random() * 1e8)).padStart(8, \"0\");\nconst contactId = await createContact(\"WhatsApp\", { cellPhone: cellPhone, contactCanReceiveWhatsappMessages: true });\npm.environment.set(\"smooveApiWhatsAppSeedContactId\", String(contactId));\npm.environment.set(\"smooveApiWhatsAppSeedCellPhone\", cellPhone);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\nconst cleanupRes = await call(\"DELETE\", baseUrl + \"/api/v1/contacts/\" + pm.environment.get(\"smooveApiWhatsAppSeedContactId\"));\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['_id', 'contactIdentifier', 'contactId', 'name', 'cellPhone', 'avatar', 'siteId', 'isDeleted', 'isBlackListed', 'canReceiveWhatsappMessages'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json._id, '_id').to.be.a('string').and.not.empty;\n    pm.expect(json.contactIdentifier, 'contactIdentifier').to.be.a('string').and.not.empty;\n    pm.expect(json.contactId, 'contactId').to.be.a('number');\n    pm.expect(json.name, 'name').to.be.a('string');\n    pm.expect(json.cellPhone, 'cellPhone').to.be.a('string');\n    pm.expect(json.avatar, 'avatar').to.be.a('string');\n    pm.expect(json.siteId, 'siteId').to.be.a('number');\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.isBlackListed, 'isBlackListed').to.be.a('boolean');\n    pm.expect(json.canReceiveWhatsappMessages, 'canReceiveWhatsappMessages').to.be.a('boolean');\n});\n\npm.test('Contact matches the requested identity', function () {\n    const json = pm.response.json();\n    pm.expect(json.contactId, 'contactId').to.eql(Number(pm.environment.get(\"smooveApiWhatsAppSeedContactId\")));\n    pm.expect(json.cellPhone, 'cellPhone').to.eql(pm.environment.get('smooveApiWhatsAppSeedCellPhone'));\n    const expectedSiteId = Number(pm.environment.get('smooveApiAccountSiteId') || pm.environment.get('smooveApiSiteId'));\n    pm.expect(json.siteId, 'siteId').to.eql(expectedSiteId);\n});\n\npm.test(\"Cleanup: seeded contact deleted\", function () {\n    pm.expect(cleanupRes.code, \"cleanup status\").to.be.oneOf([200, 204]);\n});\n\n[\"smooveApiWhatsAppSeedContactId\", \"smooveApiWhatsAppSeedCellPhone\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"d1eba3e5-f594-49f2-9f91-32b126c12fb7","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveApiBaseURL}}/api/v1/whatsapp/contacts/:contactId?cellPhone={{smooveApiWhatsAppSeedCellPhone}}","urlObject":{"path":["api","v1","whatsapp","contacts",":contactId"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"cellPhone","value":"{{smooveApiWhatsAppSeedCellPhone}}"}],"variable":[{"type":"any","value":"{{smooveApiWhatsAppSeedContactId}}","key":"contactId"}]}},"response":[],"_postman_id":"d1eba3e5-f594-49f2-9f91-32b126c12fb7"}],"id":"4033dd5a-d6b9-4f37-99d0-6a79999f4714","_postman_id":"4033dd5a-d6b9-4f37-99d0-6a79999f4714","description":""},{"name":"{cellPhone}","item":[{"name":"mark-read","item":[{"name":"Whats App Mark Contact As Read","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing unreadCount').to.have.property('unreadCount');\n    pm.expect(json.unreadCount, 'unreadCount').to.be.a('number').and.at.least(0);\n});\n\npm.test('Mark-read clears unread count', function () {\n    const json = pm.response.json();\n    pm.expect(json.unreadCount, 'unreadCount').to.eql(0);\n});"]}}],"id":"eb218878-47a5-4c96-8dfa-a17710430dfe","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveApiBaseURL}}/api/v1/whatsapp/contacts/:cellPhone/mark-read","urlObject":{"path":["api","v1","whatsapp","contacts",":cellPhone","mark-read"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiContactCellPhone}}","key":"cellPhone"}]}},"response":[],"_postman_id":"eb218878-47a5-4c96-8dfa-a17710430dfe"}],"id":"9ce05c73-8998-4e30-a13a-1537986f4b1d","_postman_id":"9ce05c73-8998-4e30-a13a-1537986f4b1d","description":""}],"id":"0758b3c0-d91d-4b63-968e-32b74ae627fc","_postman_id":"0758b3c0-d91d-4b63-968e-32b74ae627fc","description":""},{"name":"Whats App Get Contacts","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['contacts', 'unreadCounts', 'hasIncomingMessages', 'lastMessages', 'hasMore'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.contacts, 'contacts').to.be.an('array').and.not.empty;\n    pm.expect(json.unreadCounts, 'unreadCounts').to.be.an('object');\n    pm.expect(json.hasIncomingMessages, 'hasIncomingMessages').to.be.an('object');\n    pm.expect(json.lastMessages, 'lastMessages').to.be.an('object');\n    pm.expect(json.hasMore, 'hasMore').to.be.a('boolean');\n});\n\npm.test('First contact has all expected fields and types', function () {\n    const item = pm.response.json().contacts[0];\n    // name is omitted for some contacts; other identity/status fields are always present.\n    ['contactId', 'cellPhone', 'avatar', 'siteId', 'isDeleted', 'isBlackListed', 'canReceiveWhatsappMessages'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.contactId, 'contactId').to.be.a('number');\n    pm.expect(item.name == null || typeof item.name === 'string', 'name').to.equal(true);\n    pm.expect(item.cellPhone, 'cellPhone').to.be.a('string').and.not.empty;\n    pm.expect(item.avatar, 'avatar').to.be.a('string');\n    pm.expect(item.siteId, 'siteId').to.be.a('number');\n    pm.expect(item.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(item.isBlackListed, 'isBlackListed').to.be.a('boolean');\n    pm.expect(item.canReceiveWhatsappMessages, 'canReceiveWhatsappMessages').to.be.a('boolean');\n});"]}}],"id":"55da4c0a-8859-4d8c-9b78-a5951a26b0d1","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveApiBaseURL}}/api/v1/whatsapp/contacts?page=1&pageSize=50","urlObject":{"path":["api","v1","whatsapp","contacts"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"55da4c0a-8859-4d8c-9b78-a5951a26b0d1"}],"id":"a5e1025b-0b04-42d0-a86a-5c5f7912a95f","_postman_id":"a5e1025b-0b04-42d0-a86a-5c5f7912a95f","description":""},{"name":"messages","item":[{"name":"contact","item":[{"name":"{cellPhone}","item":[{"name":"Whats App Get Messages By Contact","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['messages', 'hasMore'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.messages, 'messages').to.be.an('array').and.not.empty;\n    pm.expect(json.hasMore, 'hasMore').to.be.a('boolean');\n});\n\npm.test('First message has all expected fields and types', function () {\n    const item = pm.response.json().messages[0];\n    ['_id', 'messageId', 'direction', 'from', 'to', 'messageContent', 'messageType', 'type', 'status', 'createdAt'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item._id, '_id').to.be.a('string').and.not.empty;\n    pm.expect(item.messageId, 'messageId').to.be.a('string').and.not.empty;\n    pm.expect(item.direction, 'direction').to.be.a('string').and.not.empty;\n    pm.expect(item.from == null || typeof item.from === 'string', 'from').to.equal(true);\n    pm.expect(item.to == null || typeof item.to === 'string', 'to').to.equal(true);\n    pm.expect(item.messageContent == null || typeof item.messageContent === 'string', 'messageContent').to.equal(true);\n    pm.expect(item.messageType, 'messageType').to.be.a('string');\n    pm.expect(item.type, 'type').to.be.a('string');\n    pm.expect(item.status, 'status').to.be.a('number');\n    pm.expect(item.createdAt, 'createdAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.createdAt)), 'createdAt parseable').to.equal(false);\n});\n\npm.test('Messages belong to the requested cellphone', function () {\n    const item = pm.response.json().messages[0];\n    pm.expect([item.from, item.to], 'from/to includes cellphone').to.include(pm.environment.get('smooveApiContactCellPhone'));\n});"]}}],"id":"d4b333e8-5f74-4186-a92d-5cfc1b333ea8","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveApiBaseURL}}/api/v1/whatsapp/messages/contact/:cellPhone?page=1&pageSize=50","urlObject":{"path":["api","v1","whatsapp","messages","contact",":cellPhone"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"1"},{"key":"pageSize","value":"50"}],"variable":[{"type":"any","value":"{{smooveApiContactCellPhone}}","key":"cellPhone"}]}},"response":[],"_postman_id":"d4b333e8-5f74-4186-a92d-5cfc1b333ea8"}],"id":"83059544-5a9c-4094-bd4b-6ed8a08127b8","_postman_id":"83059544-5a9c-4094-bd4b-6ed8a08127b8","description":""}],"id":"7ae2ce85-a2a4-4c26-a3c6-cd16961a09fa","_postman_id":"7ae2ce85-a2a4-4c26-a3c6-cd16961a09fa","description":""},{"name":"Whats App Send Message","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\nasync function createContact(label, extra) {\n    const res = await call(\"POST\", baseUrl + \"/api/v1/contacts?suppressWarnings=true\", Object.assign({\n        email: \"postman.\" + label + \".\" + suffix + \"@smoove.smoove-api.postman.test\",\n        firstname: \"Postman\",\n        lastname: label,\n        mailPermissions: true,\n        unsubscribed: false,\n        isDeleted: false\n    }, extra));\n    pm.expect(res.code, \"create contact status\").to.be.oneOf([200, 201]);\n    const id = res.json().id;\n    pm.expect(id, \"created contact id\").to.be.above(0);\n    return id;\n}\n\n// A unique phone number per run, so the seeded contact never clashes with an existing one.\nconst cellPhone = \"9725\" + String(Math.floor(Math.random() * 1e8)).padStart(8, \"0\");\nconst contactId = await createContact(\"WhatsApp\", { cellPhone: cellPhone, contactCanReceiveWhatsappMessages: true });\npm.environment.set(\"smooveApiWhatsAppSeedContactId\", String(contactId));\npm.environment.set(\"smooveApiWhatsAppSeedCellPhone\", cellPhone);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\nconst cleanupRes = await call(\"DELETE\", baseUrl + \"/api/v1/contacts/\" + pm.environment.get(\"smooveApiWhatsAppSeedContactId\"));\n\npm.test('Status code is 201', function () {\n    pm.response.to.have.status(201);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'contactIdentifier', 'direction', 'from', 'to', 'messageContent', 'templateId', 'messageType', 'messageId', 'status', 'siteId', 'createdAt'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('string').and.not.empty;\n    pm.expect(json.contactIdentifier, 'contactIdentifier').to.be.a('string');\n    pm.expect(json.direction, 'direction').to.be.a('string');\n    pm.expect(json.from, 'from').to.be.a('string').and.not.empty;\n    pm.expect(json.to == null || typeof json.to === 'string', 'to').to.equal(true);\n    pm.expect(json.messageContent == null || typeof json.messageContent === 'string', 'messageContent').to.equal(true);\n    pm.expect(json.templateId, 'templateId').to.be.a('number');\n    pm.expect(json.messageType, 'messageType').to.be.a('string');\n    pm.expect(json.messageId, 'messageId').to.be.a('string').and.not.empty;\n    pm.expect(json.status, 'status').to.be.a('number');\n    pm.expect(json.siteId, 'siteId').to.be.a('number');\n    pm.expect(json.createdAt, 'createdAt').to.be.a('string');\n});\n\npm.test('Sent message echoes the request', function () {\n    const json = pm.response.json();\n    const expectedSiteId = Number(pm.environment.get('smooveApiAccountSiteId') || pm.environment.get('smooveApiSiteId'));\n    pm.expect(json.from, 'from').to.eql(pm.environment.get('smooveApiWhatsAppBusinessNumber'));\n    pm.expect(json.to, 'to').to.eql(pm.environment.get('smooveApiWhatsAppSeedCellPhone'));\n    pm.expect(json.messageContent, 'messageContent').to.eql('Postman test message');\n    pm.expect(json.templateId, 'templateId').to.eql(Number(pm.environment.get(\"smooveApiWhatsAppTemplateId\")));\n    pm.expect(json.siteId, 'siteId').to.eql(expectedSiteId);\n    pm.expect(json.direction, 'direction').to.eql('out');\n});\n\npm.test(\"Cleanup: seeded contact deleted\", function () {\n    pm.expect(cleanupRes.code, \"cleanup status\").to.be.oneOf([200, 204]);\n});\n\n[\"smooveApiWhatsAppSeedContactId\", \"smooveApiWhatsAppSeedCellPhone\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"ec6d3b37-18a2-4a3d-ade6-db0cf72a79c1","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"*/*"}],"body":{"mode":"raw","raw":"{\n  \"content\": \"Postman test message\",\n  \"cellPhone\": \"{{smooveApiWhatsAppSeedCellPhone}}\",\n  \"contactId\": {{smooveApiWhatsAppSeedContactId}},\n  \"mediaUrl\": \"https://example.com/media/sample.png\",\n  \"dynamicButtonParam\": \"Postman test message\",\n  \"templateId\": {{smooveApiWhatsAppTemplateId}},\n  \"parameters\": [\n    \"postman-param-1\",\n    \"postman-param-2\"\n  ]\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/whatsapp/messages","urlObject":{"path":["api","v1","whatsapp","messages"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"ec6d3b37-18a2-4a3d-ade6-db0cf72a79c1"}],"id":"43e08aae-3257-4926-a115-3896763e8564","_postman_id":"43e08aae-3257-4926-a115-3896763e8564","description":""},{"name":"contact","item":[{"name":"{cellphone}","item":[{"name":"active","item":[{"name":"Whats App Get Active Session","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\n// A number that was never contacted, so the contract is the same on every run and nothing is created.\npm.environment.set(\"smooveApiWhatsAppUnknownCellPhone\", \"9725\" + String(Math.floor(Math.random() * 1e8)).padStart(8, \"0\"));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["// The 200 response (_id, contactIdentifier, cellPhone, startedAt, expiresAt) is not covered. A session starts only\n// after the provider accepts an outbound template message or an inbound message arrives, and the DEV site has no\n// approved WhatsApp template (every send fails with status 4). Add the 200 case once the site has an approved\n// template: send it to a seeded contact and read the session back.\npm.test('Status code is 404 for a number that was never contacted', function () {\n    pm.response.to.have.status(404);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response reports that the contact was not found', function () {\n    pm.expect(pm.response.json(), 'body').to.eql({ error: 'Contact not found' });\n});\n\npm.environment.unset(\"smooveApiWhatsAppUnknownCellPhone\");"]}}],"id":"b5bf6eeb-6ddd-4b33-8e0e-81c1038117a2","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveApiBaseURL}}/api/v1/whatsapp/contact/:cellphone/active","urlObject":{"path":["api","v1","whatsapp","contact",":cellphone","active"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiWhatsAppUnknownCellPhone}}","key":"cellphone"}]}},"response":[],"_postman_id":"b5bf6eeb-6ddd-4b33-8e0e-81c1038117a2"}],"id":"0e4d19cc-8838-4097-89c6-2fa4a2b75bf9","_postman_id":"0e4d19cc-8838-4097-89c6-2fa4a2b75bf9","description":""}],"id":"00e81dc5-2afc-4295-b658-bf75ee446dff","_postman_id":"00e81dc5-2afc-4295-b658-bf75ee446dff","description":""}],"id":"611ae85d-95dd-4503-a04c-7b640ee118f1","_postman_id":"611ae85d-95dd-4503-a04c-7b640ee118f1","description":""}],"id":"7edc3eb8-b608-4a40-a946-ca479889de96","_postman_id":"7edc3eb8-b608-4a40-a946-ca479889de96","description":""},{"name":"portal","item":[{"name":"categories","item":[{"name":"search","item":[{"name":"Categories Search","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number');\n    pm.expect(json.results, 'results').to.be.an('array');\n});\n\npm.test('Pagination values are consistent', function () {\n    const json = pm.response.json();\n    pm.expect(json.current, 'current').to.be.at.least(1);\n    pm.expect(json.size, 'size').to.be.at.least(json.results.length);\n    pm.expect(json.rows, 'rows').to.be.at.least(0);\n    pm.expect(json.pages, 'pages').to.be.at.least(0);\n    if (json.results.length > 0) {\n        pm.expect(json.results[0], 'first result').to.be.an('object');\n        pm.expect(json.results[0], 'missing id').to.have.property('id');\n        pm.expect(json.results[0].id, 'id').to.be.a('number').and.above(0);\n    }\n});"]}}],"id":"45460749-f02a-4746-89bf-f030e1adec94","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/search?IsDeleted=false&Page=1&PageSize=100","urlObject":{"path":["api","v1","portal","categories","search"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"IsDeleted","value":"false"},{"key":"Page","value":"1"},{"key":"PageSize","value":"100"}],"variable":[]}},"response":[],"_postman_id":"45460749-f02a-4746-89bf-f030e1adec94"}],"id":"6a15c5f0-53a0-4897-8b8c-ed03780cf78e","_postman_id":"6a15c5f0-53a0-4897-8b8c-ed03780cf78e","description":""},{"name":"{id}","item":[{"name":"Categories Update Category","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction uniqueSuffix() {\n    return Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst suffix = uniqueSuffix();\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/lists\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: { mode: \"raw\", raw: JSON.stringify({ name: \"postman_upd_list_\" + suffix, description: \"temp list for category update\" }) }\n});\nif (!listRes || listRes.code !== 200) {\n    throw new Error(\"Failed to create list for portal category update\");\n}\nconst listId = listRes.json().id;\npm.environment.set(\"smooveApiTempListId\", String(listId));\n\nconst catRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            isActive: true,\n            position: 0,\n            title: \"postman_upd_src_\" + suffix,\n            listId: Number(listId),\n            culture: \"he-IL\"\n        })\n    }\n});\nif (!catRes || catRes.code !== 200) {\n    throw new Error(\"Failed to create portal category for update test\");\n}\nconst categoryId = catRes.json().id;\nconst updatedTitle = \"postman_upd_\" + suffix;\npm.environment.set(\"smooveApiCategoryIdToUpdate\", String(categoryId));\npm.environment.set(\"smooveApiCategoryCreatedForUpdateTest\", \"true\");\npm.environment.set(\"smooveApiCategoryUpdateTitle\", updatedTitle);\n\npm.request.body.update(JSON.stringify({\n    isActive: true,\n    position: 0,\n    title: updatedTitle,\n    listId: Number(listId),\n    culture: \"he-IL\"\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    [\"id\",\"createdAt\",\"updatedAt\",\"isDeleted\",\"subscribersCount\",\"viewsCount\",\"position\",\"title\",\"listId\",\"isActive\",\"culture\"].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.createdAt, 'createdAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.createdAt)), 'createdAt parseable').to.eql(false);\n    pm.expect(json.updatedAt, 'updatedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.updatedAt)), 'updatedAt parseable').to.eql(false);\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.subscribersCount, 'subscribersCount').to.be.a('number');\n    pm.expect(json.viewsCount, 'viewsCount').to.be.a('number');\n    pm.expect(json.position, 'position').to.be.a('number');\n    pm.expect(json.title, 'title').to.be.a('string');\n    pm.expect(json.listId, 'listId').to.be.a('number');\n    pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n    pm.expect(json.culture, 'culture').to.be.a('string');\n});\n\npm.test('Updated category echoes request title', function () {\n    const json = pm.response.json();\n    const expectedId = Number(pm.environment.get(\"smooveApiCategoryIdToUpdate\"));\n    const expectedTitle = pm.environment.get(\"smooveApiCategoryUpdateTitle\");\n    const expectedListId = Number(pm.environment.get(\"smooveApiTempListId\"));\n    pm.expect(json.id, 'id').to.eql(expectedId);\n    pm.expect(json.title, 'title').to.eql(expectedTitle);\n    pm.expect(json.listId, 'listId').to.eql(expectedListId);\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n    pm.expect(json.isActive, 'isActive').to.eql(true);\n});\n\nasync function cleanUp() {\n    if (pm.environment.get(\"smooveApiCategoryCreatedForUpdateTest\") !== \"true\") {\n        pm.environment.unset(\"smooveApiCategoryCreatedForUpdateTest\");\n        return;\n    }\n\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const categoryId = pm.environment.get(\"smooveApiCategoryIdToUpdate\");\n    const listId = pm.environment.get(\"smooveApiTempListId\");\n\n    async function deleteList() {\n        if (!listId) return;\n        await pm.sendRequest({\n            url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\",\n            method: \"DELETE\",\n            header: { \"Cookie\": `jvlpsi=${cookie};` }\n        });\n        pm.environment.unset(\"smooveApiTempListId\");\n    }\n\n    if (!categoryId) {\n        await deleteList();\n        return;\n    }\n\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/portal/categories/\" + categoryId,\n        method: \"DELETE\",\n        header: { \"Cookie\": `jvlpsi=${cookie};` }\n    });\n    pm.test(\"Cleanup: portal category deleted successfully\", function () {\n        pm.expect([200, 204, 404, 500]).to.include(cleanupRes.code);\n    });\n    await deleteList();\n    pm.environment.unset(\"smooveApiCategoryCreatedForUpdateTest\");\n}\n\nawait cleanUp();"]}}],"id":"97db70f5-fa31-43f5-bd01-884ec3a3af20","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"isActive\": true,\n  \"position\": 0,\n  \"title\": \"postman_category_placeholder\",\n  \"listId\": 0,\n  \"culture\": \"he-IL\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/:id","urlObject":{"path":["api","v1","portal","categories",":id"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiCategoryIdToUpdate}}","key":"id"}]}},"response":[],"_postman_id":"97db70f5-fa31-43f5-bd01-884ec3a3af20"},{"name":"Categories Get Category By Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/lists\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({ name: \"postman_cat_get_list_\" + ts, description: \"temp\" })\n    }\n});\nconst listId = listRes.json().id;\npm.environment.set(\"smooveApiTempListId\", String(listId));\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            isActive: true,\n            position: 0,\n            title: \"postman_category_get_\" + ts,\n            listId: Number(listId),\n            culture: \"he-IL\"\n        })\n    }\n});\nconst categoryId = createRes.json().id;\npm.environment.set(\"smooveApiCategoryId\", String(categoryId));\npm.environment.set(\"smooveApiCategoryGetTitle\", createRes.json().title);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    // listId is present for categories created with a list; some legacy rows omit it.\n    ['id', 'createdAt', 'updatedAt', 'isDeleted', 'subscribersCount', 'viewsCount', 'position', 'title', 'listId', 'isActive', 'culture', 'isHebCulture'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.createdAt, 'createdAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.createdAt)), 'createdAt parseable').to.eql(false);\n    pm.expect(json.updatedAt, 'updatedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.updatedAt)), 'updatedAt parseable').to.eql(false);\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.subscribersCount, 'subscribersCount').to.be.a('number');\n    pm.expect(json.viewsCount, 'viewsCount').to.be.a('number');\n    pm.expect(json.position, 'position').to.be.a('number');\n    pm.expect(json.title, 'title').to.be.a('string');\n    pm.expect(json.listId, 'listId').to.be.a('number');\n    pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n    pm.expect(json.culture, 'culture').to.be.a('string');\n    pm.expect(json.isHebCulture, 'isHebCulture').to.be.a('boolean');\n});\n\npm.test('Category identity echoes created category', function () {\n    const json = pm.response.json();\n    const expectedId = Number(pm.environment.get(\"smooveApiCategoryId\"));\n    const expectedListId = Number(pm.environment.get(\"smooveApiTempListId\"));\n    const expectedTitle = pm.environment.get(\"smooveApiCategoryGetTitle\");\n    pm.expect(json.id, 'id').to.eql(expectedId);\n    pm.expect(json.listId, 'listId').to.eql(expectedListId);\n    pm.expect(json.title, 'title').to.eql(expectedTitle);\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n    pm.expect(json.isHebCulture, 'isHebCulture').to.eql(true);\n});\n\nasync function followUpAndCleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const categoryId = pm.environment.get(\"smooveApiCategoryId\");\n    const listId = pm.environment.get(\"smooveApiTempListId\");\n    function send(opts) {\n        return new Promise(function (resolve, reject) {\n            pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n        });\n    }\n    if (categoryId) {\n        await send({\n            url: baseUrl + \"/api/v1/portal/categories/\" + categoryId,\n            method: \"DELETE\",\n            header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" }\n        });\n    }\n    if (listId) {\n        await send({\n            url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\",\n            method: \"DELETE\",\n            header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" }\n        });\n    }\n    [\"smooveApiCategoryId\", \"smooveApiTempListId\", \"smooveApiCategoryGetTitle\"].forEach(function (k) {\n        pm.environment.unset(k);\n    });\n}\n\nawait followUpAndCleanUp();"]}}],"id":"64f16144-8b15-4dab-a1cd-dc4821de8236","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/{{smooveApiCategoryId}}","urlObject":{"path":["api","v1","portal","categories","{{smooveApiCategoryId}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"64f16144-8b15-4dab-a1cd-dc4821de8236"},{"name":"Categories Delete","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n    });\n}\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/lists\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            name: \"postman_cat_del_list_\" + ts,\n            description: \"temp list for category delete\"\n        })\n    }\n});\nif (!listRes || listRes.code !== 200) throw new Error(\"Failed to create list for category delete\");\nconst listId = listRes.json().id;\npm.environment.set(\"smooveApiTempListId\", String(listId));\n\nconst createRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            isActive: true,\n            position: 0,\n            title: \"postman_category_delete_\" + ts,\n            listId: Number(listId),\n            culture: \"he-IL\"\n        })\n    }\n});\nif (!createRes || createRes.code !== 200) throw new Error(\"Failed to create category for delete\");\nconst categoryId = createRes.json().id;\npm.environment.set(\"smooveApiCategoryIdToDelete\", String(categoryId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Deleted category id was prepared', function () {\n    pm.expect(Number(pm.environment.get('smooveApiCategoryIdToDelete') || 0)).to.be.above(0);\n});\n\npm.test('Delete response reports the deleted category', function () {\n    const json = pm.response.json();\n    const expectedId = Number(pm.environment.get('smooveApiCategoryIdToDelete'));\n    if (json && typeof json === 'object' && !Array.isArray(json) && json.id != null) {\n        pm.expect(Number(json.id), 'id').to.eql(expectedId);\n        if (json.isDeleted !== undefined) {\n            pm.expect(json.isDeleted, 'isDeleted').to.eql(true);\n        }\n    } else {\n        pm.expect(json === null || typeof json === 'object').to.eql(true);\n    }\n});\n\nasync function followUpAndCleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const categoryId = pm.environment.get(\"smooveApiCategoryIdToDelete\");\n    const listId = pm.environment.get(\"smooveApiTempListId\");\n    function send(opts) {\n        return new Promise(function (resolve, reject) {\n            pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n        });\n    }\n    if (categoryId) {\n        const getRes = await send({\n            url: baseUrl + \"/api/v1/portal/categories/\" + categoryId,\n            method: \"GET\",\n            header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\", \"Accept\": \"application/json\" }\n        });\n        pm.test('Follow-up GET shows category deleted or gone', function () {\n            if (getRes.code === 200) {\n                pm.expect(getRes.json().isDeleted, 'isDeleted').to.eql(true);\n            } else {\n                pm.expect([404, 400]).to.include(getRes.code);\n            }\n        });\n    }\n    if (listId) {\n        await send({\n            url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\",\n            method: \"DELETE\",\n            header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\" }\n        });\n        pm.environment.unset(\"smooveApiTempListId\");\n    }\n}\n\nawait followUpAndCleanUp();"]}}],"id":"034b240b-ef35-4aaa-8458-1adb8ccaf6b2","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/{{smooveApiCategoryIdToDelete}}","urlObject":{"path":["api","v1","portal","categories","{{smooveApiCategoryIdToDelete}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"034b240b-ef35-4aaa-8458-1adb8ccaf6b2"}],"id":"38afd04d-16db-48e1-ab0c-f2a178fa66ac","_postman_id":"38afd04d-16db-48e1-ab0c-f2a178fa66ac","description":""},{"name":"create-portal-list","item":[{"name":"Categories Create Portal List","event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'isActive', 'contactsCount', 'isPublic', 'isPortal', 'isDynamic', 'isEvaluationInProgress', 'allowRegistration', 'isAttachedToBusinessJourney'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n    pm.expect(json.contactsCount, 'contactsCount').to.be.a('number');\n    pm.expect(json.isPublic, 'isPublic').to.be.a('boolean');\n    pm.expect(json.isPortal, 'isPortal').to.be.a('boolean');\n    pm.expect(json.isDynamic, 'isDynamic').to.be.a('boolean');\n    pm.expect(json.isEvaluationInProgress, 'isEvaluationInProgress').to.be.a('boolean');\n    pm.expect(json.allowRegistration, 'allowRegistration').to.be.a('boolean');\n    pm.expect(json.isAttachedToBusinessJourney, 'isAttachedToBusinessJourney').to.be.a('boolean');\n});\n\npm.test('Created portal list has valid identity fields', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.isActive, 'isActive').to.eql(true);\n    pm.expect(json.contactsCount, 'contactsCount').to.eql(0);\n    // Live DEV create-portal-list currently returns isPortal/allowRegistration as false\n    // even when requested true — assert stable returned flags only.\n    pm.expect(json.isPublic, 'isPublic').to.eql(false);\n    pm.expect(json.isDynamic, 'isDynamic').to.eql(false);\n    pm.expect(json.isAttachedToBusinessJourney, 'isAttachedToBusinessJourney').to.eql(false);\n});\n\n\n// Cleanup created resource so the next daily run starts clean\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    let cleanupId;\n    try {\n        cleanupId = (Number(pm.response.json().id));\n    } catch (e) {\n        cleanupId = null;\n    }\n\n    if (!cleanupId) {\n        pm.test(\"Cleanup skipped: could not resolve portal list id\", function () {\n            pm.expect.fail(\"Missing portal list id for cleanup\");\n        });\n        return;\n    }\n\n    const cleanupRes = await pm.sendRequest({\n        url: `${baseUrl}/api/v1/lists/${cleanupId}?deleteContacts=false`,\n        method: \"DELETE\",\n        header: {\n            \"Cookie\": `jvlpsi=${cookie};`,\n            \"Accept\": \"application/json\",\n            \"Content-Type\": \"application/json\"\n        }\n    });\n    pm.test(\"Cleanup: portal list deleted successfully\", function () {\n        pm.expect([200, 204]).to.include(cleanupRes.code);\n    });\n\n}\n\nawait cleanUp();"]}},{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction uniqueSuffix() {\n    return Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst suffix = uniqueSuffix();\npm.request.body.update(JSON.stringify({\n    isActive: true,\n    contactsCount: 0,\n    isPublic: false,\n    isPortal: true,\n    isDynamic: false,\n    isEvaluationInProgress: false,\n    allowRegistration: true,\n    name: \"postman_portal_list_\" + suffix\n}));"]}}],"id":"abebc0d4-10c2-410a-bb61-994982c724cf","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"isActive\": true,\n  \"contactsCount\": 0,\n  \"isPublic\": false,\n  \"isPortal\": true,\n  \"isDynamic\": false,\n  \"isEvaluationInProgress\": false,\n  \"allowRegistration\": true,\n  \"name\": \"postman_portal_list_1795356427\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/create-portal-list","urlObject":{"path":["api","v1","portal","categories","create-portal-list"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"abebc0d4-10c2-410a-bb61-994982c724cf"}],"id":"3467b42e-40a1-433b-8af9-4c830105f98e","_postman_id":"3467b42e-40a1-433b-8af9-4c830105f98e","description":""},{"name":"count","item":[{"name":"Categories Get Total Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const listRes = await pm.sendRequest({\n    url: pm.environment.get(\"smooveApiBaseURL\") + \"/api/v1/portal/categories/search?IsDeleted=false&Page=1&PageSize=1\",\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + pm.environment.get(\"smooveApiCookie\") + \";\" }\n});\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative integer', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isInteger(value), 'integer').to.eql(true);\n    pm.expect(value, 'category count').to.be.at.least(0);\n});\n\npm.test('Count equals the total rows of the portal categories list', function () {\n    pm.expect(listRes.code, 'list status').to.eql(200);\n    pm.expect(pm.response.json(), 'count').to.eql(listRes.json().rows);\n});"]}}],"id":"7c3e8607-aa9d-4908-8bec-d2a82ff7f25b","request":{"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"text"}}},"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/count","urlObject":{"path":["api","v1","portal","categories","count"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7c3e8607-aa9d-4908-8bec-d2a82ff7f25b"}],"id":"af54e4c6-a6aa-446e-9708-085d725ea993","_postman_id":"af54e4c6-a6aa-446e-9708-085d725ea993","description":""},{"name":"moveCategory","item":[{"name":"{id}","item":[{"name":"{position}","item":[{"name":"Categories Move Category","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\n\n// Own the category under test: a throwaway list plus a category on it, never an existing one.\nasync function createCategory(label) {\n    const suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: \"postman_\" + label + \"_list_\" + suffix, description: \"temp\" });\n    pm.expect(listRes.code, \"create list\").to.eql(200);\n    const listId = listRes.json().id;\n    pm.environment.set(\"smooveApiPortalSeedListId\", String(listId));\n\n    const categoryRes = await call(\"POST\", baseUrl + \"/api/v1/portal/categories\", {\n        isActive: true,\n        position: 0,\n        title: \"postman_\" + label + \"_\" + suffix,\n        listId: listId,\n        culture: \"he-IL\"\n    });\n    pm.expect(categoryRes.code, \"create category\").to.eql(200);\n    const categoryId = categoryRes.json().id;\n    pm.expect(categoryId, \"created category id\").to.be.a(\"number\").and.above(0);\n    pm.environment.set(\"smooveApiPortalSeedCategoryId\", String(categoryId));\n    return categoryId;\n}\n\nconst categoryId = await createCategory(\"move\");\nconst beforeRes = await call(\"GET\", baseUrl + \"/api/v1/portal/categories/\" + categoryId);\npm.expect(beforeRes.code, \"get seeded category\").to.eql(200);\nconst initialPosition = beforeRes.json().position;\npm.environment.set(\"smooveApiPortalInitialPosition\", String(initialPosition));\npm.environment.set(\"smooveApiPortalMovePosition\", String(initialPosition + 1));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\nasync function deleteSeedCategoryAndList() {\n    const categoryId = pm.environment.get(\"smooveApiPortalSeedCategoryId\");\n    const listId = pm.environment.get(\"smooveApiPortalSeedListId\");\n    return [\n        [\"category\", await call(\"DELETE\", baseUrl + \"/api/v1/portal/categories/\" + categoryId)],\n        [\"list\", await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\")]\n    ];\n}\n\nconst categoryId = Number(pm.environment.get(\"smooveApiPortalSeedCategoryId\"));\nconst getRes = await call(\"GET\", baseUrl + \"/api/v1/portal/categories/\" + categoryId);\nconst cleanup = await deleteSeedCategoryAndList();\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    pm.expect(pm.response.text().trim(), 'empty body').to.eql('');\n});\n\npm.test('Follow-up GET shows the seeded category after the move', function () {\n    pm.expect(getRes.code, 'get status').to.eql(200);\n    const json = getRes.json();\n    pm.expect(json.id, 'id').to.eql(categoryId);\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n    pm.expect(json.position, 'position').to.eql(Number(pm.environment.get(\"smooveApiPortalMovePosition\")));\n    pm.expect(json.position, 'position changed').to.not.eql(Number(pm.environment.get(\"smooveApiPortalInitialPosition\")));\n});\n\npm.test(\"Cleanup: seeded category and list deleted\", function () {\n    cleanup.forEach(function (entry) {\n        pm.expect(entry[1].code, \"delete \" + entry[0]).to.be.oneOf([200, 204]);\n    });\n});\n\n[\"smooveApiPortalSeedCategoryId\", \"smooveApiPortalSeedListId\", \"smooveApiPortalMovePosition\", \"smooveApiPortalInitialPosition\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"e0cbc2ef-46bb-4bc7-b14c-36a156d31c5d","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[],"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/moveCategory/{{smooveApiPortalSeedCategoryId}}/{{smooveApiPortalMovePosition}}","urlObject":{"path":["api","v1","portal","categories","moveCategory","{{smooveApiPortalSeedCategoryId}}","{{smooveApiPortalMovePosition}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e0cbc2ef-46bb-4bc7-b14c-36a156d31c5d"}],"id":"de1bf1cf-bae1-4f98-9ff4-50f6f7d68a53","_postman_id":"de1bf1cf-bae1-4f98-9ff4-50f6f7d68a53","description":""}],"id":"c8389e0f-74ff-415d-97ae-28b9c3adf6f0","_postman_id":"c8389e0f-74ff-415d-97ae-28b9c3adf6f0","description":""}],"id":"c68d8313-6859-4e67-b5eb-f494dfb96f05","_postman_id":"c68d8313-6859-4e67-b5eb-f494dfb96f05","description":""},{"name":"isAllowedToCreateAnotherList","item":[{"name":"Categories Is Allowed To Create Another List","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a boolean', function () {\n    pm.expect(pm.response.json()).to.be.a('boolean');\n});"]}}],"id":"d0eeda60-dbe8-4a27-80f2-76f64f8a9383","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/isAllowedToCreateAnotherList","urlObject":{"path":["api","v1","portal","categories","isAllowedToCreateAnotherList"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d0eeda60-dbe8-4a27-80f2-76f64f8a9383"}],"id":"5df53aff-aaea-40f9-bd0e-45eec46109da","_postman_id":"5df53aff-aaea-40f9-bd0e-45eec46109da","description":""},{"name":"isAllowedToCreateAnotherCategory","item":[{"name":"Categories Is Allowed To Create Another Category","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a boolean', function () {\n    pm.expect(pm.response.json()).to.be.a('boolean');\n});"]}}],"id":"3ae36dc5-504e-4ecd-9346-32486c9e6dd5","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/isAllowedToCreateAnotherCategory","urlObject":{"path":["api","v1","portal","categories","isAllowedToCreateAnotherCategory"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3ae36dc5-504e-4ecd-9346-32486c9e6dd5"}],"id":"fd9a8a5d-1cbb-4844-92e9-8353f6183bbf","_postman_id":"fd9a8a5d-1cbb-4844-92e9-8353f6183bbf","description":""},{"name":"duplicate","item":[{"name":"{id}","item":[{"name":"Categories Duplicate Category","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction uniqueSuffix() {\n    return Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst suffix = uniqueSuffix();\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/lists\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            name: \"postman_dup_list_\" + suffix,\n            description: \"temp\"\n        })\n    }\n});\nconst listId = listRes.json().id;\npm.environment.set(\"smooveApiTempListId\", listId);\n\nconst catRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            isActive: true,\n            position: 0,\n            title: \"postman_dup_src_\" + suffix,\n            listId: Number(listId),\n            culture: \"he-IL\"\n        })\n    }\n});\nconst categoryId = catRes.json().id;\npm.environment.set(\"smooveApiCategoryIdToDuplicate\", categoryId);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    [\"id\",\"createdAt\",\"updatedAt\",\"isDeleted\",\"subscribersCount\",\"viewsCount\",\"position\",\"title\",\"listId\",\"isActive\",\"culture\"].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.createdAt, 'createdAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.createdAt)), 'createdAt parseable').to.eql(false);\n    pm.expect(json.updatedAt, 'updatedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.updatedAt)), 'updatedAt parseable').to.eql(false);\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.subscribersCount, 'subscribersCount').to.be.a('number');\n    pm.expect(json.viewsCount, 'viewsCount').to.be.a('number');\n    pm.expect(json.position, 'position').to.be.a('number');\n    pm.expect(json.title, 'title').to.be.a('string');\n    pm.expect(json.listId, 'listId').to.be.a('number');\n    pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n    pm.expect(json.culture, 'culture').to.be.a('string');\n});\n\npm.test('Duplicated category has a new positive id', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.title, 'title').to.be.a('string').and.not.equal('');\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const sourceId = pm.environment.get(\"smooveApiCategoryIdToDuplicate\");\n    const listId = pm.environment.get(\"smooveApiTempListId\");\n    const duplicatedId = pm.response.json() && pm.response.json().id;\n\n    async function deleteCategory(id, label) {\n        if (!id) return;\n        const deleteRes = await pm.sendRequest({\n            url: baseUrl + \"/api/v1/portal/categories/\" + id,\n            method: \"DELETE\",\n            header: { \"Cookie\": `jvlpsi=${cookie};` }\n        });\n        pm.test(\"Cleanup: \" + label + \" deleted successfully\", function () {\n            pm.expect([200, 204, 404, 500]).to.include(deleteRes.code);\n        });\n    }\n\n    async function deleteList() {\n        if (!listId) return;\n        await pm.sendRequest({\n            url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\",\n            method: \"DELETE\",\n            header: { \"Cookie\": `jvlpsi=${cookie};` }\n        });\n        pm.environment.unset(\"smooveApiTempListId\");\n        pm.environment.unset(\"smooveApiCategoryIdToDuplicate\");\n    }\n\n    await deleteCategory(duplicatedId, \"duplicated portal category\");\n    await deleteCategory(sourceId, \"source portal category\");\n    await deleteList();\n}\n\nawait cleanUp();"]}}],"id":"b7b39af5-ae34-4d9d-86a7-38f6d5d77b90","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"copyText\": \" (Postman copy)\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/duplicate/:id","urlObject":{"path":["api","v1","portal","categories","duplicate",":id"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiCategoryIdToDuplicate}}","key":"id"}]}},"response":[],"_postman_id":"b7b39af5-ae34-4d9d-86a7-38f6d5d77b90"}],"id":"4d1c79b6-86c7-4d09-bc49-317c3d769ac0","_postman_id":"4d1c79b6-86c7-4d09-bc49-317c3d769ac0","description":""}],"id":"6774de3c-1545-4c3b-b9f9-819d884f4c95","_postman_id":"6774de3c-1545-4c3b-b9f9-819d884f4c95","description":""},{"name":"restore","item":[{"name":"Categories Restore","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\n\n// Own the category under test: a throwaway list plus a category on it, never an existing one.\nasync function createCategory(label) {\n    const suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: \"postman_\" + label + \"_list_\" + suffix, description: \"temp\" });\n    pm.expect(listRes.code, \"create list\").to.eql(200);\n    const listId = listRes.json().id;\n    pm.environment.set(\"smooveApiPortalSeedListId\", String(listId));\n\n    const categoryRes = await call(\"POST\", baseUrl + \"/api/v1/portal/categories\", {\n        isActive: true,\n        position: 0,\n        title: \"postman_\" + label + \"_\" + suffix,\n        listId: listId,\n        culture: \"he-IL\"\n    });\n    pm.expect(categoryRes.code, \"create category\").to.eql(200);\n    const categoryId = categoryRes.json().id;\n    pm.expect(categoryId, \"created category id\").to.be.a(\"number\").and.above(0);\n    pm.environment.set(\"smooveApiPortalSeedCategoryId\", String(categoryId));\n    return categoryId;\n}\n\nconst categoryId = await createCategory(\"restore\");\nconst deleteRes = await call(\"DELETE\", baseUrl + \"/api/v1/portal/categories/\" + categoryId);\npm.expect(deleteRes.code, \"soft-delete seeded category\").to.eql(200);\n\npm.request.body.update(JSON.stringify({ ids: [categoryId] }));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\nasync function deleteSeedCategoryAndList() {\n    const categoryId = pm.environment.get(\"smooveApiPortalSeedCategoryId\");\n    const listId = pm.environment.get(\"smooveApiPortalSeedListId\");\n    return [\n        [\"category\", await call(\"DELETE\", baseUrl + \"/api/v1/portal/categories/\" + categoryId)],\n        [\"list\", await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\")]\n    ];\n}\n\nconst categoryId = Number(pm.environment.get(\"smooveApiPortalSeedCategoryId\"));\nconst getRes = await call(\"GET\", baseUrl + \"/api/v1/portal/categories/\" + categoryId);\nconst cleanup = await deleteSeedCategoryAndList();\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Restore response is the seeded category, not deleted', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'restored categories').to.eql(1);\n    pm.expect(json[0].id, 'id').to.eql(categoryId);\n    pm.expect(json[0].isDeleted, 'isDeleted').to.eql(false);\n});\n\npm.test('Follow-up GET shows category restored (not deleted)', function () {\n    pm.expect(getRes.code, 'get status').to.eql(200);\n    pm.expect(getRes.json().id, 'id').to.eql(categoryId);\n    pm.expect(getRes.json().isDeleted, 'isDeleted').to.eql(false);\n});\n\npm.test(\"Cleanup: seeded category and list deleted\", function () {\n    cleanup.forEach(function (entry) {\n        pm.expect(entry[1].code, \"delete \" + entry[0]).to.be.oneOf([200, 204]);\n    });\n});\n\n[\"smooveApiPortalSeedCategoryId\", \"smooveApiPortalSeedListId\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"cedbe5e9-3d9d-4185-a3a6-d13ef9bd58f5","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"ids\": [\n  ]\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/restore","urlObject":{"path":["api","v1","portal","categories","restore"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"cedbe5e9-3d9d-4185-a3a6-d13ef9bd58f5"}],"id":"b139af67-8191-4f85-9c16-c329f381a419","_postman_id":"b139af67-8191-4f85-9c16-c329f381a419","description":""},{"name":"usage","item":[{"name":"Categories Get Category Usage","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['active', 'deleted', 'total'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n});\n\npm.test('Usage totals are consistent', function () {\n    const json = pm.response.json();\n    pm.expect(json.active, 'active').to.be.at.least(0);\n    pm.expect(json.deleted, 'deleted').to.be.at.least(0);\n    pm.expect(json.total, 'total').to.eql(json.active + json.deleted);\n});"]}}],"id":"e11328f4-c8cd-478c-81de-c8a02fabd99d","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/usage","urlObject":{"path":["api","v1","portal","categories","usage"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e11328f4-c8cd-478c-81de-c8a02fabd99d"}],"id":"355df00e-c46c-478f-979a-5a147790dbeb","_postman_id":"355df00e-c46c-478f-979a-5a147790dbeb","description":""},{"name":"get-revealType","item":[{"name":"{id}","item":[{"name":"Categories Get Category Reveal Type By Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\n\n// Own the category under test: a throwaway list plus a category on it, with a known reveal type.\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\nconst listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: \"postman_reveal_get_list_\" + suffix, description: \"temp\" });\npm.expect(listRes.code, \"create list\").to.eql(200);\nconst listId = listRes.json().id;\npm.environment.set(\"smooveApiPortalSeedListId\", String(listId));\n\nconst categoryRes = await call(\"POST\", baseUrl + \"/api/v1/portal/categories\", {\n    isActive: true,\n    position: 0,\n    title: \"postman_reveal_get_\" + suffix,\n    listId: listId,\n    culture: \"he-IL\"\n});\npm.expect(categoryRes.code, \"create category\").to.eql(200);\nconst categoryId = categoryRes.json().id;\npm.expect(categoryId, \"created category id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiPortalSeedCategoryId\", String(categoryId));\n\nconst updateRes = await call(\"PUT\", baseUrl + \"/api/v1/portal/categories/update-revealType/\" + categoryId + \"?revealType=GroupJoin\");\npm.expect(updateRes.code, \"set reveal type\").to.eql(200);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\nconst categoryId = pm.environment.get(\"smooveApiPortalSeedCategoryId\");\nconst listId = pm.environment.get(\"smooveApiPortalSeedListId\");\nconst categoryDelete = await call(\"DELETE\", baseUrl + \"/api/v1/portal/categories/\" + categoryId);\nconst listDelete = await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\");\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is the reveal type that was set on the seeded category', function () {\n    pm.expect(pm.response.json(), 'reveal type').to.eql('GroupJoin');\n});\n\npm.test(\"Cleanup: seeded category and list deleted\", function () {\n    pm.expect(categoryDelete.code, \"delete category\").to.be.oneOf([200, 204]);\n    pm.expect(listDelete.code, \"delete list\").to.be.oneOf([200, 204]);\n});\n\n[\"smooveApiPortalSeedCategoryId\", \"smooveApiPortalSeedListId\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"6129030e-c136-4073-9c15-0d8e770594ce","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/get-revealType/{{smooveApiPortalSeedCategoryId}}","urlObject":{"path":["api","v1","portal","categories","get-revealType","{{smooveApiPortalSeedCategoryId}}"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6129030e-c136-4073-9c15-0d8e770594ce"}],"id":"f27af5f6-457d-47c5-af61-9f4d5a785d5d","_postman_id":"f27af5f6-457d-47c5-af61-9f4d5a785d5d","description":""}],"id":"11d26722-9d3f-4c7a-b5ea-0b42a482ab6f","_postman_id":"11d26722-9d3f-4c7a-b5ea-0b42a482ab6f","description":""},{"name":"update-revealType","item":[{"name":"{id}","item":[{"name":"Categories Update Reveal Type","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\n\n// Own the category under test: a throwaway list plus a category on it, never an existing one.\nasync function createCategory(label) {\n    const suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: \"postman_\" + label + \"_list_\" + suffix, description: \"temp\" });\n    pm.expect(listRes.code, \"create list\").to.eql(200);\n    const listId = listRes.json().id;\n    pm.environment.set(\"smooveApiPortalSeedListId\", String(listId));\n\n    const categoryRes = await call(\"POST\", baseUrl + \"/api/v1/portal/categories\", {\n        isActive: true,\n        position: 0,\n        title: \"postman_\" + label + \"_\" + suffix,\n        listId: listId,\n        culture: \"he-IL\"\n    });\n    pm.expect(categoryRes.code, \"create category\").to.eql(200);\n    const categoryId = categoryRes.json().id;\n    pm.expect(categoryId, \"created category id\").to.be.a(\"number\").and.above(0);\n    pm.environment.set(\"smooveApiPortalSeedCategoryId\", String(categoryId));\n    return categoryId;\n}\n\nawait createCategory(\"reveal\");"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\nasync function deleteSeedCategoryAndList() {\n    const categoryId = pm.environment.get(\"smooveApiPortalSeedCategoryId\");\n    const listId = pm.environment.get(\"smooveApiPortalSeedListId\");\n    return [\n        [\"category\", await call(\"DELETE\", baseUrl + \"/api/v1/portal/categories/\" + categoryId)],\n        [\"list\", await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\")]\n    ];\n}\n\nconst categoryId = pm.environment.get(\"smooveApiPortalSeedCategoryId\");\nconst revealRes = await call(\"GET\", baseUrl + \"/api/v1/portal/categories/get-revealType/\" + categoryId);\nconst cleanup = await deleteSeedCategoryAndList();\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    pm.expect(pm.response.text().trim(), 'empty body').to.eql('');\n});\n\npm.test('Follow-up GET returns the reveal type that was set', function () {\n    pm.expect(revealRes.code, 'get status').to.eql(200);\n    pm.expect(revealRes.json(), 'reveal type').to.eql('GroupJoin');\n});\n\npm.test(\"Cleanup: seeded category and list deleted\", function () {\n    cleanup.forEach(function (entry) {\n        pm.expect(entry[1].code, \"delete \" + entry[0]).to.be.oneOf([200, 204]);\n    });\n});\n\n[\"smooveApiPortalSeedCategoryId\", \"smooveApiPortalSeedListId\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"ec202ab1-201d-4ec1-9862-4a9aa9a81186","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[],"url":"{{smooveApiBaseURL}}/api/v1/portal/categories/update-revealType/:id?revealType=GroupJoin","urlObject":{"path":["api","v1","portal","categories","update-revealType",":id"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"revealType","value":"GroupJoin"}],"variable":[{"type":"any","value":"{{smooveApiPortalSeedCategoryId}}","key":"id"}]}},"response":[],"_postman_id":"ec202ab1-201d-4ec1-9862-4a9aa9a81186"}],"id":"46d41b1c-3ece-4062-b3a4-0d7094d5b1b5","_postman_id":"46d41b1c-3ece-4062-b3a4-0d7094d5b1b5","description":""}],"id":"c2157914-7943-4b2f-8c28-205e296516e2","_postman_id":"c2157914-7943-4b2f-8c28-205e296516e2","description":""},{"name":"Categories Add Category","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction uniqueSuffix() {\n    return Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst suffix = uniqueSuffix();\n\nconst listRes = await send({\n    url: baseUrl + \"/api/v1/lists\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    },\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            name: \"postman_portal_list_\" + suffix,\n            description: \"temp list for portal category\"\n        })\n    }\n});\nif (!listRes || listRes.code !== 200) {\n    throw new Error(\"Failed to create list for portal category\");\n}\nconst listId = listRes.json().id;\npm.environment.set(\"smooveApiTempListId\", listId);\n\npm.request.body.update(JSON.stringify({\n    isActive: true,\n    position: 0,\n    title: \"postman_category_\" + suffix,\n    listId: Number(listId),\n    culture: \"he-IL\"\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    [\"id\",\"createdAt\",\"updatedAt\",\"isDeleted\",\"subscribersCount\",\"viewsCount\",\"position\",\"title\",\"listId\",\"isActive\",\"culture\"].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.createdAt, 'createdAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.createdAt)), 'createdAt parseable').to.eql(false);\n    pm.expect(json.updatedAt, 'updatedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.updatedAt)), 'updatedAt parseable').to.eql(false);\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n    pm.expect(json.subscribersCount, 'subscribersCount').to.be.a('number');\n    pm.expect(json.viewsCount, 'viewsCount').to.be.a('number');\n    pm.expect(json.position, 'position').to.be.a('number');\n    pm.expect(json.title, 'title').to.be.a('string');\n    pm.expect(json.listId, 'listId').to.be.a('number');\n    pm.expect(json.isActive, 'isActive').to.be.a('boolean');\n    pm.expect(json.culture, 'culture').to.be.a('string');\n});\n\npm.test('Created category echoes request identity', function () {\n    const json = pm.response.json();\n    const expectedListId = Number(pm.environment.get(\"smooveApiTempListId\"));\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.title, 'title').to.be.a('string').and.include('postman_category_');\n    pm.expect(json.listId, 'listId').to.eql(expectedListId);\n    pm.expect(json.isActive, 'isActive').to.eql(true);\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n    pm.expect(json.culture, 'culture').to.eql('he-IL');\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const categoryId = pm.response.json() && pm.response.json().id;\n    const listId = pm.environment.get(\"smooveApiTempListId\");\n\n    async function deleteList() {\n        if (!listId) return;\n        await pm.sendRequest({\n            url: baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\",\n            method: \"DELETE\",\n            header: { \"Cookie\": `jvlpsi=${cookie};` }\n        });\n        pm.environment.unset(\"smooveApiTempListId\");\n    }\n\n    if (!categoryId) {\n        pm.test(\"Cleanup skipped: could not resolve category id\", function () {\n            pm.expect.fail(\"Missing category id for cleanup\");\n        });\n        await deleteList();\n        return;\n    }\n\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/portal/categories/\" + categoryId,\n        method: \"DELETE\",\n        header: { \"Cookie\": `jvlpsi=${cookie};` }\n    });\n    pm.test(\"Cleanup: portal category deleted successfully\", function () {\n        pm.expect([200, 204, 404, 500]).to.include(cleanupRes.code);\n    });\n    await deleteList();\n}\n\nawait cleanUp();"]}}],"id":"f44bbdcb-04ec-469a-bf0a-2e2e62b1bf7b","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"isActive\": true,\n  \"position\": 0,\n  \"title\": \"\",\n  \"listId\": 0,\n  \"culture\": \"he-IL\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/portal/categories","urlObject":{"path":["api","v1","portal","categories"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f44bbdcb-04ec-469a-bf0a-2e2e62b1bf7b"}],"id":"a27f7acc-8028-49e3-abb1-bdd43c572693","_postman_id":"a27f7acc-8028-49e3-abb1-bdd43c572693","description":""},{"name":"contentManagement","item":[{"name":"getModules","item":[{"name":"{categoryId}","item":[{"name":"Content Management Get Modules","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\n// Own the category under test: a throwaway list plus a category on it, never an existing one.\nasync function createCategory(label) {\n    const listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: \"postman_\" + label + \"_list_\" + suffix, description: \"temp\" });\n    pm.expect(listRes.code, \"create list\").to.eql(200);\n    const listId = listRes.json().id;\n    pm.environment.set(\"smooveApiPortalSeedListId\", String(listId));\n\n    const categoryRes = await call(\"POST\", baseUrl + \"/api/v1/portal/categories\", {\n        isActive: true,\n        position: 0,\n        title: \"postman_\" + label + \"_\" + suffix,\n        listId: listId,\n        culture: \"he-IL\"\n    });\n    pm.expect(categoryRes.code, \"create category\").to.eql(200);\n    const categoryId = categoryRes.json().id;\n    pm.expect(categoryId, \"created category id\").to.be.a(\"number\").and.above(0);\n    pm.environment.set(\"smooveApiPortalSeedCategoryId\", String(categoryId));\n    return categoryId;\n}\n\nasync function createModule(categoryId) {\n    const res = await call(\"POST\", baseUrl + \"/api/v1/portal/contentManagement/addModule\", {\n        categoryId: categoryId,\n        name: \"Postman module \" + suffix,\n        position: 0,\n        isDeleted: false\n    });\n    pm.expect(res.code, \"create module\").to.eql(200);\n    const moduleId = res.json().id;\n    pm.expect(moduleId, \"created module id\").to.be.a(\"number\").and.above(0);\n    pm.environment.set(\"smooveApiPortalSeedModuleId\", String(moduleId));\n    return moduleId;\n}\n\nconst categoryId = await createCategory(\"modules\");\nawait createModule(categoryId);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\nconst moduleId = Number(pm.environment.get(\"smooveApiPortalSeedModuleId\"));\nconst categoryId = Number(pm.environment.get(\"smooveApiPortalSeedCategoryId\"));\n\nasync function deleteSeeds() {\n    const categoryId = pm.environment.get(\"smooveApiPortalSeedCategoryId\");\n    const listId = pm.environment.get(\"smooveApiPortalSeedListId\");\n    const results = [];\n    results.push([\"module\", await call(\"DELETE\", baseUrl + \"/api/v1/portal/contentManagement/deleteModule/\" + categoryId + \"/\" + pm.environment.get(\"smooveApiPortalSeedModuleId\"))]);\n    results.push([\"category\", await call(\"DELETE\", baseUrl + \"/api/v1/portal/categories/\" + categoryId)]);\n    results.push([\"list\", await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\")]);\n    return results;\n}\nconst cleanup = await deleteSeeds();\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response lists the seeded module with the documented shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    pm.expect(json.length, 'modules in the new category').to.eql(1);\n    const item = json[0];\n    [\"id\", \"position\", \"name\", \"categoryId\", \"createdAt\", \"updatedAt\", \"isDeleted\"].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.eql(moduleId);\n    pm.expect(item.categoryId, 'categoryId').to.eql(categoryId);\n    pm.expect(item.name, 'name').to.be.a('string').and.include('Postman module');\n    pm.expect(item.isDeleted, 'isDeleted').to.eql(false);\n    pm.expect(Number.isNaN(Date.parse(item.createdAt)), 'createdAt parseable').to.eql(false);\n    pm.expect(Number.isNaN(Date.parse(item.updatedAt)), 'updatedAt parseable').to.eql(false);\n});\n\npm.test(\"Cleanup: seeded module, category and list deleted\", function () {\n    cleanup.forEach(function (entry) {\n        pm.expect(entry[1].code, \"delete \" + entry[0]).to.be.oneOf([200, 204]);\n    });\n});\n\n[\"smooveApiPortalSeedCategoryId\", \"smooveApiPortalSeedListId\", \"smooveApiPortalSeedModuleId\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"02e16067-a92c-4d36-9dae-b140edcca230","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/getModules/:categoryId","urlObject":{"path":["api","v1","portal","contentManagement","getModules",":categoryId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiPortalSeedCategoryId}}","key":"categoryId"}]}},"response":[],"_postman_id":"02e16067-a92c-4d36-9dae-b140edcca230"}],"id":"8ca00c87-f836-4f52-95ed-0d11f6f861b7","_postman_id":"8ca00c87-f836-4f52-95ed-0d11f6f861b7","description":""}],"id":"e8573506-e2cd-417d-a97c-c39b32e3dd81","_postman_id":"e8573506-e2cd-417d-a97c-c39b32e3dd81","description":""},{"name":"addModule","item":[{"name":"Content Management Add Module","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction uniqueSuffix() {\n    return Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst suffix = uniqueSuffix();\n\nlet categoryId = Number(pm.collectionVariables.get(\"createdPortalCategoryId\") || pm.environment.get(\"smooveApiPortalCategoryId\") || 0);\nif (!categoryId) {\n    const searchRes = await send({\n        url: baseUrl + \"/api/v1/portal/categories/search?IsDeleted=false&Page=1&PageSize=1\",\n        method: \"GET\",\n        header: { \"Cookie\": `jvlpsi=${cookie};` }\n    });\n    const results = (searchRes.json().results || []);\n    if (!results.length) throw new Error(\"No portal category available for addModule\");\n    categoryId = results[0].id;\n}\npm.environment.set(\"smooveApiPortalCategoryId\", categoryId);\n\npm.request.body.update(JSON.stringify({\n    categoryId: Number(categoryId),\n    name: \"Postman module \" + suffix,\n    position: 0,\n    isDeleted: false\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'position', 'name', 'categoryId', 'createdAt', 'updatedAt', 'isDeleted'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.position, 'position').to.be.a('number');\n    pm.expect(json.name, 'name').to.be.a('string');\n    pm.expect(json.categoryId, 'categoryId').to.be.a('number');\n    pm.expect(json.createdAt, 'createdAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.createdAt)), 'createdAt parseable').to.eql(false);\n    pm.expect(json.updatedAt, 'updatedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.updatedAt)), 'updatedAt parseable').to.eql(false);\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n});\n\npm.test('Created module echoes request', function () {\n    const json = pm.response.json();\n    const expectedCategoryId = Number(pm.environment.get(\"smooveApiPortalCategoryId\"));\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.categoryId, 'categoryId').to.eql(expectedCategoryId);\n    pm.expect(json.name, 'name').to.include('Postman module');\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const categoryId = pm.environment.get(\"smooveApiPortalCategoryId\");\n    const moduleId = pm.response.json() && pm.response.json().id;\n    if (!categoryId || !moduleId) {\n        pm.test(\"Cleanup skipped: missing module/category id\", function () {\n            pm.expect.fail(\"Missing ids for module cleanup\");\n        });\n        return;\n    }\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/portal/contentManagement/deleteModule/\" + categoryId + \"/\" + moduleId,\n        method: \"DELETE\",\n        header: { \"Cookie\": `jvlpsi=${cookie};` }\n    });\n    pm.test(\"Cleanup: module deleted successfully\", function () {\n        pm.expect([200, 204, 404, 500]).to.include(cleanupRes.code);\n    });\n}\n\nawait cleanUp();"]}}],"id":"43425a08-ba59-47a1-a618-66c6a51860f0","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"categoryId\": 0,\n  \"name\": \"\",\n  \"position\": 0,\n  \"isDeleted\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/addModule","urlObject":{"path":["api","v1","portal","contentManagement","addModule"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"43425a08-ba59-47a1-a618-66c6a51860f0"}],"id":"c8cd30df-a20b-4822-8d32-c1e10e4736d6","_postman_id":"c8cd30df-a20b-4822-8d32-c1e10e4736d6","description":""},{"name":"updateModule","item":[{"name":"Content Management Update Module","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction uniqueSuffix() {\n    return Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst suffix = uniqueSuffix();\n\nlet categoryId = Number(pm.collectionVariables.get(\"createdPortalCategoryId\") || pm.environment.get(\"smooveApiPortalCategoryId\") || 0);\nif (!categoryId) {\n    const searchRes = await send({\n        url: baseUrl + \"/api/v1/portal/categories/search?IsDeleted=false&Page=1&PageSize=1\",\n        method: \"GET\",\n        header: { \"Cookie\": `jvlpsi=${cookie};` }\n    });\n    const results = (searchRes.json().results || []);\n    if (!results.length) throw new Error(\"No portal category available for updateModule\");\n    categoryId = results[0].id;\n}\npm.environment.set(\"smooveApiPortalCategoryId\", categoryId);\n\nconst addRes = await send({\n    url: baseUrl + \"/api/v1/portal/contentManagement/addModule\",\n    method: \"POST\",\n    header: { \"Content-Type\": \"application/json\", \"Cookie\": `jvlpsi=${cookie};` },\n    body: { mode: \"raw\", raw: JSON.stringify({ categoryId: Number(categoryId), name: \"Postman module \" + suffix, position: 0, isDeleted: false }) }\n});\nif (!addRes || addRes.code !== 200) {\n    throw new Error(\"addModule failed with status \" + (addRes && addRes.code));\n}\nconst module = addRes.json();\nif (!module || !module.id) throw new Error(\"addModule returned no module id\");\npm.environment.set(\"smooveApiPortalModuleIdToCleanup\", module.id);\n\npm.request.body.update(JSON.stringify({\n    categoryId: Number(categoryId),\n    id: Number(module.id),\n    position: module.position != null ? module.position : 0,\n    name: \"Postman module updated \" + suffix,\n    isDeleted: false,\n    createdAt: module.createdAt,\n    updatedAt: module.updatedAt\n}));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['id', 'position', 'name', 'categoryId', 'createdAt', 'updatedAt', 'isDeleted'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.id, 'id').to.be.a('number');\n    pm.expect(json.position, 'position').to.be.a('number');\n    pm.expect(json.name, 'name').to.be.a('string');\n    pm.expect(json.categoryId, 'categoryId').to.be.a('number');\n    pm.expect(json.createdAt, 'createdAt').to.be.a('string');\n    pm.expect(json.updatedAt, 'updatedAt').to.be.a('string');\n    pm.expect(json.isDeleted, 'isDeleted').to.be.a('boolean');\n});\n\npm.test('Updated module has positive id and non-empty name', function () {\n    const json = pm.response.json();\n    pm.expect(json.id, 'id').to.be.above(0);\n    pm.expect(json.name, 'name').to.not.equal('');\n    pm.expect(json.isDeleted, 'isDeleted').to.eql(false);\n});\n\nasync function cleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const categoryId = pm.environment.get(\"smooveApiPortalCategoryId\");\n    const moduleId = pm.environment.get(\"smooveApiPortalModuleIdToCleanup\");\n    if (!categoryId || !moduleId) return;\n\n    const cleanupRes = await pm.sendRequest({\n        url: baseUrl + \"/api/v1/portal/contentManagement/deleteModule/\" + categoryId + \"/\" + moduleId,\n        method: \"DELETE\",\n        header: { \"Cookie\": `jvlpsi=${cookie};` }\n    });\n    pm.test(\"Cleanup: module deleted successfully\", function () {\n        pm.expect([200, 204, 404, 500]).to.include(cleanupRes.code);\n    });\n    pm.environment.unset(\"smooveApiPortalModuleIdToCleanup\");\n}\n\nawait cleanUp();"]}}],"id":"c00de69d-2587-460c-ac56-b9a6f61ce462","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n  \"categoryId\": 0,\n  \"id\": 0,\n  \"position\": 0,\n  \"name\": \"Postman module placeholder\",\n  \"isDeleted\": false\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/updateModule","urlObject":{"path":["api","v1","portal","contentManagement","updateModule"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c00de69d-2587-460c-ac56-b9a6f61ce462"}],"id":"0f0a07d4-620a-41ac-a91c-00971f31e1f1","_postman_id":"0f0a07d4-620a-41ac-a91c-00971f31e1f1","description":""},{"name":"getContentPages","item":[{"name":"{categoryId}","item":[{"name":"Content Management Get Content Pages","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\n// Own the category under test: a throwaway list plus a category on it, never an existing one.\nasync function createCategory(label) {\n    const listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: \"postman_\" + label + \"_list_\" + suffix, description: \"temp\" });\n    pm.expect(listRes.code, \"create list\").to.eql(200);\n    const listId = listRes.json().id;\n    pm.environment.set(\"smooveApiPortalSeedListId\", String(listId));\n\n    const categoryRes = await call(\"POST\", baseUrl + \"/api/v1/portal/categories\", {\n        isActive: true,\n        position: 0,\n        title: \"postman_\" + label + \"_\" + suffix,\n        listId: listId,\n        culture: \"he-IL\"\n    });\n    pm.expect(categoryRes.code, \"create category\").to.eql(200);\n    const categoryId = categoryRes.json().id;\n    pm.expect(categoryId, \"created category id\").to.be.a(\"number\").and.above(0);\n    pm.environment.set(\"smooveApiPortalSeedCategoryId\", String(categoryId));\n    return categoryId;\n}\n\nasync function createModule(categoryId) {\n    const res = await call(\"POST\", baseUrl + \"/api/v1/portal/contentManagement/addModule\", {\n        categoryId: categoryId,\n        name: \"Postman module \" + suffix,\n        position: 0,\n        isDeleted: false\n    });\n    pm.expect(res.code, \"create module\").to.eql(200);\n    const moduleId = res.json().id;\n    pm.expect(moduleId, \"created module id\").to.be.a(\"number\").and.above(0);\n    pm.environment.set(\"smooveApiPortalSeedModuleId\", String(moduleId));\n    return moduleId;\n}\n\nawait createCategory(\"pages\");"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\nasync function deleteSeeds() {\n    const categoryId = pm.environment.get(\"smooveApiPortalSeedCategoryId\");\n    const listId = pm.environment.get(\"smooveApiPortalSeedListId\");\n    const results = [];\n    results.push([\"category\", await call(\"DELETE\", baseUrl + \"/api/v1/portal/categories/\" + categoryId)]);\n    results.push([\"list\", await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\")]);\n    return results;\n}\nconst cleanup = await deleteSeeds();\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('A new category has no content pages', function () {\n    pm.expect(pm.response.json()).to.be.an('array').that.is.empty;\n});\n\npm.test(\"Cleanup: seeded module, category and list deleted\", function () {\n    cleanup.forEach(function (entry) {\n        pm.expect(entry[1].code, \"delete \" + entry[0]).to.be.oneOf([200, 204]);\n    });\n});\n\n[\"smooveApiPortalSeedCategoryId\", \"smooveApiPortalSeedListId\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"c6f38d6c-d587-44b3-aa6f-8d4ba2a27570","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/getContentPages/:categoryId","urlObject":{"path":["api","v1","portal","contentManagement","getContentPages",":categoryId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiPortalSeedCategoryId}}","key":"categoryId"}]}},"response":[],"_postman_id":"c6f38d6c-d587-44b3-aa6f-8d4ba2a27570"}],"id":"62e15a11-d2b5-44ab-8c53-8dacee2479cf","_postman_id":"62e15a11-d2b5-44ab-8c53-8dacee2479cf","description":""}],"id":"386eacab-4bc8-4ae2-9a59-fcc1d7c4c330","_postman_id":"386eacab-4bc8-4ae2-9a59-fcc1d7c4c330","description":""},{"name":"moveModule","item":[{"name":"{categoryId}","item":[{"name":"{moduleId}","item":[{"name":"Content Management Move Module","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\n\n// Own the category under test: a throwaway list plus a category on it, never an existing one.\nasync function createCategory(label) {\n    const suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n    const listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: \"postman_\" + label + \"_list_\" + suffix, description: \"temp\" });\n    pm.expect(listRes.code, \"create list\").to.eql(200);\n    const listId = listRes.json().id;\n    pm.environment.set(\"smooveApiPortalSeedListId\", String(listId));\n\n    const categoryRes = await call(\"POST\", baseUrl + \"/api/v1/portal/categories\", {\n        isActive: true,\n        position: 0,\n        title: \"postman_\" + label + \"_\" + suffix,\n        listId: listId,\n        culture: \"he-IL\"\n    });\n    pm.expect(categoryRes.code, \"create category\").to.eql(200);\n    const categoryId = categoryRes.json().id;\n    pm.expect(categoryId, \"created category id\").to.be.a(\"number\").and.above(0);\n    pm.environment.set(\"smooveApiPortalSeedCategoryId\", String(categoryId));\n    return categoryId;\n}\n\nconst categoryId = await createCategory(\"move_module\");\nconst moduleRes = await call(\"POST\", baseUrl + \"/api/v1/portal/contentManagement/addModule\", {\n    categoryId: categoryId,\n    name: \"Postman move module \" + Date.now(),\n    position: 0,\n    isDeleted: false\n});\npm.expect(moduleRes.code, \"create module\").to.eql(200);\nconst moduleId = moduleRes.json().id;\npm.expect(moduleId, \"created module id\").to.be.a(\"number\").and.above(0);\npm.environment.set(\"smooveApiPortalSeedModuleId\", String(moduleId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\nasync function deleteSeedCategoryAndList() {\n    const categoryId = pm.environment.get(\"smooveApiPortalSeedCategoryId\");\n    const listId = pm.environment.get(\"smooveApiPortalSeedListId\");\n    return [\n        [\"category\", await call(\"DELETE\", baseUrl + \"/api/v1/portal/categories/\" + categoryId)],\n        [\"list\", await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\")]\n    ];\n}\n\nconst categoryId = Number(pm.environment.get(\"smooveApiPortalSeedCategoryId\"));\nconst moduleId = Number(pm.environment.get(\"smooveApiPortalSeedModuleId\"));\nconst modulesRes = await call(\"GET\", baseUrl + \"/api/v1/portal/contentManagement/getModules/\" + categoryId);\nconst moduleDeleteRes = await call(\"DELETE\", baseUrl + \"/api/v1/portal/contentManagement/deleteModule/\" + categoryId + \"/\" + moduleId);\nconst cleanup = await deleteSeedCategoryAndList();\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    pm.expect(pm.response.text().trim(), 'empty body').to.eql('');\n});\n\npm.test('Follow-up GET shows the seeded module in its category', function () {\n    pm.expect(modulesRes.code, 'modules status').to.eql(200);\n    const found = modulesRes.json().find(function (m) { return m.id === moduleId; });\n    pm.expect(found, 'seeded module').to.be.an('object');\n    pm.expect(found.categoryId, 'categoryId').to.eql(categoryId);\n});\n\npm.test('Cleanup: seeded module deleted', function () {\n    pm.expect(moduleDeleteRes.code, 'delete module').to.be.oneOf([200, 204]);\n});\n\npm.test(\"Cleanup: seeded category and list deleted\", function () {\n    cleanup.forEach(function (entry) {\n        pm.expect(entry[1].code, \"delete \" + entry[0]).to.be.oneOf([200, 204]);\n    });\n});\n\n[\"smooveApiPortalSeedCategoryId\", \"smooveApiPortalSeedListId\", \"smooveApiPortalSeedModuleId\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"b50d44e2-5b3f-4caa-a427-79992c8abda0","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[],"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/moveModule/:categoryId/:moduleId?position=0","urlObject":{"path":["api","v1","portal","contentManagement","moveModule",":categoryId",":moduleId"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"position","value":"0"}],"variable":[{"type":"any","value":"{{smooveApiPortalSeedCategoryId}}","key":"categoryId"},{"type":"any","value":"{{smooveApiPortalSeedModuleId}}","key":"moduleId"}]}},"response":[],"_postman_id":"b50d44e2-5b3f-4caa-a427-79992c8abda0"}],"id":"e5b781e9-d09b-4bf7-9fce-76c88ee76d01","_postman_id":"e5b781e9-d09b-4bf7-9fce-76c88ee76d01","description":""}],"id":"160808f5-4915-48c5-906f-1738b617d422","_postman_id":"160808f5-4915-48c5-906f-1738b617d422","description":""}],"id":"500f06c5-3bfe-4afe-b256-b92888451190","_postman_id":"500f06c5-3bfe-4afe-b256-b92888451190","description":""},{"name":"moveContentPage","item":[{"name":"{moduleId}","item":[{"name":"{contentPageId}","item":[{"name":"Content Management Move Content Page","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction headers() {\n    return {\n        Accept: \"application/json\",\n        \"Content-Type\": \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    };\n}\n\nasync function contentPagesOf(categoryId) {\n    const res = await send({\n        url: baseUrl + \"/api/v1/portal/contentManagement/getContentPages/\" + categoryId,\n        method: \"GET\",\n        header: headers()\n    });\n    if (!(res && res.code >= 200 && res.code < 300)) return [];\n    const json = res.json();\n    return Array.isArray(json) ? json : (json.results || json.contentPages || []);\n}\n\n// Admin REST has no create-content-page endpoint, but duplicating a category clones its\n// content pages, so this moves a throwaway copy instead of real portal content.\nconst searchRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories/search?IsDeleted=false&Page=1&PageSize=200\",\n    method: \"GET\",\n    header: headers()\n});\npm.expect(searchRes.code, \"search portal categories status\").to.eql(200);\nconst categories = (searchRes.json() && searchRes.json().results) || [];\n\nlet sourceCategoryId = 0;\nfor (const candidate of categories) {\n    const candidateId = Number(candidate && candidate.id);\n    if (!(candidateId > 0)) continue;\n    if ((await contentPagesOf(candidateId)).length) {\n        sourceCategoryId = candidateId;\n        break;\n    }\n}\nif (!sourceCategoryId) {\n    throw new Error(\n        \"No portal category with a content page exists, and the admin API has no \" +\n        \"create-content-page endpoint, so there is nothing to duplicate\"\n    );\n}\n\nconst dupRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories/duplicate/\" + sourceCategoryId,\n    method: \"POST\",\n    header: headers(),\n    body: { mode: \"raw\", raw: JSON.stringify({ copyText: \" (Postman move page)\" }) }\n});\npm.expect(dupRes.code, \"duplicate portal category status\").to.eql(200);\nconst duplicatedCategoryId = Number(dupRes.json().id);\npm.expect(duplicatedCategoryId, \"duplicated category id\").to.be.above(0);\npm.environment.set(\"smooveApiDuplicatedPortalCategoryId\", String(duplicatedCategoryId));\n\nconst pages = await contentPagesOf(duplicatedCategoryId);\npm.expect(pages.length, \"content pages on duplicated category\").to.be.above(0);\nconst page = pages[0];\nconst contentPageId = Number(page.id || page.contentPageId);\nconst moduleId = Number(page.moduleId || page.moduleID || (page.module && page.module.id));\npm.expect(contentPageId, \"duplicated content page id\").to.be.above(0);\npm.expect(moduleId, \"duplicated content page module id\").to.be.above(0);\n\nconst position = 1;\npm.environment.set(\"smooveApiContentPageIdForMove\", String(contentPageId));\npm.environment.set(\"smooveApiPortalModuleIdForMove\", String(moduleId));\npm.environment.set(\"smooveApiContentPagePosition\", String(position));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst contentPageId = Number(pm.environment.get(\"smooveApiContentPageIdForMove\"));\nconst categoryId = pm.environment.get(\"smooveApiDuplicatedPortalCategoryId\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst pagesRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/portal/contentManagement/getContentPages/\" + categoryId,\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.expect(pagesRes.code, \"get content pages status\").to.eql(200);\nconst pagesAfter = pagesRes.json();\n\n// A cloned category has a single content page, so the requested position is the only one it can hold.\npm.test('The content page is at the requested position', function () {\n    const page = pagesAfter.find(function (p) { return p.id === contentPageId; });\n    pm.expect(page, 'content page ' + contentPageId).to.be.an('object');\n    pm.expect(page.position, 'position').to.eql(Number(pm.environment.get('smooveApiContentPagePosition')));\n});\n\n// Remove the cloned category.\nconst cleanupRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/portal/categories/\" + categoryId,\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.test(\"The cloned category is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete category status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiDuplicatedPortalCategoryId\");"]}}],"id":"a5b9bd80-17a2-4f31-b54b-76037cc73b44","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[],"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/moveContentPage/:moduleId/:contentPageId?position={{smooveApiContentPagePosition}}","urlObject":{"path":["api","v1","portal","contentManagement","moveContentPage",":moduleId",":contentPageId"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"position","value":"{{smooveApiContentPagePosition}}"}],"variable":[{"type":"any","value":"{{smooveApiPortalModuleIdForMove}}","key":"moduleId"},{"type":"any","value":"{{smooveApiContentPageIdForMove}}","key":"contentPageId"}]}},"response":[],"_postman_id":"a5b9bd80-17a2-4f31-b54b-76037cc73b44"}],"id":"706621b0-4a3a-477f-b7d2-7a01a0cca7d8","_postman_id":"706621b0-4a3a-477f-b7d2-7a01a0cca7d8","description":""}],"id":"b74cff7c-5fb1-4c90-8d56-a8f7d38e6705","_postman_id":"b74cff7c-5fb1-4c90-8d56-a8f7d38e6705","description":""}],"id":"535763e3-2785-4162-81c7-ae7a29067b05","_postman_id":"535763e3-2785-4162-81c7-ae7a29067b05","description":""},{"name":"changeContentPageRevealTimeInterval","item":[{"name":"{contentPageId}","item":[{"name":"{timeInterval}","item":[{"name":"Content Management Change Content Page Reveal Time Interval","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction headers() {\n    return {\n        Accept: \"application/json\",\n        \"Content-Type\": \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    };\n}\n\nasync function contentPagesOf(categoryId) {\n    const res = await send({\n        url: baseUrl + \"/api/v1/portal/contentManagement/getContentPages/\" + categoryId,\n        method: \"GET\",\n        header: headers()\n    });\n    if (!(res && res.code >= 200 && res.code < 300)) return [];\n    const json = res.json();\n    return Array.isArray(json) ? json : (json.results || json.contentPages || []);\n}\n\n// Admin REST has no create-content-page endpoint, but duplicating a category clones its\n// content pages, so this changes a throwaway copy instead of real portal content.\nconst searchRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories/search?IsDeleted=false&Page=1&PageSize=200\",\n    method: \"GET\",\n    header: headers()\n});\npm.expect(searchRes.code, \"search portal categories status\").to.eql(200);\nconst categories = (searchRes.json() && searchRes.json().results) || [];\n\nlet sourceCategoryId = 0;\nfor (const candidate of categories) {\n    const candidateId = Number(candidate && candidate.id);\n    if (!(candidateId > 0)) continue;\n    if ((await contentPagesOf(candidateId)).length) {\n        sourceCategoryId = candidateId;\n        break;\n    }\n}\nif (!sourceCategoryId) {\n    throw new Error(\n        \"No portal category with a content page exists, and the admin API has no \" +\n        \"create-content-page endpoint, so there is nothing to duplicate\"\n    );\n}\n\nconst dupRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories/duplicate/\" + sourceCategoryId,\n    method: \"POST\",\n    header: headers(),\n    body: { mode: \"raw\", raw: JSON.stringify({ copyText: \" (Postman reveal interval)\" }) }\n});\npm.expect(dupRes.code, \"duplicate portal category status\").to.eql(200);\nconst duplicatedCategoryId = Number(dupRes.json().id);\npm.expect(duplicatedCategoryId, \"duplicated category id\").to.be.above(0);\npm.environment.set(\"smooveApiDuplicatedPortalCategoryId\", String(duplicatedCategoryId));\n\nconst pages = await contentPagesOf(duplicatedCategoryId);\npm.expect(pages.length, \"content pages on duplicated category\").to.be.above(0);\nconst contentPageId = Number(pages[0].id || pages[0].contentPageId);\npm.expect(contentPageId, \"duplicated content page id\").to.be.above(0);\n\nconst interval = 7;\npm.environment.set(\"smooveApiContentPageIdForRevealInterval\", String(contentPageId));\npm.environment.set(\"smooveApiContentPageRevealInterval\", String(interval));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst contentPageId = Number(pm.environment.get(\"smooveApiContentPageIdForRevealInterval\"));\nconst categoryId = pm.environment.get(\"smooveApiDuplicatedPortalCategoryId\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst pagesRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/portal/contentManagement/getContentPages/\" + categoryId,\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.expect(pagesRes.code, \"get content pages status\").to.eql(200);\nconst pagesAfter = pagesRes.json();\n\npm.test('The content page has the new reveal time interval', function () {\n    const page = pagesAfter.find(function (p) { return p.id === contentPageId; });\n    pm.expect(page, 'content page ' + contentPageId).to.be.an('object');\n    pm.expect(page.timeIntervalsBetweenContentPages, 'timeIntervalsBetweenContentPages')\n        .to.eql(Number(pm.environment.get('smooveApiContentPageRevealInterval')));\n});\n\n// Remove the cloned category.\nconst cleanupRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/portal/categories/\" + categoryId,\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.test(\"The cloned category is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete category status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiDuplicatedPortalCategoryId\");"]}}],"id":"23bec330-be73-48d3-90f7-cef2e9c7463d","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[],"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/changeContentPageRevealTimeInterval/:contentPageId/:timeInterval","urlObject":{"path":["api","v1","portal","contentManagement","changeContentPageRevealTimeInterval",":contentPageId",":timeInterval"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiContentPageIdForRevealInterval}}","key":"contentPageId"},{"type":"any","value":"{{smooveApiContentPageRevealInterval}}","key":"timeInterval"}]}},"response":[],"_postman_id":"23bec330-be73-48d3-90f7-cef2e9c7463d"}],"id":"fbf42422-0ced-4e35-b44a-423c2a15c7a3","_postman_id":"fbf42422-0ced-4e35-b44a-423c2a15c7a3","description":""}],"id":"08f8894d-1809-47d7-9450-83c26d387623","_postman_id":"08f8894d-1809-47d7-9450-83c26d387623","description":""}],"id":"3ef62847-918a-4314-ab48-35049f840db7","_postman_id":"3ef62847-918a-4314-ab48-35049f840db7","description":""},{"name":"deleteContentPage","item":[{"name":"{moduleId}","item":[{"name":"{contentPageId}","item":[{"name":"Content Management Delete Content Page","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction headers(extra) {\n    return Object.assign({\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    }, extra || {});\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nasync function contentPagesOf(categoryId) {\n    const res = await send({\n        url: baseUrl + \"/api/v1/portal/contentManagement/getContentPages/\" + categoryId,\n        method: \"GET\",\n        header: headers()\n    });\n    if (!(res && res.code >= 200 && res.code < 300)) return [];\n    const json = res.json();\n    return Array.isArray(json) ? json : (json.results || json.contentPages || []);\n}\n\n// Admin REST has no create-content-page endpoint, but duplicating a category clones its\n// content pages, so this deletes a throwaway copy instead of real portal content.\nconst searchRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories/search?IsDeleted=false&Page=1&PageSize=200\",\n    method: \"GET\",\n    header: headers()\n});\npm.expect(searchRes.code, \"search portal categories status\").to.eql(200);\nconst categories = (searchRes.json() && searchRes.json().results) || [];\n\nlet sourceCategoryId = 0;\nfor (const candidate of categories) {\n    const candidateId = Number(candidate && candidate.id);\n    if (!(candidateId > 0)) continue;\n    if ((await contentPagesOf(candidateId)).length) {\n        sourceCategoryId = candidateId;\n        break;\n    }\n}\nif (!sourceCategoryId) {\n    throw new Error(\n        \"No portal category with a content page exists, and the admin API has no \" +\n        \"create-content-page endpoint, so there is nothing to duplicate\"\n    );\n}\n\nconst dupRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories/duplicate/\" + sourceCategoryId,\n    method: \"POST\",\n    header: headers(),\n    body: { mode: \"raw\", raw: JSON.stringify({ copyText: \" (Postman delete page \" + ts + \")\" }) }\n});\npm.expect(dupRes.code, \"duplicate portal category status\").to.eql(200);\nconst duplicatedCategoryId = Number(dupRes.json().id);\npm.expect(duplicatedCategoryId, \"duplicated category id\").to.be.above(0);\npm.environment.set(\"smooveApiDuplicatedPortalCategoryId\", String(duplicatedCategoryId));\n\nconst pages = await contentPagesOf(duplicatedCategoryId);\npm.expect(pages.length, \"content pages on duplicated category\").to.be.above(0);\nconst page = pages[0];\nconst contentPageId = Number(page.id || page.contentPageId);\nconst moduleId = Number(page.moduleId || page.moduleID || (page.module && page.module.id));\npm.expect(contentPageId, \"duplicated content page id\").to.be.above(0);\npm.expect(moduleId, \"duplicated content page module id\").to.be.above(0);\npm.environment.set(\"smooveApiPortalModuleId\", String(moduleId));\npm.environment.set(\"smooveApiPortalContentPageIdToDelete\", String(contentPageId));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst contentPageId = Number(pm.environment.get(\"smooveApiPortalContentPageIdToDelete\"));\nconst categoryId = pm.environment.get(\"smooveApiDuplicatedPortalCategoryId\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst pagesRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/portal/contentManagement/getContentPages/\" + categoryId,\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.expect(pagesRes.code, \"get content pages status\").to.eql(200);\nconst pagesAfter = pagesRes.json();\n\npm.test('The content page is no longer listed on the category', function () {\n    pm.expect(pagesAfter.map(function (p) { return p.id; }), 'content page ids').to.not.include(contentPageId);\n});\n\n// Remove the cloned category.\nconst cleanupRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/portal/categories/\" + categoryId,\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.test(\"The cloned category is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete category status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiDuplicatedPortalCategoryId\");"]}}],"id":"2b8a2f5d-9d58-4ecc-8ba8-b4ec25f104b7","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[],"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/deleteContentPage/:moduleId/:contentPageId","urlObject":{"path":["api","v1","portal","contentManagement","deleteContentPage",":moduleId",":contentPageId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiPortalModuleId}}","key":"moduleId"},{"type":"any","value":"{{smooveApiPortalContentPageIdToDelete}}","key":"contentPageId"}]}},"response":[],"_postman_id":"2b8a2f5d-9d58-4ecc-8ba8-b4ec25f104b7"}],"id":"8078860e-31ea-44f6-87ea-b078d17225f0","_postman_id":"8078860e-31ea-44f6-87ea-b078d17225f0","description":""}],"id":"e6cf939e-82c5-47bb-99fd-261a1ca3b149","_postman_id":"e6cf939e-82c5-47bb-99fd-261a1ca3b149","description":""}],"id":"cef35822-e465-4d45-9cfb-870aeb490ff4","_postman_id":"cef35822-e465-4d45-9cfb-870aeb490ff4","description":""},{"name":"deleteModule","item":[{"name":"{categoryId}","item":[{"name":"{moduleId}","item":[{"name":"Content Management Delete Module","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst ts = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction headers(extra) {\n    return Object.assign({\n        \"Content-Type\": \"application/json\",\n        \"Accept\": \"application/json\",\n        \"Cookie\": `jvlpsi=${cookie};`\n    }, extra || {});\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction assertOk(res, label) {\n    if (!res || (res.code !== 200 && res.code !== 201)) {\n        throw new Error((label || \"Request\") + \" failed with status \" + (res && res.code) + \": \" + (res && res.text && res.text()));\n    }\n}\n\n// Prefer an existing portal category; fall back to collection var / create list+category\nlet categoryId = Number(pm.collectionVariables.get(\"createdPortalCategoryId\") || pm.environment.get(\"smooveApiPortalCategoryId\") || 0);\n\nif (!categoryId) {\n    const searchRes = await send({\n        url: baseUrl + \"/api/v1/portal/categories/search?IsDeleted=false&Page=1&PageSize=1\",\n        method: \"GET\",\n        header: headers()\n    });\n    assertOk(searchRes, \"Search portal categories\");\n    const results = (searchRes.json().results || []);\n    if (!results.length) throw new Error(\"No portal category available to attach a module\");\n    categoryId = results[0].id;\n}\n\npm.environment.set(\"smooveApiPortalCategoryId\", categoryId);\n\nconst addRes = await send({\n    url: baseUrl + \"/api/v1/portal/contentManagement/addModule\",\n    method: \"POST\",\n    header: headers(),\n    body: {\n        mode: \"raw\",\n        raw: JSON.stringify({\n            categoryId: categoryId,\n            name: \"Postman module \" + ts,\n            position: 0,\n            isDeleted: false\n        })\n    }\n});\nassertOk(addRes, \"Create portal module\");\nconst moduleId = addRes.json().id;\nif (!moduleId) throw new Error(\"addModule did not return id: \" + addRes.text());\npm.environment.set(\"smooveApiPortalModuleIdToDelete\", moduleId);\n\nconst verifyRes = await send({\n    url: baseUrl + \"/api/v1/portal/contentManagement/getModules/\" + categoryId,\n    method: \"GET\",\n    header: headers()\n});\nassertOk(verifyRes, \"Verify modules list\");\nconst modules = verifyRes.json();\nconst moduleList = Array.isArray(modules) ? modules : (modules.results || modules.modules || []);\nconst found = moduleList.some(function (m) { return Number(m.id) === Number(moduleId); });\nif (!found) throw new Error(\"Created module not found before delete\");"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nasync function followUpAndCleanUp() {\n    const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n    const cookie = pm.environment.get(\"smooveApiCookie\");\n    const categoryId = pm.environment.get(\"smooveApiPortalCategoryId\") || pm.variables.get(\"categoryId\");\n    const moduleId = Number(pm.environment.get(\"smooveApiPortalModuleIdToDelete\") || pm.variables.get(\"moduleId\"));\n    if (!categoryId || !moduleId) return;\n    function send(opts) {\n        return new Promise(function (resolve, reject) {\n            pm.sendRequest(opts, function (err, res) { if (err) reject(err); else resolve(res); });\n        });\n    }\n    const listRes = await send({\n        url: baseUrl + \"/api/v1/portal/contentManagement/getModules/\" + categoryId,\n        method: \"GET\",\n        header: { \"Cookie\": \"jvlpsi=\" + cookie + \";\", \"Accept\": \"application/json\" }\n    });\n    pm.test('Follow-up GET modules no longer includes deleted module', function () {\n        pm.expect(listRes.code, 'list status').to.eql(200);\n        const mods = listRes.json();\n        pm.expect(mods, 'modules').to.be.an('array');\n        const found = mods.find(function (m) { return Number(m.id) === moduleId; });\n        pm.expect(found, 'deleted module absent').to.equal(undefined);\n    });\n}\n\nawait followUpAndCleanUp();"]}}],"id":"fde88cda-406f-450c-b6ba-06d183c0d735","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"DELETE","header":[],"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/deleteModule/:categoryId/:moduleId","urlObject":{"path":["api","v1","portal","contentManagement","deleteModule",":categoryId",":moduleId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiPortalCategoryId}}","key":"categoryId"},{"type":"any","value":"{{smooveApiPortalModuleIdToDelete}}","key":"moduleId"}]}},"response":[],"_postman_id":"fde88cda-406f-450c-b6ba-06d183c0d735"}],"id":"6a5fe1ed-59a4-4b17-aa86-dd96d7d44526","_postman_id":"6a5fe1ed-59a4-4b17-aa86-dd96d7d44526","description":""}],"id":"ed8433c3-3c46-4ba7-a40a-0539db209a4f","_postman_id":"ed8433c3-3c46-4ba7-a40a-0539db209a4f","description":""}],"id":"4731719e-ca49-4fb3-ba00-902c874393ba","_postman_id":"4731719e-ca49-4fb3-ba00-902c874393ba","description":""},{"name":"doesModuleContainsContentPages","item":[{"name":"{moduleId}","item":[{"name":"Content Management Does Module Contains Content Pages","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\npm.request.addHeader({ key: \"Cookie\", value: \"jvlpsi=\" + cookie + \";\" });\nconst suffix = Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\n\n// Own the category under test: a throwaway list plus a category on it, never an existing one.\nasync function createCategory(label) {\n    const listRes = await call(\"POST\", baseUrl + \"/api/v1/lists\", { name: \"postman_\" + label + \"_list_\" + suffix, description: \"temp\" });\n    pm.expect(listRes.code, \"create list\").to.eql(200);\n    const listId = listRes.json().id;\n    pm.environment.set(\"smooveApiPortalSeedListId\", String(listId));\n\n    const categoryRes = await call(\"POST\", baseUrl + \"/api/v1/portal/categories\", {\n        isActive: true,\n        position: 0,\n        title: \"postman_\" + label + \"_\" + suffix,\n        listId: listId,\n        culture: \"he-IL\"\n    });\n    pm.expect(categoryRes.code, \"create category\").to.eql(200);\n    const categoryId = categoryRes.json().id;\n    pm.expect(categoryId, \"created category id\").to.be.a(\"number\").and.above(0);\n    pm.environment.set(\"smooveApiPortalSeedCategoryId\", String(categoryId));\n    return categoryId;\n}\n\nasync function createModule(categoryId) {\n    const res = await call(\"POST\", baseUrl + \"/api/v1/portal/contentManagement/addModule\", {\n        categoryId: categoryId,\n        name: \"Postman module \" + suffix,\n        position: 0,\n        isDeleted: false\n    });\n    pm.expect(res.code, \"create module\").to.eql(200);\n    const moduleId = res.json().id;\n    pm.expect(moduleId, \"created module id\").to.be.a(\"number\").and.above(0);\n    pm.environment.set(\"smooveApiPortalSeedModuleId\", String(moduleId));\n    return moduleId;\n}\n\nconst categoryId = await createCategory(\"haspages\");\nawait createModule(categoryId);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst headers = { \"Content-Type\": \"application/json\", Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" };\n\nfunction call(method, url, body) {\n    const request = { url: url, method: method, header: headers };\n    if (body !== undefined) request.body = { mode: \"raw\", raw: JSON.stringify(body) };\n    return pm.sendRequest(request);\n}\n\nasync function deleteSeeds() {\n    const categoryId = pm.environment.get(\"smooveApiPortalSeedCategoryId\");\n    const listId = pm.environment.get(\"smooveApiPortalSeedListId\");\n    const results = [];\n    results.push([\"module\", await call(\"DELETE\", baseUrl + \"/api/v1/portal/contentManagement/deleteModule/\" + categoryId + \"/\" + pm.environment.get(\"smooveApiPortalSeedModuleId\"))]);\n    results.push([\"category\", await call(\"DELETE\", baseUrl + \"/api/v1/portal/categories/\" + categoryId)]);\n    results.push([\"list\", await call(\"DELETE\", baseUrl + \"/api/v1/lists/\" + listId + \"?deleteContacts=false\")]);\n    return results;\n}\nconst cleanup = await deleteSeeds();\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('A new module contains no content pages', function () {\n    pm.expect(pm.response.json()).to.eql(false);\n});\n\npm.test(\"Cleanup: seeded module, category and list deleted\", function () {\n    cleanup.forEach(function (entry) {\n        pm.expect(entry[1].code, \"delete \" + entry[0]).to.be.oneOf([200, 204]);\n    });\n});\n\n[\"smooveApiPortalSeedCategoryId\", \"smooveApiPortalSeedListId\", \"smooveApiPortalSeedModuleId\"].forEach(function (k) { pm.environment.unset(k); });"]}}],"id":"cb507a1f-eb66-4b0d-8d5f-863dbd18016f","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/doesModuleContainsContentPages/:moduleId","urlObject":{"path":["api","v1","portal","contentManagement","doesModuleContainsContentPages",":moduleId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiPortalSeedModuleId}}","key":"moduleId"}]}},"response":[],"_postman_id":"cb507a1f-eb66-4b0d-8d5f-863dbd18016f"}],"id":"ddf3032a-1141-4ee9-88e2-dfb45fdadd17","_postman_id":"ddf3032a-1141-4ee9-88e2-dfb45fdadd17","description":""}],"id":"c8c17b8c-5522-4a62-b546-dd66d797f86e","_postman_id":"c8c17b8c-5522-4a62-b546-dd66d797f86e","description":""},{"name":"isAllowedToCreateAnotherPortalPage","item":[{"name":"Content Management Is Allowed To Create Another Portal Page","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a boolean', function () {\n    pm.expect(pm.response.json()).to.be.a('boolean');\n});"]}}],"id":"6f66ee2c-5178-4c9d-982b-c79318d8d49c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/isAllowedToCreateAnotherPortalPage","urlObject":{"path":["api","v1","portal","contentManagement","isAllowedToCreateAnotherPortalPage"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6f66ee2c-5178-4c9d-982b-c79318d8d49c"}],"id":"7f65207a-6821-4b0a-8718-be100f38a199","_postman_id":"7f65207a-6821-4b0a-8718-be100f38a199","description":""},{"name":"changeContentPagePublishDate","item":[{"name":"{contentPageId}","item":[{"name":"Content Management Change Content Page Publish Date","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction headers() {\n    return {\n        Accept: \"application/json\",\n        \"Content-Type\": \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    };\n}\n\nasync function contentPagesOf(categoryId) {\n    const res = await send({\n        url: baseUrl + \"/api/v1/portal/contentManagement/getContentPages/\" + categoryId,\n        method: \"GET\",\n        header: headers()\n    });\n    if (!(res && res.code >= 200 && res.code < 300)) return [];\n    const json = res.json();\n    return Array.isArray(json) ? json : (json.results || json.contentPages || []);\n}\n\n// Admin REST has no create-content-page endpoint, but duplicating a category clones its\n// content pages, so the test owns a throwaway copy instead of mutating portal content.\nconst searchRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories/search?IsDeleted=false&Page=1&PageSize=200\",\n    method: \"GET\",\n    header: headers()\n});\npm.expect(searchRes.code, \"search portal categories status\").to.eql(200);\nconst categories = (searchRes.json() && searchRes.json().results) || [];\n\nlet sourceCategoryId = 0;\nfor (const candidate of categories) {\n    const candidateId = Number(candidate && candidate.id);\n    if (!(candidateId > 0)) continue;\n    if ((await contentPagesOf(candidateId)).length) {\n        sourceCategoryId = candidateId;\n        break;\n    }\n}\nif (!sourceCategoryId) {\n    throw new Error(\n        \"No portal category with a content page exists, and the admin API has no \" +\n        \"create-content-page endpoint, so there is nothing to duplicate\"\n    );\n}\n\nconst dupRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories/duplicate/\" + sourceCategoryId,\n    method: \"POST\",\n    header: headers(),\n    body: { mode: \"raw\", raw: JSON.stringify({ copyText: \" (Postman publish date)\" }) }\n});\npm.expect(dupRes.code, \"duplicate portal category status\").to.eql(200);\nconst duplicatedCategoryId = Number(dupRes.json().id);\npm.expect(duplicatedCategoryId, \"duplicated category id\").to.be.above(0);\npm.environment.set(\"smooveApiDuplicatedPortalCategoryId\", String(duplicatedCategoryId));\n\nconst pages = await contentPagesOf(duplicatedCategoryId);\npm.expect(pages.length, \"content pages on duplicated category\").to.be.above(0);\nconst contentPageId = Number(pages[0].id || pages[0].contentPageId);\npm.expect(contentPageId, \"duplicated content page id\").to.be.above(0);\npm.environment.set(\"smooveApiContentPageIdForPublishDate\", String(contentPageId));\n\n// Send a naive date-time: the API stores and echoes it back without a timezone, so an\n// offset-bearing value would come back shifted and be impossible to compare.\nconst future = new Date();\nfuture.setUTCDate(future.getUTCDate() + 30);\nconst publishDate = future.toISOString().replace(/\\.\\d+Z$/, \"\");\npm.environment.set(\"smooveApiContentPagePublishDate\", publishDate);"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst contentPageId = Number(pm.environment.get(\"smooveApiContentPageIdForPublishDate\"));\nconst categoryId = pm.environment.get(\"smooveApiDuplicatedPortalCategoryId\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst pagesRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/portal/contentManagement/getContentPages/\" + categoryId,\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.expect(pagesRes.code, \"get content pages status\").to.eql(200);\nconst pagesAfter = pagesRes.json();\n\npm.test('The content page has the new publish date', function () {\n    const page = pagesAfter.find(function (p) { return p.id === contentPageId; });\n    pm.expect(page, 'content page ' + contentPageId).to.be.an('object');\n    pm.expect(page.publishDate, 'publishDate').to.eql(pm.environment.get('smooveApiContentPagePublishDate'));\n});\n\n// Remove the cloned category.\nconst cleanupRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/portal/categories/\" + categoryId,\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.test(\"The cloned category is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete category status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiDuplicatedPortalCategoryId\");"]}}],"id":"d59ae9cc-1096-4128-a3ff-39c273d81b2c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[],"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/changeContentPagePublishDate/:contentPageId?publishDate={{smooveApiContentPagePublishDate}}","urlObject":{"path":["api","v1","portal","contentManagement","changeContentPagePublishDate",":contentPageId"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"publishDate","value":"{{smooveApiContentPagePublishDate}}"}],"variable":[{"type":"any","value":"{{smooveApiContentPageIdForPublishDate}}","key":"contentPageId"}]}},"response":[],"_postman_id":"d59ae9cc-1096-4128-a3ff-39c273d81b2c"}],"id":"f0ba241a-f7fe-4bf0-9006-49976a98611e","_postman_id":"f0ba241a-f7fe-4bf0-9006-49976a98611e","description":""}],"id":"9635c638-811b-4197-aff7-f0bc3a3e0189","_postman_id":"9635c638-811b-4197-aff7-f0bc3a3e0189","description":""},{"name":"changeContentPageTitle","item":[{"name":"{contentPageId}","item":[{"name":"Content Management Change Content Page Title","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\npm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction headers() {\n    return {\n        Accept: \"application/json\",\n        \"Content-Type\": \"application/json\",\n        Cookie: \"jvlpsi=\" + cookie + \";\"\n    };\n}\n\nasync function contentPagesOf(categoryId) {\n    const res = await send({\n        url: baseUrl + \"/api/v1/portal/contentManagement/getContentPages/\" + categoryId,\n        method: \"GET\",\n        header: headers()\n    });\n    if (!(res && res.code >= 200 && res.code < 300)) return [];\n    const json = res.json();\n    return Array.isArray(json) ? json : (json.results || json.contentPages || []);\n}\n\n// Admin REST has no create-content-page endpoint, but duplicating a category clones its\n// content pages, so this renames a throwaway copy instead of real portal content.\nconst searchRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories/search?IsDeleted=false&Page=1&PageSize=200\",\n    method: \"GET\",\n    header: headers()\n});\npm.expect(searchRes.code, \"search portal categories status\").to.eql(200);\nconst categories = (searchRes.json() && searchRes.json().results) || [];\n\nlet sourceCategoryId = 0;\nfor (const candidate of categories) {\n    const candidateId = Number(candidate && candidate.id);\n    if (!(candidateId > 0)) continue;\n    if ((await contentPagesOf(candidateId)).length) {\n        sourceCategoryId = candidateId;\n        break;\n    }\n}\nif (!sourceCategoryId) {\n    throw new Error(\n        \"No portal category with a content page exists, and the admin API has no \" +\n        \"create-content-page endpoint, so there is nothing to duplicate\"\n    );\n}\n\nconst dupRes = await send({\n    url: baseUrl + \"/api/v1/portal/categories/duplicate/\" + sourceCategoryId,\n    method: \"POST\",\n    header: headers(),\n    body: { mode: \"raw\", raw: JSON.stringify({ copyText: \" (Postman page title)\" }) }\n});\npm.expect(dupRes.code, \"duplicate portal category status\").to.eql(200);\nconst duplicatedCategoryId = Number(dupRes.json().id);\npm.expect(duplicatedCategoryId, \"duplicated category id\").to.be.above(0);\npm.environment.set(\"smooveApiDuplicatedPortalCategoryId\", String(duplicatedCategoryId));\n\nconst pages = await contentPagesOf(duplicatedCategoryId);\npm.expect(pages.length, \"content pages on duplicated category\").to.be.above(0);\nconst page = pages[0];\nconst contentPageId = Number(page.id || page.contentPageId);\npm.expect(contentPageId, \"duplicated content page id\").to.be.above(0);\npm.environment.set(\"smooveApiContentPageIdForTitle\", String(contentPageId));\n\nconst title = \"Postman page title \" + Date.now() + \"-\" + Math.random().toString(36).slice(2, 8);\npm.environment.set(\"smooveApiContentPageTitle\", title);\npm.request.body.update(JSON.stringify(Object.assign({}, page, { title: title })));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    const text = pm.response.text();\n    pm.expect(text === '' || text == null, 'empty body').to.eql(true);\n});\n\nconst contentPageId = Number(pm.environment.get(\"smooveApiContentPageIdForTitle\"));\nconst categoryId = pm.environment.get(\"smooveApiDuplicatedPortalCategoryId\");\nconst cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\nconst pagesRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/portal/contentManagement/getContentPages/\" + categoryId,\n    method: \"GET\",\n    header: { Accept: \"application/json\", Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.expect(pagesRes.code, \"get content pages status\").to.eql(200);\nconst pagesAfter = pagesRes.json();\n\npm.test('The content page has the new title', function () {\n    const page = pagesAfter.find(function (p) { return p.id === contentPageId; });\n    pm.expect(page, 'content page ' + contentPageId).to.be.an('object');\n    pm.expect(page.title, 'title').to.eql(pm.environment.get('smooveApiContentPageTitle'));\n});\n\n// Remove the cloned category.\nconst cleanupRes = await pm.sendRequest({\n    url: baseUrl + \"/api/v1/portal/categories/\" + categoryId,\n    method: \"DELETE\",\n    header: { Cookie: \"jvlpsi=\" + cookie + \";\" }\n});\npm.test(\"The cloned category is deleted\", function () {\n    pm.expect(cleanupRes.code, \"delete category status\").to.eql(200);\n});\npm.environment.unset(\"smooveApiDuplicatedPortalCategoryId\");"]}}],"id":"2f8c950c-5c5c-4159-adf9-47832239fff1","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"PUT","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"title\": \"\"\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/portal/contentManagement/changeContentPageTitle/:contentPageId","urlObject":{"path":["api","v1","portal","contentManagement","changeContentPageTitle",":contentPageId"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiContentPageIdForTitle}}","key":"contentPageId"}]}},"response":[],"_postman_id":"2f8c950c-5c5c-4159-adf9-47832239fff1"}],"id":"d4ddbfdb-b3ed-47d3-b311-84ee298dd264","_postman_id":"d4ddbfdb-b3ed-47d3-b311-84ee298dd264","description":""}],"id":"a70b3bd7-6bc2-4954-aa7f-7439ff59b6da","_postman_id":"a70b3bd7-6bc2-4954-aa7f-7439ff59b6da","description":""}],"id":"3f53b796-2534-462f-a27f-ba67499b2084","_postman_id":"3f53b796-2534-462f-a27f-ba67499b2084","description":""}],"id":"92a0a1a1-3a33-480d-becd-78abf482e41b","_postman_id":"92a0a1a1-3a33-480d-becd-78abf482e41b","description":""},{"name":"ecommerce","item":[{"name":"categories","item":[{"name":"{id}","item":[],"id":"44134453-01f1-4311-91cd-c95316f585f8","_postman_id":"44134453-01f1-4311-91cd-c95316f585f8","description":""},{"name":"all","item":[],"id":"f0f21ea5-38db-49c4-895a-579d17554f65","_postman_id":"f0f21ea5-38db-49c4-895a-579d17554f65","description":""},{"name":"count","item":[{"name":"Ecommerce Categories Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative number', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isFinite(value)).to.be.true;\n    pm.expect(value).to.be.at.least(0);\n});"]}}],"id":"a95e6e5b-31d9-47a1-bbd1-e3640f49e17a","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/ecommerce/categories/count","urlObject":{"path":["api","v1","ecommerce","categories","count"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a95e6e5b-31d9-47a1-bbd1-e3640f49e17a"}],"id":"4e632b69-5576-4710-95f9-c8c430daae61","_postman_id":"4e632b69-5576-4710-95f9-c8c430daae61","description":""},{"name":"search","item":[],"id":"ffd404ac-7020-4acf-9e08-92772aad196a","_postman_id":"ffd404ac-7020-4acf-9e08-92772aad196a","description":""},{"name":"test","item":[{"name":"Ecommerce Categories Test","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response is an array with expected item shape', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('array');\n    json.forEach(function (item, i) {\n        pm.expect(item, 'item[' + i + ']').to.be.a('string');\n    });\n});\npm.test('Response has expected values', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.eql(['test', 'response', 'in', 'array', 'postman-test-value']);\n});"]}}],"id":"5c8a6c37-c2f5-4c2f-99c3-8b6965f72fff","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/ecommerce/categories/test?testvalue=postman-test-value","urlObject":{"path":["api","v1","ecommerce","categories","test"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"testvalue","value":"postman-test-value"}],"variable":[]}},"response":[],"_postman_id":"5c8a6c37-c2f5-4c2f-99c3-8b6965f72fff"}],"id":"37c5d0af-e704-40f3-be49-379a6fb5bbb8","_postman_id":"37c5d0af-e704-40f3-be49-379a6fb5bbb8","description":""}],"id":"5df60142-91f2-4f4b-897d-e9eccaebcde6","_postman_id":"5df60142-91f2-4f4b-897d-e9eccaebcde6","description":""},{"name":"products","item":[{"name":"search","item":[],"id":"bcac01c0-7b7c-4a65-8de7-820ff31a1fac","_postman_id":"bcac01c0-7b7c-4a65-8de7-820ff31a1fac","description":""},{"name":"{id}","item":[],"id":"a647fa80-4ba1-4246-be0a-d80e5796ba1d","_postman_id":"a647fa80-4ba1-4246-be0a-d80e5796ba1d","description":""},{"name":"download","item":[],"id":"4be076a7-9914-47c1-b998-92028a93ba10","_postman_id":"4be076a7-9914-47c1-b998-92028a93ba10","description":""},{"name":"BulkAdd","item":[],"id":"239fa62b-5c0c-47de-8e8f-71b8be4d143e","_postman_id":"239fa62b-5c0c-47de-8e8f-71b8be4d143e","description":""},{"name":"count","item":[{"name":"Products Count","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is a non-negative number', function () {\n    const value = pm.response.json();\n    pm.expect(value).to.be.a('number');\n    pm.expect(Number.isFinite(value)).to.be.true;\n    pm.expect(value).to.be.at.least(0);\n});"]}}],"id":"48f474e4-08d2-427c-b5c6-6ec75b3c9430","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/ecommerce/products/count?pattern=&page=1&pageSize=50","urlObject":{"path":["api","v1","ecommerce","products","count"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"pattern","value":""},{"key":"page","value":"1"},{"key":"pageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"48f474e4-08d2-427c-b5c6-6ec75b3c9430"}],"id":"2c453a41-c189-4ce0-be77-f1ad06d42977","_postman_id":"2c453a41-c189-4ce0-be77-f1ad06d42977","description":""}],"id":"d020d040-c177-4af7-a3c3-49e59fbf9f89","_postman_id":"d020d040-c177-4af7-a3c3-49e59fbf9f89","description":""},{"name":"storeSettings","item":[{"name":"test","item":[],"id":"13aaf0d3-1653-45b4-8598-6a54ce693878","_postman_id":"13aaf0d3-1653-45b4-8598-6a54ce693878","description":""},{"name":"sync","item":[],"id":"d29ad608-7bcd-4be1-a2c7-f3bf3d3de6b1","_postman_id":"d29ad608-7bcd-4be1-a2c7-f3bf3d3de6b1","description":""},{"name":"lastTransInsertionTime","item":[{"name":"Store Settings Get Store Last Trans Insertion Time","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst baseUrl = pm.environment.get(\"smooveApiBaseURL\");\n\npm.request.addHeader({\n    key: 'Cookie',\n    value: `jvlpsi=${cookie};`\n});\n\nconst getRes = await new Promise(function (resolve, reject) {\n    pm.sendRequest({\n        url: baseUrl + \"/api/v1/ecommerce/storeSettings\",\n        method: \"GET\",\n        header: { Accept: \"application/json\", Cookie: `jvlpsi=${cookie};` }\n    }, function (err, res) {\n        if (err) reject(err);\n        else resolve(res);\n    });\n});\n\nif (getRes.code !== 200) {\n    throw new Error(\"lastTransInsertionTime setup: GET /storeSettings failed. status=\" + getRes.code + \" body=\" + getRes.text());\n}\nconst settings = getRes.json();\nconst storeId = Number(settings && settings.storeID);\nif (!(storeId > 0)) {\n    throw new Error(\"lastTransInsertionTime setup: GET /storeSettings did not return storeID.\");\n}\n\npm.environment.set(\"smooveApiEcommerceStoreId\", String(storeId));\npm.environment.set(\"smooveApiEcommerceLastTransInsertionTime\", settings.lastTransInsertionTime ? String(settings.lastTransInsertionTime) : \"\");\ntry {\n    pm.request.url.query.upsert({ key: \"storeId\", value: String(storeId) });\n} catch (e) {}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const expectedLastTrans = pm.environment.get(\"smooveApiEcommerceLastTransInsertionTime\") || \"\";\nconst expectDatetime = expectedLastTrans.length > 0;\n\npm.test('Status code matches lastTransInsertionTime contract', function () {\n    pm.response.to.have.status(expectDatetime ? 200 : 204);\n});\n\npm.test('Response body matches lastTransInsertionTime contract', function () {\n    if (expectDatetime) {\n        let value;\n        try { value = pm.response.json(); } catch (e) { value = pm.response.text().trim(); }\n        if (typeof value !== 'string') value = String(value ?? '');\n        pm.expect(value, 'datetime').to.be.a('string').and.not.empty;\n        pm.expect(Number.isNaN(Date.parse(value)), 'value should be a parseable date').to.equal(false);\n    } else {\n        pm.expect((pm.response.text() || '').trim(), 'empty body').to.equal('');\n    }\n});\n\npm.environment.unset(\"smooveApiEcommerceLastTransInsertionTime\");"]}}],"id":"a6b89abf-5936-489a-8a67-78664807816e","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/ecommerce/storeSettings/lastTransInsertionTime?storeId={{smooveApiEcommerceStoreId}}","urlObject":{"path":["api","v1","ecommerce","storeSettings","lastTransInsertionTime"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"storeId","value":"{{smooveApiEcommerceStoreId}}"}],"variable":[]}},"response":[],"_postman_id":"a6b89abf-5936-489a-8a67-78664807816e"}],"id":"298d0d9d-eafd-46b8-a1ea-fdacd314af08","_postman_id":"298d0d9d-eafd-46b8-a1ea-fdacd314af08","description":""}],"id":"7fd3dfe2-aad7-4cb7-92d6-4e7697d96176","_postman_id":"7fd3dfe2-aad7-4cb7-92d6-4e7697d96176","description":""}],"id":"aeae280c-b1b4-4e31-a9a1-38d6c295c42a","_postman_id":"aeae280c-b1b4-4e31-a9a1-38d6c295c42a","description":""},{"name":"admin","item":[{"name":"clear-auth-cache","item":[{"name":"Admin Clear Authorization Cache","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\n\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    pm.expect(pm.response.text().trim(), 'body').to.eql('');\n});"]}}],"id":"112181fd-bc9a-499a-b53b-6c453c4955ed","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[],"url":"{{smooveApiBaseURL}}/api/v1/admin/clear-auth-cache?siteId={{smooveApiAccountSiteId}}","urlObject":{"path":["api","v1","admin","clear-auth-cache"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"siteId","value":"{{smooveApiAccountSiteId}}"}],"variable":[]}},"response":[],"_postman_id":"112181fd-bc9a-499a-b53b-6c453c4955ed"}],"id":"ca94caf5-4f89-4890-aa6f-08a4d26fbf50","_postman_id":"ca94caf5-4f89-4890-aa6f-08a4d26fbf50","description":""},{"name":"clear-all-account-cache","item":[{"name":"Admin Clear All Account Cache","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\n\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response body is empty', function () {\n    pm.expect(pm.response.text().trim(), 'body').to.eql('');\n});"]}}],"id":"ed5e53f0-c382-4d6c-baee-fe12cc51651c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[],"url":"{{smooveApiBaseURL}}/api/v1/admin/clear-all-account-cache?siteId={{smooveApiAccountSiteId}}","urlObject":{"path":["api","v1","admin","clear-all-account-cache"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"siteId","value":"{{smooveApiAccountSiteId}}"}],"variable":[]}},"response":[],"_postman_id":"ed5e53f0-c382-4d6c-baee-fe12cc51651c"}],"id":"e2ef1d53-1e2f-46a4-b428-da1adfe0667c","_postman_id":"e2ef1d53-1e2f-46a4-b428-da1adfe0667c","description":""},{"name":"ensure-admin","item":[{"name":"Admin Ensure Is Admin","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});\r\n\r\n"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing isAdmin').to.have.property('isAdmin');\n});\n\npm.test('Authenticated caller is admin', function () {\n    const json = pm.response.json();\n    pm.expect(String(json.isAdmin).toLowerCase(), 'isAdmin').to.eql('true');\n});"]}}],"id":"5f7d233f-839e-4844-8b4a-b31eaea40a6c","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveApiBaseURL}}/api/v1/admin/ensure-admin","urlObject":{"path":["api","v1","admin","ensure-admin"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"5f7d233f-839e-4844-8b4a-b31eaea40a6c"}],"id":"af0d5f52-d1f9-499e-8a50-a956bde2f223","_postman_id":"af0d5f52-d1f9-499e-8a50-a956bde2f223","description":""},{"name":"cdn","item":[{"name":"customers","item":[{"name":"Cdn Get Customer Quota Info","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});\r\n\r\n"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number').and.at.least(1);\n    pm.expect(json.results, 'results').to.be.an('array').and.not.empty;\n});\n\npm.test('First result has all expected fields and types', function () {\n    const item = pm.response.json().results[0];\n    ['siteId', 'limit', 'value', 'legacyValue', 'legacyFileCount', 'total', 'fileCount', 'email', 'name', 'status'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.siteId, 'siteId').to.be.a('number').and.above(0);\n    pm.expect(item.limit, 'limit').to.be.a('number').and.at.least(0);\n    pm.expect(item.value, 'value').to.be.a('number').and.at.least(0);\n    pm.expect(item.legacyValue, 'legacyValue').to.be.a('number').and.at.least(0);\n    pm.expect(item.legacyFileCount, 'legacyFileCount').to.be.a('number').and.at.least(0);\n    pm.expect(item.total, 'total').to.be.a('number').and.at.least(0);\n    pm.expect(item.fileCount, 'fileCount').to.be.a('number').and.at.least(0);\n    pm.expect(item.email, 'email').to.be.a('string').and.not.empty;\n    pm.expect(item.name, 'name').to.be.a('string').and.not.empty;\n    pm.expect(item.status, 'status').to.be.a('string').and.not.empty;\n});"]}}],"id":"1dbdc9e4-dc4d-4baf-8bc6-2c898d754ed0","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/admin/cdn/customers?&page=0&pageSize=50","urlObject":{"path":["api","v1","admin","cdn","customers"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":null,"value":""},{"key":"page","value":"0"},{"key":"pageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"1dbdc9e4-dc4d-4baf-8bc6-2c898d754ed0"}],"id":"19ef1e16-88c8-44cd-aa63-efbbdb0293f1","_postman_id":"19ef1e16-88c8-44cd-aa63-efbbdb0293f1","description":""},{"name":"add-customer-quota","item":[{"name":"Cdn Add Customer Quota","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\nconst soapBaseUrl = pm.environment.get(\"ServiceSoapBaseUrl\");\n\nif (cookie) {\n    pm.request.addHeader({ key: \"Cookie\", value: `jvlpsi=${cookie};` });\n}\n\nfunction send(opts) {\n    return new Promise(function (resolve, reject) {\n        pm.sendRequest(opts, function (err, res) {\n            if (err) reject(err);\n            else resolve(res);\n        });\n    });\n}\n\nfunction randomString(length) {\n    const characters = \"abcdefghijklmnopqrstuvwxyz0123456789\";\n    let result = \"\";\n    for (let i = 0; i < length; i++) {\n        result += characters.charAt(Math.floor(Math.random() * characters.length));\n    }\n    return result;\n}\n\n// add-customer-quota inserts the FileQuota row and returns 400 once the site has one, so a\n// 200 is only reachable for a site that never had a CDN quota. Signup does not create the\n// row (it is added lazily on the first /cdn/quotas call), so a fresh account is required.\nconst suffix = randomString(10);\nconst userName = \"_smoove_pm\" + suffix;\nconst soapBody = [\n    '<?xml version=\"1.0\" encoding=\"utf-8\"?>',\n    '<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">',\n    '    <soap:Body>',\n    '        <CreateAccount xmlns=\"http://atplogic.com/\">',\n    '            <language>he-IL</language>',\n    '            <userName>' + userName + '</userName>',\n    '            <password>Pm' + suffix + '1a</password>',\n    '            <firstName>Postman</firstName>',\n    '            <lastName>CdnQuota</lastName>',\n    '            <email>' + suffix + '@smoove.smoove.postman.test</email>',\n    '            <phone>0500000000</phone>',\n    '            <companyName>postman</companyName>',\n    '            <resellerID>' + pm.environment.get('smooveApiResellerId') + '</resellerID>',\n    '            <affiliate/>',\n    '            <refererLink/>',\n    '            <refererCode/>',\n    '            <currency>ILS</currency>',\n    '            <userIP>127.0.0.1</userIP>',\n    '            <userIPCountry>Israel</userIPCountry>',\n    '            <signupPhase>4</signupPhase>',\n    '            <externalProviderSignupOrigin>None</externalProviderSignupOrigin>',\n    '            <requireMfa>false</requireMfa>',\n    '        </CreateAccount>',\n    '    </soap:Body>',\n    '</soap:Envelope>'\n].join(\"\\n\");\n\nconst createRes = await send({\n    url: soapBaseUrl + \"/service.asmx\",\n    method: \"POST\",\n    header: {\n        \"Content-Type\": \"text/xml; charset=utf-8\",\n        \"SOAPAction\": \"http://atplogic.com/CreateAccount\"\n    },\n    body: { mode: \"raw\", raw: soapBody }\n});\n\nif (!createRes || createRes.code !== 200) {\n    throw new Error(\"CreateAccount failed with status \" + (createRes && createRes.code));\n}\n\n// CreateAccountResult is the siteId; 0 means the signup failed and the error is in <error>.\nconst createText = createRes.text();\nfunction soapValue(tag) {\n    const match = new RegExp(\"<\" + tag + \">(-?\\\\d+)</\" + tag + \">\").exec(createText);\n    return match ? Number(match[1]) : 0;\n}\n\nconst siteId = soapValue(\"CreateAccountResult\");\nif (!(siteId > 0)) {\n    throw new Error(\"CreateAccount did not return a siteId: \" + createText);\n}\n\npm.environment.set(\"smooveApiCdnQuotaSiteId\", String(siteId));\npm.environment.set(\"smooveApiCdnQuotaAmount\", \"10000\");\n// Needed by the teardown below: the account cannot be deleted, only deactivated.\npm.environment.set(\"smooveApiCdnQuotaAdministratorId\", String(soapValue(\"administratorId\")));\npm.environment.set(\"smooveApiCdnQuotaDataAccountId\", String(soapValue(\"dataAccountId\")));"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Quota was created for the new account', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json.siteId, 'siteId').to.eql(Number(pm.environment.get(\"smooveApiCdnQuotaSiteId\")));\n    pm.expect(json.limit, 'limit').to.eql(Number(pm.environment.get(\"smooveApiCdnQuotaAmount\")));\n    pm.expect(json.value, 'value').to.eql(0);\n    pm.expect(json.fileCount, 'fileCount').to.eql(0);\n});\n\npm.test('Response matches status contract', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    // Fresh accounts may omit email/name/status; numeric quota fields are always present.\n    [\"siteId\", \"limit\", \"value\", \"legacyValue\", \"legacyFileCount\", \"total\", \"fileCount\"].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n    if (json.email !== undefined) pm.expect(json.email, 'email').to.be.a('string');\n    if (json.name !== undefined) pm.expect(json.name, 'name').to.be.a('string');\n    if (json.status !== undefined) pm.expect(json.status, 'status').to.be.a('string');\n});\n\n// There is no delete-account API anywhere (the DeleteAccount proc is only a signup\n// rollback), so the closest teardown is deactivating the account we just created.\nasync function deactivateCreatedAccount() {\n    const administratorId = Number(pm.environment.get(\"smooveApiCdnQuotaAdministratorId\") || 0);\n    const dataAccountId = Number(pm.environment.get(\"smooveApiCdnQuotaDataAccountId\") || 0);\n    if (!(administratorId > 0) || !(dataAccountId > 0)) return;\n\n    const serviceBag = [\n        '&lt;DataBag&gt;',\n        '&lt;AdministratorID type=\"System.Int32\"&gt;' + administratorId + '&lt;/AdministratorID&gt;',\n        '&lt;DataAccountID type=\"System.Int32\"&gt;' + dataAccountId + '&lt;/DataAccountID&gt;',\n        '&lt;IsActive type=\"System.Boolean\"&gt;false&lt;/IsActive&gt;',\n        '&lt;/DataBag&gt;'\n    ].join(\"\");\n\n    const soapBody = [\n        '<?xml version=\"1.0\" encoding=\"utf-8\"?>',\n        '<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">',\n        '    <soap:Body>',\n        '        <ActivateOrDeactivateAccount xmlns=\"http://atplogic.com/\">',\n        '            <serviceBag>' + serviceBag + '</serviceBag>',\n        '        </ActivateOrDeactivateAccount>',\n        '    </soap:Body>',\n        '</soap:Envelope>'\n    ].join(\"\\n\");\n\n    const res = await pm.sendRequest({\n        url: pm.environment.get(\"ServiceSoapBaseUrl\") + \"/service.asmx\",\n        method: \"POST\",\n        header: {\n            \"Content-Type\": \"text/xml; charset=utf-8\",\n            \"SOAPAction\": \"http://atplogic.com/ActivateOrDeactivateAccount\"\n        },\n        body: { mode: \"raw\", raw: soapBody }\n    });\n\n    pm.test(\"Cleanup: created account deactivated\", function () {\n        pm.expect(res.code, 'status code').to.eql(200);\n        pm.expect(res.text(), 'ActivateOrDeactivateAccountResult')\n            .to.include(\"<ActivateOrDeactivateAccountResult>true</ActivateOrDeactivateAccountResult>\");\n    });\n}\n\nawait deactivateCreatedAccount();"]}}],"id":"d620e2b5-f1ab-4b59-95f6-636b9a70674f","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/admin/cdn/add-customer-quota?siteId={{smooveApiCdnQuotaSiteId}}&amount={{smooveApiCdnQuotaAmount}}&description=postman add customer quota","urlObject":{"path":["api","v1","admin","cdn","add-customer-quota"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"siteId","value":"{{smooveApiCdnQuotaSiteId}}"},{"key":"amount","value":"{{smooveApiCdnQuotaAmount}}"},{"key":"description","value":"postman add customer quota"}],"variable":[]}},"response":[],"_postman_id":"d620e2b5-f1ab-4b59-95f6-636b9a70674f"}],"id":"3db6de62-eba6-445c-b170-d09339b42515","_postman_id":"3db6de62-eba6-445c-b170-d09339b42515","description":""},{"name":"statistic","item":[{"name":"Cdn Get Statistic","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});\r\n"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['value', 'legacyValue', 'legacyFileCount', 'fileCount'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n        pm.expect(json[key], key).to.be.a('number');\n    });\n});\n\npm.test('Statistic counts are non-negative', function () {\n    const json = pm.response.json();\n    pm.expect(json.value, 'value').to.be.at.least(0);\n    pm.expect(json.legacyValue, 'legacyValue').to.be.at.least(0);\n    pm.expect(json.legacyFileCount, 'legacyFileCount').to.be.at.least(0);\n    pm.expect(json.fileCount, 'fileCount').to.be.at.least(0);\n});"]}}],"id":"8ae5f8af-677f-41f1-a292-d01a263aff1a","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/admin/cdn/statistic","urlObject":{"path":["api","v1","admin","cdn","statistic"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8ae5f8af-677f-41f1-a292-d01a263aff1a"}],"id":"532a9e92-3764-4d9f-bf78-8eebfa396d4d","_postman_id":"532a9e92-3764-4d9f-bf78-8eebfa396d4d","description":""}],"id":"c8a85f4b-e984-4da2-9ce3-35a460eae35b","_postman_id":"c8a85f4b-e984-4da2-9ce3-35a460eae35b","description":""},{"name":"customer","item":[{"name":"{siteId}","item":[{"name":"promotions","item":[{"name":"Customer Get Promotions","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});\r\n"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number').and.at.least(1);\n    pm.expect(json.results, 'results').to.be.an('array').and.not.empty;\n});\n\npm.test('First promotion has all expected fields and types', function () {\n    const item = pm.response.json().results[0];\n    const expectedSiteId = Number(pm.environment.get('smooveApiAccountSiteId'));\n    ['siteId', 'type', 'value', 'result', 'promotedAt', 'description', 'author'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.siteId, 'siteId').to.eql(expectedSiteId);\n    pm.expect(item.type, 'type').to.be.a('string').and.not.empty;\n    pm.expect(item.value, 'value').to.be.a('number');\n    pm.expect(item.result, 'result').to.be.a('number');\n    pm.expect(item.promotedAt, 'promotedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.promotedAt)), 'promotedAt parseable').to.equal(false);\n    pm.expect(item.description == null || typeof item.description === 'string', 'description').to.equal(true);\n    pm.expect(item.author, 'author').to.be.an('object');\n    pm.expect(item.author, 'missing author.id').to.have.property('id');\n    pm.expect(item.author, 'missing author.name').to.have.property('name');\n    pm.expect(item.author.id, 'author.id').to.be.a('number');\n    pm.expect(item.author.name, 'author.name').to.be.a('string');\n});"]}}],"id":"c59add81-9c97-404c-b3aa-06f9b3ee2a4d","request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/admin/customer/{{smooveApiAccountSiteId}}/promotions?page=0&pageSize=50","urlObject":{"path":["api","v1","admin","customer","{{smooveApiAccountSiteId}}","promotions"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"page","value":"0"},{"key":"pageSize","value":"50"}],"variable":[]}},"response":[],"_postman_id":"c59add81-9c97-404c-b3aa-06f9b3ee2a4d"},{"name":"Customer Add Promotion","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['siteId', 'type', 'value', 'result', 'promotedAt', 'description', 'author'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.siteId, 'siteId').to.be.a('number');\n    pm.expect(json.type, 'type').to.be.a('string').and.not.empty;\n    pm.expect(json.value, 'value').to.be.a('number');\n    pm.expect(json.result, 'result').to.be.a('number');\n    pm.expect(json.promotedAt, 'promotedAt').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(json.promotedAt)), 'promotedAt parseable').to.equal(false);\n    pm.expect(json.description == null || typeof json.description === 'string', 'description').to.equal(true);\n    pm.expect(json.author, 'author').to.be.an('object');\n    pm.expect(json.author.id, 'author.id').to.be.a('number');\n    pm.expect(json.author.name, 'author.name').to.be.a('string');\n});\n\npm.test('Created promotion echoes the request', function () {\n    const json = pm.response.json();\n    const expectedSiteId = Number(pm.environment.get('smooveApiAccountSiteId'));\n    pm.expect(json.siteId, 'siteId').to.eql(expectedSiteId);\n    pm.expect(json.value, 'value').to.eql(1);\n    pm.expect(json.description, 'description').to.eql('Automated promotion with registration');\n});"]}}],"id":"099c34cf-0e5b-4589-b811-fe98f71facc6","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"text/plain"}],"body":{"mode":"raw","raw":"{\n    \"value\": 1,\n    \"description\": \"Automated promotion with registration\",\n    \"reason\": 3\n}","options":{"raw":{"language":"json"}}},"url":"{{smooveApiBaseURL}}/api/v1/admin/customer/{{smooveApiAccountSiteId}}/promotions","urlObject":{"path":["api","v1","admin","customer","{{smooveApiAccountSiteId}}","promotions"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"099c34cf-0e5b-4589-b811-fe98f71facc6"}],"id":"fdfd3ba2-4368-4413-a1d2-1ecd4f3e45e7","_postman_id":"fdfd3ba2-4368-4413-a1d2-1ecd4f3e45e7","description":""}],"id":"55409f29-b477-44f6-b265-70df65ff93e8","_postman_id":"55409f29-b477-44f6-b265-70df65ff93e8","description":""},{"name":"get-legacy-content-size","item":[{"name":"{userName}","item":[{"name":"Customer Get Legacy Content Size By User","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const cookie = pm.environment.get(\"smooveApiCookie\");\npm.request.addHeader({\n    key: \"Cookie\",\n    value: `jvlpsi=${cookie};`\n});\n\nconst userName = pm.environment.get(\"smooveApiUsername\");\nif (!userName) {\n    throw new Error(\"smooveApiUsername is required for Get Legacy Content Size by user\");\n}"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const allowedTypes = ['success', 'generalInfoNotFound', 'error', 'folderNotFound'];\n\npm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON ContentCalculationResult', function () {\n    pm.response.to.be.json;\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    pm.expect(json, 'missing filesCount').to.have.property('filesCount');\n    pm.expect(json, 'missing contentSize').to.have.property('contentSize');\n    pm.expect(json, 'missing type').to.have.property('type');\n    pm.expect(json.filesCount, 'filesCount').to.be.a('number').and.at.least(0);\n    pm.expect(json.contentSize, 'contentSize').to.be.a('number').and.at.least(0);\n    pm.expect(allowedTypes, 'type').to.include(json.type);\n    if (json.message !== undefined) {\n        pm.expect(json.message, 'message').to.be.a('string');\n    }\n});\n\npm.test('Known DEV user folder resolves successfully', function () {\n    const json = pm.response.json();\n    pm.expect(json.type, 'type').to.eql('success');\n    pm.expect(json.filesCount, 'filesCount').to.be.at.least(0);\n    pm.expect(json.contentSize, 'contentSize').to.be.at.least(0);\n});"]}}],"id":"c63f1912-16bf-4a2e-bfd0-3b1e8b2f1ff8","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"{{smooveApiBaseURL}}/api/v1/admin/customer/get-legacy-content-size/:userName","urlObject":{"path":["api","v1","admin","customer","get-legacy-content-size",":userName"],"host":["{{smooveApiBaseURL}}"],"query":[],"variable":[{"type":"any","value":"{{smooveApiUsername}}","key":"userName"}]}},"response":[],"_postman_id":"c63f1912-16bf-4a2e-bfd0-3b1e8b2f1ff8"}],"id":"bc348aa4-b559-49ad-8d40-d2d999eac295","_postman_id":"bc348aa4-b559-49ad-8d40-d2d999eac295","description":""}],"id":"0b6aee3b-3f1b-484f-ac49-5f510970c793","_postman_id":"0b6aee3b-3f1b-484f-ac49-5f510970c793","description":""},{"name":"search","item":[{"name":"Customer Search","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});\r\n"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Pagination fields exist and have expected types', function () {\n    const json = pm.response.json();\n    ['current', 'pages', 'size', 'rows', 'results'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.current, 'current').to.be.a('number');\n    pm.expect(json.pages, 'pages').to.be.a('number');\n    pm.expect(json.size, 'size').to.be.a('number');\n    pm.expect(json.rows, 'rows').to.be.a('number').and.at.least(1);\n    pm.expect(json.results, 'results').to.be.an('array').and.not.empty;\n});\n\npm.test('First result has all expected fields and types', function () {\n    const item = pm.response.json().results[0];\n    ['id', 'siteId', 'mainSiteId', 'mainSiteIdParsed', 'resellerId', 'maxContacts', 'importOptInRequired', 'isExternalIdEnabled', 'isPortalPasswordRequired', 'portalState', 'planType', 'dateCreated', 'landingPagesQuota', 'embeddedFormsQuota', 'smartphoneCampaignQuota', 'popupsQuota', 'formsQuota', 'allowPermanentDeletion', 'smsApiProvider', 'mainAdministratorId', 'isMainAdministrator', 'automationsQuota', 'categoriesQuota', 'isFreemiumSubscription', 'isGlobalAdminRole', 'name', 'username', 'email'].forEach(function (key) {\n        pm.expect(item, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(item.id, 'id').to.be.a('number').and.above(0);\n    pm.expect(item.siteId, 'siteId').to.be.a('number').and.above(0);\n    pm.expect(item.mainSiteId, 'mainSiteId').to.be.a('number');\n    pm.expect(item.mainSiteIdParsed, 'mainSiteIdParsed').to.be.a('number');\n    pm.expect(item.resellerId, 'resellerId').to.be.a('number');\n    pm.expect(item.maxContacts, 'maxContacts').to.be.a('number');\n    pm.expect(item.importOptInRequired, 'importOptInRequired').to.be.a('boolean');\n    pm.expect(item.isExternalIdEnabled, 'isExternalIdEnabled').to.be.a('boolean');\n    pm.expect(item.isPortalPasswordRequired, 'isPortalPasswordRequired').to.be.a('boolean');\n    pm.expect(item.portalState, 'portalState').to.be.a('number');\n    pm.expect(item.planType, 'planType').to.be.a('string').and.not.empty;\n    pm.expect(item.dateCreated, 'dateCreated').to.be.a('string');\n    pm.expect(Number.isNaN(Date.parse(item.dateCreated)), 'dateCreated parseable').to.equal(false);\n    pm.expect(item.landingPagesQuota, 'landingPagesQuota').to.be.a('number');\n    pm.expect(item.embeddedFormsQuota, 'embeddedFormsQuota').to.be.a('number');\n    pm.expect(item.smartphoneCampaignQuota, 'smartphoneCampaignQuota').to.be.a('number');\n    pm.expect(item.popupsQuota, 'popupsQuota').to.be.a('number');\n    pm.expect(item.formsQuota, 'formsQuota').to.be.a('number');\n    pm.expect(item.allowPermanentDeletion, 'allowPermanentDeletion').to.be.a('boolean');\n    pm.expect(item.smsApiProvider, 'smsApiProvider').to.be.a('number');\n    pm.expect(item.mainAdministratorId, 'mainAdministratorId').to.be.a('number');\n    pm.expect(item.isMainAdministrator, 'isMainAdministrator').to.be.a('boolean');\n    pm.expect(item.automationsQuota, 'automationsQuota').to.be.a('number');\n    pm.expect(item.categoriesQuota, 'categoriesQuota').to.be.a('number');\n    pm.expect(item.isFreemiumSubscription, 'isFreemiumSubscription').to.be.a('boolean');\n    pm.expect(item.isGlobalAdminRole, 'isGlobalAdminRole').to.be.a('boolean');\n    pm.expect(item.name, 'name').to.be.a('string');\n    pm.expect(item.username, 'username').to.be.a('string');\n    pm.expect(item.email, 'email').to.be.a('string');\n});\n\npm.test('Search finds the automation account by username', function () {\n    const json = pm.response.json();\n    const expectedSiteId = Number(pm.environment.get('smooveApiAccountSiteId'));\n    const match = json.results.find(function (r) { return r.siteId === expectedSiteId; });\n    pm.expect(match, 'result for site ' + expectedSiteId).to.be.an('object');\n    pm.expect(match.username, 'username').to.eql(pm.environment.get('smooveApiCustomerSearchPattern'));\n});"]}}],"id":"7058cfbb-5414-4b16-867a-346448e0a638","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"text/plain"}],"url":"{{smooveApiBaseURL}}/api/v1/admin/customer/search?pattern={{smooveApiCustomerSearchPattern}}&page=0&pageSize=10","urlObject":{"path":["api","v1","admin","customer","search"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"pattern","value":"{{smooveApiCustomerSearchPattern}}"},{"key":"page","value":"0"},{"key":"pageSize","value":"10"}],"variable":[]}},"response":[],"_postman_id":"7058cfbb-5414-4b16-867a-346448e0a638"}],"id":"a1ed73c1-d4fc-4e8f-a320-3a08eeb6fb37","_postman_id":"a1ed73c1-d4fc-4e8f-a320-3a08eeb6fb37","description":""},{"name":"Customer Get Customer By Site Id","event":[{"listen":"prerequest","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["let cookie = pm.environment.get(\"smooveApiCookie\");\r\n\r\npm.request.addHeader({\r\n    key: 'Cookie',\r\n    value: `jvlpsi=${cookie};`\r\n});\r\n"]}},{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["pm.test('Status code is 200', function () {\n    pm.response.to.have.status(200);\n});\n\npm.test('Response is JSON', function () {\n    pm.response.to.be.json;\n});\n\npm.test('Response object has all expected fields and types', function () {\n    const json = pm.response.json();\n    pm.expect(json).to.be.an('object');\n    ['CustomerID', 'CustomerName', 'CustomerUserName', 'CustomerEmail', 'SiteId'].forEach(function (key) {\n        pm.expect(json, 'missing ' + key).to.have.property(key);\n    });\n    pm.expect(json.CustomerID, 'CustomerID').to.be.a('number').and.above(0);\n    pm.expect(json.CustomerName, 'CustomerName').to.be.a('string');\n    pm.expect(json.CustomerUserName, 'CustomerUserName').to.be.a('string').and.not.empty;\n    pm.expect(json.CustomerEmail, 'CustomerEmail').to.be.a('string');\n    pm.expect(json.SiteId, 'SiteId').to.be.a('number');\n});\n\npm.test('Customer matches the requested site', function () {\n    const json = pm.response.json();\n    const expectedSiteId = Number(pm.environment.get('smooveApiAccountSiteId') || pm.environment.get('smooveApiSiteId'));\n    pm.expect(json.SiteId, 'SiteId').to.eql(expectedSiteId);\n});"]}}],"id":"b400a458-72f9-4317-82d8-3526d8f3655f","request":{"auth":{"type":"apikey","apikey":{"basicConfig":[{"key":"key","value":"apiKey"},{"key":"value","value":"{{apiKey}}"}]},"isInherited":false},"method":"GET","header":[{"key":"Accept","value":"*/*"}],"url":"{{smooveApiBaseURL}}/api/v1/admin/customer?siteId={{smooveApiAccountSiteId}}","urlObject":{"path":["api","v1","admin","customer"],"host":["{{smooveApiBaseURL}}"],"query":[{"key":"siteId","value":"{{smooveApiAccountSiteId}}"}],"variable":[]}},"response":[],"_postman_id":"b400a458-72f9-4317-82d8-3526d8f3655f"}],"id":"760e63c1-18e3-4c3b-82be-c5d2a9e1b4ab","_postman_id":"760e63c1-18e3-4c3b-82be-c5d2a9e1b4ab","description":""}],"id":"449d4f57-1166-471b-814e-3aaef5be641f","_postman_id":"449d4f57-1166-471b-814e-3aaef5be641f","description":""}],"id":"af686b62-9f5a-463f-b75a-ee8d94cc4e46","_postman_id":"af686b62-9f5a-463f-b75a-ee8d94cc4e46","description":""}],"event":[{"listen":"test","script":{"type":"text/javascript","packages":{},"requests":{},"exec":["const maxRetries = 2;\nconst responseStatus = pm.response.code;\n\nif ((responseStatus < 200 || responseStatus >= 300) && _.parseInt(pm.environment.get('retryCounter')) < maxRetries) {\n    console.log(\"Got HTTP \" + responseStatus + \" code, Retrying request \" + pm.info.requestName);\n    pm.environment.set('retryCounter', _.parseInt(pm.environment.get('retryCounter')) + 1);\n    postman.setNextRequest(pm.info.requestName);\n} else {\n    pm.environment.set('retryCounter', 1);\n    postman.setNextRequest();\n}"]}}],"variable":[{"key":"cvv","value":""},{"key":"expectedResult","value":""},{"key":"testCases","value":""},{"key":"expectedResults","value":""},{"key":"smooveStudioImageDelete","value":""},{"key":"customFieldId","value":""},{"key":"customFieldExistedBeforeDelete","value":""},{"key":"moveFieldId","value":""},{"key":"moveFieldGroupId","value":""}]}