{"info":{"_postman_id":"c8e0d25f-2da5-4c6e-a3be-1e52684d1f23","name":"eggup V2.5","description":"Eggup API methods collection. V2.2 06/08/2020","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json"},"item":[{"name":"User methods","item":[{"name":"user.create","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":[""],"type":"text/javascript"}},{"listen":"test","script":{"id":"109c30d3-048a-46ea-9ec0-7914c02c2d3b","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","// response JSON Schema validation","const customerSchema = {","    \"status\": 0,","    \"result\": {","        \"success\": true,","        \"user_guid\": {","            \"type\": \"Integer\",","            \"minLength\": 1,","            \"maxLength\": 20","        }","    }","};","","if(success === true ){","    // Test whether the response matches the schema","    var customer = JSON.parse(responseBody);","    tests[\"use_guid is valid\"] = tv4.validate(customer, customerSchema);","    pm.environment.set(\"user_guid\", jsonData.result.user_guid);","    postman.setNextRequest(\"user.get\");","}"],"type":"text/javascript"}}],"id":"31922390-a4ec-4bba-bcf6-0034d91dae77","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-eggup-apikey","value":"{{keyPublic}}","type":"text"},{"key":"X-eggup-time","value":"{{timestamp}}","type":"text"},{"key":"X-eggup-nonce","value":"{{nonce}}","type":"text"},{"key":"X-eggup-hmac-algo","value":"sha1","type":"text"},{"key":"X-eggup-hmac","value":"{{hmac}}","type":"text"},{"key":"X-eggup-posthash","value":"{{posthash}}","type":"text"},{"key":"X-eggup-posthash-algo","value":"md5","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/octet-stream","type":"text"}],"url":{"raw":"{{endpoint}}?method=user.create&name={{$randomFirstName}}%20{{$randomLastName}}&email={{$randomEmail}}&username=APiuser_{{keyPublic}}_{{$randomInt}}&password={{$randomPassword}}&metadata[IP]={{$randomIP}}&metadata[metadata2]=APIUserTest&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"user.create","description":"The current method name to be called."},{"key":"name","value":"{{$randomFirstName}}%20{{$randomLastName}}","description":"The fullname of the user, it will be used in report method to generate the PDF report."},{"key":"email","value":"{{$randomEmail}}","description":"The email of this account."},{"key":"username","value":"APiuser_{{keyPublic}}_{{$randomInt}}","description":"The username you want to choose for this account, to avoid existing errors is preferred to use a prefix."},{"key":"password","value":"{{$randomPassword}}","description":"The password to be assigned to the user account."},{"key":"metadata[IP]","value":"{{$randomIP}}","description":"Custom metadata as \"metadata[name] => value\"."},{"key":"metadata[metadata2]","value":"APIUserTest"},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Create a new user account over API."},"response":[{"id":"4fc0c866-f1c2-4161-bc87-2a5d5340afcf","name":"user.create","originalRequest":{"method":"POST","header":[{"key":"X-eggup-apikey","value":"{{keyPublic}}","type":"text"},{"key":"X-eggup-time","value":"{{timestamp}}","type":"text"},{"key":"X-eggup-nonce","value":"{{nonce}}","type":"text"},{"key":"X-eggup-hmac-algo","value":"sha1","type":"text"},{"key":"X-eggup-hmac","value":"{{hmac}}","type":"text"},{"key":"X-eggup-posthash","value":"{{posthash}}","type":"text"},{"key":"X-eggup-posthash-algo","value":"md5","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/octet-stream","type":"text"},{"key":"Content-Length","value":"{{contentLength}}","type":"text"}],"url":{"raw":"{{endpoint}}?method=user.create&name={{$randomFirstName}}%20{{$randomLastName}}&email={{$randomEmail}}&username=APiuser_{{keyPublic}}_{{$randomInt}}&password={{$randomPassword}}&metadata[IP]={{$randomIP}}&metadata[metadata2]=APIUserTest","host":["{{endpoint}}"],"query":[{"key":"method","value":"user.create"},{"key":"name","value":"{{$randomFirstName}}%20{{$randomLastName}}"},{"key":"email","value":"{{$randomEmail}}"},{"key":"username","value":"APiuser_{{keyPublic}}_{{$randomInt}}"},{"key":"password","value":"{{$randomPassword}}"},{"key":"metadata[IP]","value":"{{$randomIP}}"},{"key":"metadata[metadata2]","value":"APIUserTest"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Date","value":"Thu, 24 Oct 2019 10:02:04 GMT"},{"key":"Server","value":"Apache/2.4.39 (Unix) PHP/5.6.40"},{"key":"X-Powered-By","value":"PHP/5.6.40"},{"key":"Expires","value":"Thu, 19 Nov 1981 08:52:00 GMT"},{"key":"Cache-Control","value":"no-store, no-cache, must-revalidate, post-check=0, pre-check=0"},{"key":"Pragma","value":"no-cache"},{"key":"Content-Length","value":"56"},{"key":"Keep-Alive","value":"timeout=5, max=100"},{"key":"Connection","value":"Keep-Alive"},{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n    \"status\": 0,\n    \"result\": {\n        \"success\": true,\n        \"user_guid\": 28149\n    }\n}"}],"_postman_id":"31922390-a4ec-4bba-bcf6-0034d91dae77"},{"name":"user.get","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":["pm.test('user_guid should exist', function () {","    pm.expect(pm.environment.has('user_guid')).to.equal(true);","});","if(!pm.environment.has('user_guid')){","    throw new Error(\"Environment params are not set.\");","}"],"type":"text/javascript"}},{"listen":"test","script":{"id":"17db85cd-2ab1-4937-bbda-08d0a1200367","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","if(success === true ){","    postman.setNextRequest(\"user.update\");","}"],"type":"text/javascript"}}],"id":"65722525-a413-45f2-92b6-cbffa8aedce8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"X-eggup-apikey","value":"{{keyPublic}}","type":"text"},{"key":"X-eggup-time","value":"{{timestamp}}","type":"text"},{"key":"X-eggup-nonce","value":"{{nonce}}","type":"text"},{"key":"X-eggup-hmac-algo","value":"sha1","type":"text"},{"key":"X-eggup-hmac","value":"{{hmac}}","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/octet-stream","type":"text"}],"url":{"raw":"{{endpoint}}?method=user.get&user_guid={{user_guid}}&language=it","host":["{{endpoint}}"],"query":[{"key":"method","value":"user.get","description":"The current method name to be called."},{"key":"user_guid","value":"{{user_guid}}","description":"The {{user_guid}} that identy the user account."},{"key":"language","value":"it","description":"The language to be used in output."}]},"description":"Get user account information."},"response":[],"_postman_id":"65722525-a413-45f2-92b6-cbffa8aedce8"},{"name":"user.update","event":[{"listen":"prerequest","script":{"id":"bdd2744d-83f9-408f-8e99-680fbd3d87e4","exec":["pm.test('user_guid should exist', function () {","    pm.expect(pm.environment.has('user_guid')).to.equal(true);","});","if(!pm.environment.has('user_guid')){","    throw new Error(\"Environment param 'user_guid' is not set.\");","}"],"type":"text/javascript"}},{"listen":"test","script":{"id":"b2e89713-ca56-45c6-bf5e-5f09bc3e8d1c","exec":["pm.test(\"okay to process\", function () {","    tests[\"Status code is 200\"] = responseCode.code === 200; //Status code validation","    tests[\"Response time is acceptable\"] = responseTime < 2000; // milliseconds","    ","    // response JSON Schema validation","    const customerSchema = {","        \"status\": 0,","        \"result\": {","            \"success\": true","        }","    };","    // Test whether the response matches the schema","    var customer = JSON.parse(responseBody);","    tests[\"Customer is valid\"] = tv4.validate(customer, customerSchema);","    ","    var status = customer.status;","","    tests[\"Status is equal to 0\"] = status === 0;","","});"],"type":"text/javascript"}}],"id":"8e5215e9-50ce-44bc-9281-3be17d8569d0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-eggup-apikey","value":"{{keyPublic}}","type":"text"},{"key":"X-eggup-time","value":"{{timestamp}}","type":"text"},{"key":"X-eggup-nonce","value":"{{nonce}}","type":"text"},{"key":"X-eggup-hmac-algo","value":"sha1","type":"text"},{"key":"X-eggup-hmac","value":"{{hmac}}","type":"text"},{"key":"X-eggup-posthash","value":"{{posthash}}","type":"text"},{"key":"X-eggup-posthash-algo","value":"md5","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/octet-stream","type":"text"}],"url":{"raw":"{{endpoint}}?method=user.update&user_guid={{user_guid}}&name={{$randomFirstName}}%20{{$randomLastName}}&email={{$randomEmail}}&password={{$randomPassword}}&metadata[IP]={{$randomIP}}&metadata[metadata2]=APIUserTest&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"user.update","description":"The current method name to be called."},{"key":"user_guid","value":"{{user_guid}}","description":"The {{user_guid}} that identy the user account."},{"key":"name","value":"{{$randomFirstName}}%20{{$randomLastName}}","description":"The fullname of the user, it will be used in report method to generate the PDF report."},{"key":"email","value":"{{$randomEmail}}","description":"The email of this account."},{"key":"password","value":"{{$randomPassword}}","description":"The password to be assigned to the user account."},{"key":"metadata[IP]","value":"{{$randomIP}}","description":"Custom metadata as \"metadata[name] => value\"."},{"key":"metadata[metadata2]","value":"APIUserTest"},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Update user account information."},"response":[],"_postman_id":"8e5215e9-50ce-44bc-9281-3be17d8569d0"},{"name":"user.delete","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":["pm.test('user_guid should exist', function () {","    pm.expect(pm.environment.has('user_guid')).to.equal(true);","});","if(!pm.environment.has('user_guid')){","    throw new Error(\"Environment param 'user_guid' is not set.\");","}"],"type":"text/javascript"}},{"listen":"test","script":{"id":"b117e008-210c-469d-9a60-025b597ee465","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","if(success === true ){","    pm.environment.unset(\"user_guid\");","}"],"type":"text/javascript"}}],"id":"7a5a8928-f8a2-427f-9f52-e3eaf686185d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"},{"key":"X-eggup-posthash","type":"text","value":"{{posthash}}"},{"key":"X-eggup-posthash-algo","type":"text","value":"md5"},{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/octet-stream"}],"url":{"raw":"{{endpoint}}?method=user.delete&user_guid={{user_guid}}&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"user.delete","description":"The current method name to be called."},{"key":"user_guid","value":"{{user_guid}}","description":"The {{user_guid}} that identy the user account."},{"key":"language","value":"en","description":"The language to be used in output.","type":"text"}]},"description":"Delete a user account."},"response":[],"_postman_id":"7a5a8928-f8a2-427f-9f52-e3eaf686185d"},{"name":"user.login","event":[{"listen":"prerequest","script":{"id":"55daf9b4-426a-468e-8c9f-5b977cb9fdf9","exec":[""],"type":"text/javascript"}},{"listen":"test","script":{"id":"ce803c7e-6b21-4bb9-9fb8-a3dea7753963","exec":[""],"type":"text/javascript"}}],"id":"87a22e94-8155-4ed4-9cbe-c1d1f33316b3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"},{"key":"X-eggup-posthash","type":"text","value":"{{posthash}}"},{"key":"X-eggup-posthash-algo","type":"text","value":"md5"},{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/octet-stream"}],"url":{"raw":"{{endpoint}}?method=user.login&user=&password=&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"user.login","description":"The current method name to be called."},{"key":"user","value":"","description":"The username or email to be used to login."},{"key":"password","value":"","description":"The password associated with the user account."},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Get a login token to logon a user to eggup webapp."},"response":[{"id":"57204e9d-5f4e-44e2-a3c1-0a726dc52a1f","name":"user.create","originalRequest":{"method":"POST","header":[{"key":"X-eggup-apikey","value":"{{keyPublic}}","type":"text"},{"key":"X-eggup-time","value":"{{timestamp}}","type":"text"},{"key":"X-eggup-nonce","value":"{{nonce}}","type":"text"},{"key":"X-eggup-hmac-algo","value":"sha1","type":"text"},{"key":"X-eggup-hmac","value":"{{hmac}}","type":"text"},{"key":"X-eggup-posthash","value":"{{posthash}}","type":"text"},{"key":"X-eggup-posthash-algo","value":"md5","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/octet-stream","type":"text"},{"key":"Content-Length","value":"{{contentLength}}","type":"text"}],"url":{"raw":"{{endpoint}}?method=user.create&name={{$randomFirstName}}%20{{$randomLastName}}&email={{$randomEmail}}&username=APiuser_{{keyPublic}}_{{$randomInt}}&password={{$randomPassword}}&metadata[IP]={{$randomIP}}&metadata[metadata2]=APIUserTest","host":["{{endpoint}}"],"query":[{"key":"method","value":"user.create"},{"key":"name","value":"{{$randomFirstName}}%20{{$randomLastName}}"},{"key":"email","value":"{{$randomEmail}}"},{"key":"username","value":"APiuser_{{keyPublic}}_{{$randomInt}}"},{"key":"password","value":"{{$randomPassword}}"},{"key":"metadata[IP]","value":"{{$randomIP}}"},{"key":"metadata[metadata2]","value":"APIUserTest"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Date","value":"Thu, 24 Oct 2019 10:02:04 GMT"},{"key":"Server","value":"Apache/2.4.39 (Unix) PHP/5.6.40"},{"key":"X-Powered-By","value":"PHP/5.6.40"},{"key":"Expires","value":"Thu, 19 Nov 1981 08:52:00 GMT"},{"key":"Cache-Control","value":"no-store, no-cache, must-revalidate, post-check=0, pre-check=0"},{"key":"Pragma","value":"no-cache"},{"key":"Content-Length","value":"56"},{"key":"Keep-Alive","value":"timeout=5, max=100"},{"key":"Connection","value":"Keep-Alive"},{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n    \"status\": 0,\n    \"result\": {\n        \"success\": true,\n        \"user_guid\": 28149\n    }\n}"}],"_postman_id":"87a22e94-8155-4ed4-9cbe-c1d1f33316b3"}],"id":"63e7e839-d1a9-417b-bc3b-0a95ab10cbec","_postman_id":"63e7e839-d1a9-417b-bc3b-0a95ab10cbec"},{"name":"Test methods","item":[{"name":"traits.list","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":[""],"type":"text/javascript"}},{"listen":"test","script":{"id":"d8e3615f-a392-4604-81ff-31b4a3b7a303","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","if(success === true ){","    postman.setNextRequest(\"test.build\");","}"],"type":"text/javascript"}}],"id":"f580e66d-4f6f-4516-9331-43aa21ced092","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"X-eggup-apikey","value":"{{keyPublic}}","type":"text"},{"key":"X-eggup-time","value":"{{timestamp}}","type":"text"},{"key":"X-eggup-nonce","value":"{{nonce}}","type":"text"},{"key":"X-eggup-hmac-algo","value":"sha1","type":"text"},{"key":"X-eggup-hmac","value":"{{hmac}}","type":"text"}],"url":{"raw":"{{endpoint}}?method=traits.list&sort=test&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"traits.list","description":"The current method name to be called."},{"key":"sort","value":"test","description":"Change the output structure hierarchy (default:\"trait\", \"test\")."},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Get the list of the available traits."},"response":[],"_postman_id":"f580e66d-4f6f-4516-9331-43aa21ced092"},{"name":"test.build","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":[""],"type":"text/javascript"}},{"listen":"test","script":{"id":"336fd093-1a4a-4699-9e37-0dcc022bb66a","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","if(success === true ){","    pm.environment.set(\"hash_id\", jsonData.result.hash_id);","    postman.setNextRequest(\"traits.macro\");","}"],"type":"text/javascript"}}],"id":"0893355b-ee82-4330-8ac1-81744ffcb929","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"},{"key":"X-eggup-posthash","type":"text","value":"{{posthash}}"},{"key":"X-eggup-posthash-algo","type":"text","value":"md5"},{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/octet-stream"}],"url":{"raw":"{{endpoint}}?method=test.build&name=My%20Custom%20Test&description=This%20is%20my%custom%20test&traits[AB5C]=CSS,DPH,EMP&traits[6FPQ]=LEA,MET&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"test.build","description":"The current method name to be called."},{"key":"name","value":"My%20Custom%20Test","description":"The name to assigned to this new test."},{"key":"description","value":"This%20is%20my%custom%20test","description":"A text description that decribe this new test."},{"key":"traits[AB5C]","value":"CSS,DPH,EMP","description":"The list of traits to be used to build this custom test, as \"test_id\" => \"trait1,trait2,..\""},{"key":"traits[6FPQ]","value":"LEA,MET"},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Create a new custom test starting from a list of traits."},"response":[],"_postman_id":"0893355b-ee82-4330-8ac1-81744ffcb929"},{"name":"test.list","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":[""],"type":"text/javascript"}},{"listen":"test","script":{"id":"e695b5df-3861-4967-9112-3a93b460159b","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","if(success === true ){","    postman.setNextRequest(\"test.get\");","}"],"type":"text/javascript"}}],"id":"f1d08c7a-d527-462e-b623-aa873f5f4743","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"X-eggup-apikey","value":"{{keyPublic}}","type":"text"},{"key":"X-eggup-time","value":"{{timestamp}}","type":"text"},{"key":"X-eggup-nonce","value":"{{nonce}}","type":"text"},{"key":"X-eggup-hmac-algo","value":"sha1","type":"text"},{"key":"X-eggup-hmac","value":"{{hmac}}","type":"text"},{"key":"X-eggup-posthash","value":"","type":"text","disabled":true}],"url":{"raw":"{{endpoint}}?method=test.list&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"test.list","description":"The current method name to be called."},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Get the list of available test."},"response":[],"_postman_id":"f1d08c7a-d527-462e-b623-aa873f5f4743"},{"name":"test.get","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":["pm.test('user_guid should exist', function () {","    pm.expect(pm.environment.has('user_guid')).to.equal(true);","});","pm.test('hash_id should exist', function () {","    pm.expect(pm.environment.has('hash_id')).to.equal(true);","});","if(!pm.environment.has('user_guid')){","    throw new Error(\"Environment param 'user_guid' is not set.\");","}","if(!pm.environment.has('hash_id')){","    throw new Error(\"Environment param 'hash_id' is not set.\");","}"],"type":"text/javascript"}},{"listen":"test","script":{"id":"e695b5df-3861-4967-9112-3a93b460159b","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","if (success === true) {","    var answers = new Array();","    //avoiding Postman to encode parethesis when posting the answer array with test.post method","    var left = encodeURIComponent(\"[\");","    var right = encodeURIComponent(\"]\");","","    //workaround: building the URL string of answers to be passed to test.post as URL param, first elem is empty and will be discarded","    for (var key of Object.keys(jsonData.result.list)) {","        answers += '\"' + key +'\":' + '\"' + Math.floor(Math.random() * (5 - 1 + 1) + 1) + '\",';","    }","    answers = answers.slice(0, -1);","    answers = \"{\" + answers + \"}\";","    pm.environment.set(\"answers\", answers);","    postman.setNextRequest(\"test.post\");","}"],"type":"text/javascript"}}],"id":"bf012287-db3f-473e-8ab9-0a8a81817cba","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"}],"url":{"raw":"{{endpoint}}?method=test.get&hash_id={{hash_id}}&user_guid={{user_guid}}&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"test.get","description":"The current method name to be called."},{"key":"hash_id","value":"{{hash_id}}"},{"key":"user_guid","value":"{{user_guid}}"},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Get the items list for a given custom test (hash_id)."},"response":[],"_postman_id":"bf012287-db3f-473e-8ab9-0a8a81817cba"},{"name":"test.post","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":["pm.test('user_guid should exist', function () {","    pm.expect(pm.environment.has('user_guid')).to.equal(true);","});","pm.test('hash_id should exist', function () {","    pm.expect(pm.environment.has('hash_id')).to.equal(true);","});","pm.test('answers should exist', function () {","    pm.expect(pm.environment.has('answers')).to.equal(true);","});","if (!pm.environment.has('user_guid')) {","    throw new Error(\"Environment param 'user_guid' is not set.\");","}","if (!pm.environment.has('hash_id')) {","    throw new Error(\"Environment param 'hash_id' is not set.\");","}","if (!pm.environment.has('answers')) {","    throw new Error(\"Environment param 'answers' is not set.\");","}","","var json = JSON.parse(pm.environment.get(\"answers\"));","for (var key of Object.keys(json)) {","    pm.request.url.query.add(\"answers[\" + key + \"]=\" + json[key]);","}","//need to refresh the token from collection pre-request script","var keyPrivate = pm.environment.get(\"keyPrivate\");","var keyPublic = pm.environment.get(\"keyPublic\");","var uuid = require('uuid');","var moment = require(\"moment\")","var nonce = uuid.v4();","var requestTimeStamp = moment(new Date().toUTCString()).valueOf() / 1000;","var requestURI = encodeURIComponent(pm.environment.values.substitute(pm.request.url, null, false).getRaw()).toLowerCase();","console.log(requestURI);","var queryString = pm.variables.replaceIn(pm.request.url).toString();","const paramsString = queryString.split('?')[1];","console.log(paramsString);","var posthash = CryptoJS.MD5(\"\").toString();","var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA1, keyPrivate);","hmac.update(requestTimeStamp.toString());","hmac.update(nonce);","hmac.update(keyPublic);","hmac.update(paramsString);","if (pm.request.method === \"POST\") {","    hmac.update(posthash.toString());","}","var hash = hmac.finalize();","pm.globals.set(\"posthash\", posthash);","pm.globals.set(\"timestamp\", requestTimeStamp);","pm.globals.set(\"nonce\", nonce);","pm.globals.set(\"hmac\", encodeURIComponent(CryptoJS.enc.Base64.stringify(hash)));"],"type":"text/javascript"}},{"listen":"test","script":{"id":"336fd093-1a4a-4699-9e37-0dcc022bb66a","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","if(success === true ){","    pm.environment.unset(\"answers\");","}"],"type":"text/javascript"}}],"id":"94bfc4ff-d7fa-4867-96e4-ce41aee4d8ce","protocolProfileBehavior":{"disableBodyPruning":true,"disableUrlEncoding":true},"request":{"method":"POST","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"},{"key":"X-eggup-posthash","type":"text","value":"{{posthash}}"},{"key":"X-eggup-posthash-algo","type":"text","value":"md5"},{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"url":{"raw":"{{endpoint}}?method=test.post&hash_id={{hash_id}}&user_guid={{user_guid}}&answers[]=&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"test.post","description":"The current method name to be called."},{"key":"hash_id","value":"{{hash_id}}","description":"The {{hash_id}} of the test which you're sending the list of answers for the current {{user_guid}}."},{"key":"user_guid","value":"{{user_guid}}","description":"The {{user_guid}} that identy the user account."},{"key":"answers[]","value":"","description":"The array of answers to be sent as \"answers[{{item_id}}] => answer_num\"."},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Send back answers for a custom test and user."},"response":[],"_postman_id":"94bfc4ff-d7fa-4867-96e4-ce41aee4d8ce"},{"name":"test.question","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":["pm.test('user_guid should exist', function () {","    pm.expect(pm.environment.has('user_guid')).to.equal(true);","});","pm.test('hash_id should exist', function () {","    pm.expect(pm.environment.has('hash_id')).to.equal(true);","});","if(!pm.environment.has('user_guid')){","    throw new Error(\"Environment param 'user_guid' is not set.\");","}","if(!pm.environment.has('hash_id')){","    throw new Error(\"Environment param 'hash_id' is not set.\");","}"],"type":"text/javascript"}},{"listen":"test","script":{"id":"e695b5df-3861-4967-9112-3a93b460159b","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","tests[\"Status is equal to 0\"] = success === true","if(success === true ){","    pm.environment.set(\"question_id\", jsonData.result.question.question_id);","    postman.setNextRequest(\"test.answer\");","}"],"type":"text/javascript"}}],"id":"aa01dba7-966b-481d-b275-fbe30c752aa5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"}],"url":{"raw":"{{endpoint}}?method=test.question&hash_id={{hash_id}}&user_guid={{user_guid}}&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"test.question","description":"The current method name to be called."},{"key":"hash_id","value":"{{hash_id}}","description":"The {{hash_id}} of the test which you are asking the next question for current {{user_guid}}."},{"key":"user_guid","value":"{{user_guid}}","description":"The {{user_guid}} that identy the user account."},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Get the next question for a given hash_id and user_guid."},"response":[],"_postman_id":"aa01dba7-966b-481d-b275-fbe30c752aa5"},{"name":"test.answer","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":["pm.test('user_guid should exist', function () {","    pm.expect(pm.environment.has('user_guid')).to.equal(true);","});","pm.test('hash_id should exist', function () {","    pm.expect(pm.environment.has('hash_id')).to.equal(true);","});","pm.test('question_id should exist', function () {","    pm.expect(pm.environment.has('question_id')).to.equal(true);","});","pm.environment.set(\"randomAnswer\", Math.floor(Math.random() * (5 - 1 + 1) + 1));","if(!pm.environment.has('user_guid')){","    throw new Error(\"Environment param 'user_guid' is not set.\");","}","if(!pm.environment.has('hash_id')){","    throw new Error(\"Environment param 'hash_id' is not set.\");","}","if(!pm.environment.has('question_id')){","    throw new Error(\"Environment param 'question_id' is not set.\");","}"],"type":"text/javascript"}},{"listen":"test","script":{"id":"336fd093-1a4a-4699-9e37-0dcc022bb66a","exec":["var jsonData = JSON.parse(responseBody);","var scores = jsonData.result.scores;","var success = jsonData.result.success;","if(success === true && (jsonData.result.scores === undefined)){","    postman.setNextRequest(\"test.question\");","}"],"type":"text/javascript"}}],"id":"2da3f7c3-d866-413c-b74d-5255560e1bb8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"},{"key":"X-eggup-posthash","type":"text","value":"{{posthash}}"},{"key":"X-eggup-posthash-algo","type":"text","value":"md5"},{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/octet-stream"}],"url":{"raw":"{{endpoint}}?method=test.answer&hash_id={{hash_id}}&user_guid={{user_guid}}&question_id={{question_id}}&answer={{randomAnswer}}&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"test.answer","description":"The current method name to be called."},{"key":"hash_id","value":"{{hash_id}}","description":"The {{hash_id}} that identify a unique owned test."},{"key":"user_guid","value":"{{user_guid}}","description":"The {{user_guid}} that identy the user account."},{"key":"question_id","value":"{{question_id}}","description":"The {{item_id}} of the current question your are sending answer for."},{"key":"answer","value":"{{randomAnswer}}","description":"The numeric answer for this question."},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Send back one specific answer for a custom test and user."},"response":[],"_postman_id":"2da3f7c3-d866-413c-b74d-5255560e1bb8"},{"name":"test.delete","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":["pm.test('hash_id should exist', function () {","    pm.expect(pm.environment.has('hash_id')).to.equal(true);","});","if(!pm.environment.has('hash_id')){","    throw new Error(\"Environment param 'hash_id' is not set.\");","}"],"type":"text/javascript"}},{"listen":"test","script":{"id":"336fd093-1a4a-4699-9e37-0dcc022bb66a","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","if(success === true ){","    pm.environment.unset(\"hash_id\");","}"],"type":"text/javascript"}}],"id":"735b7245-3940-403b-b921-699dc076de64","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"},{"key":"X-eggup-posthash","type":"text","value":"{{posthash}}"},{"key":"X-eggup-posthash-algo","type":"text","value":"md5"},{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/octet-stream"}],"url":{"raw":"{{endpoint}}?method=test.delete&hash_id={{hash_id}}&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"test.delete","description":"The current method name to be called."},{"key":"hash_id","value":"{{hash_id}}","description":"The {{hash_id}} that identify a unique owned test."},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Delete a custom test from your list."},"response":[],"_postman_id":"735b7245-3940-403b-b921-699dc076de64"},{"name":"traits.macro","event":[{"listen":"prerequest","script":{"id":"f301dcad-1760-45f8-8755-11852cad337c","exec":[""],"type":"text/javascript"}},{"listen":"test","script":{"id":"109c30d3-048a-46ea-9ec0-7914c02c2d3b","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","// response JSON Schema validation","const customerSchema = {","    \"status\": 0,","    \"result\": {","        \"success\": true,","        \"user_guid\": {","            \"type\": \"Integer\",","            \"minLength\": 1,","            \"maxLength\": 20","        }","    }","};","","if(success === true ){","    // Test whether the response matches the schema","    var customer = JSON.parse(responseBody);","    tests[\"use_guid is valid\"] = tv4.validate(customer, customerSchema);","    pm.environment.set(\"user_guid\", jsonData.result.user_guid);","    postman.setNextRequest(\"user.get\");","}"],"type":"text/javascript"}}],"id":"0ba21a0e-0091-4c57-8e3e-160b67806ef9","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-eggup-apikey","value":"{{keyPublic}}","type":"text"},{"key":"X-eggup-time","value":"{{timestamp}}","type":"text"},{"key":"X-eggup-nonce","value":"{{nonce}}","type":"text"},{"key":"X-eggup-hmac-algo","value":"sha1","type":"text"},{"key":"X-eggup-hmac","value":"{{hmac}}","type":"text"},{"key":"X-eggup-posthash","value":"{{posthash}}","type":"text"},{"key":"X-eggup-posthash-algo","value":"md5","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/octet-stream","type":"text"}],"url":{"raw":"{{endpoint}}?method=traits.macro&name=Name&description=Description.&hash_id={{hash_id}}&traits[AB5C]=CSS:50,DPH:25&traits[6FPQ]=LEA:25&input_language=en&language=en","host":["{{endpoint}}"],"query":[{"key":"method","value":"traits.macro","description":"The current method name to be called."},{"key":"name","value":"Name","description":"The custom name to be used to identify the new macro trait."},{"key":"description","value":"Description.","description":"A text description of the new macro trait."},{"key":"hash_id","value":"{{hash_id}}","description":"The {{hash_id}} of the test where the macro trait has to be created and used as output score."},{"key":"traits[AB5C]","value":"CSS:50,DPH:25","description":"The list of test and traits to be weighted to build the macro trait as \"traits[{{test_id}}] => {{trait_id1}}:weight,{{trait_id2}}:weight,"},{"key":"traits[6FPQ]","value":"LEA:25"},{"key":"input_language","value":"en","description":"The language which the input refers to (en, it)."},{"key":"language","value":"en","description":"The language to be used in output."}]},"description":"Create a new user account over API."},"response":[{"id":"772fe777-39c3-48b6-b56a-cf011626669b","name":"user.create","originalRequest":{"method":"POST","header":[{"key":"X-eggup-apikey","value":"{{keyPublic}}","type":"text"},{"key":"X-eggup-time","value":"{{timestamp}}","type":"text"},{"key":"X-eggup-nonce","value":"{{nonce}}","type":"text"},{"key":"X-eggup-hmac-algo","value":"sha1","type":"text"},{"key":"X-eggup-hmac","value":"{{hmac}}","type":"text"},{"key":"X-eggup-posthash","value":"{{posthash}}","type":"text"},{"key":"X-eggup-posthash-algo","value":"md5","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/octet-stream","type":"text"},{"key":"Content-Length","value":"{{contentLength}}","type":"text"}],"url":{"raw":"{{endpoint}}?method=user.create&name={{$randomFirstName}}%20{{$randomLastName}}&email={{$randomEmail}}&username=APiuser_{{keyPublic}}_{{$randomInt}}&password={{$randomPassword}}&metadata[IP]={{$randomIP}}&metadata[metadata2]=APIUserTest","host":["{{endpoint}}"],"query":[{"key":"method","value":"user.create"},{"key":"name","value":"{{$randomFirstName}}%20{{$randomLastName}}"},{"key":"email","value":"{{$randomEmail}}"},{"key":"username","value":"APiuser_{{keyPublic}}_{{$randomInt}}"},{"key":"password","value":"{{$randomPassword}}"},{"key":"metadata[IP]","value":"{{$randomIP}}"},{"key":"metadata[metadata2]","value":"APIUserTest"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Date","value":"Thu, 24 Oct 2019 10:02:04 GMT"},{"key":"Server","value":"Apache/2.4.39 (Unix) PHP/5.6.40"},{"key":"X-Powered-By","value":"PHP/5.6.40"},{"key":"Expires","value":"Thu, 19 Nov 1981 08:52:00 GMT"},{"key":"Cache-Control","value":"no-store, no-cache, must-revalidate, post-check=0, pre-check=0"},{"key":"Pragma","value":"no-cache"},{"key":"Content-Length","value":"56"},{"key":"Keep-Alive","value":"timeout=5, max=100"},{"key":"Connection","value":"Keep-Alive"},{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n    \"status\": 0,\n    \"result\": {\n        \"success\": true,\n        \"user_guid\": 28149\n    }\n}"}],"_postman_id":"0ba21a0e-0091-4c57-8e3e-160b67806ef9"},{"name":"test.session","event":[{"listen":"prerequest","script":{"id":"30cd083a-05cc-492a-aefc-70ad5a6adb3a","exec":[""],"type":"text/javascript"}},{"listen":"test","script":{"id":"cd4ce878-5f13-476d-8742-c833a81e13dc","exec":[""],"type":"text/javascript"}}],"id":"6d117e40-b6ef-4b5f-8d5b-0cba7a71d1db","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"},{"key":"X-eggup-posthash","type":"text","value":"{{posthash}}"},{"key":"X-eggup-posthash-algo","type":"text","value":"md5"},{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/octet-stream"}],"url":{"raw":"{{endpoint}}?method=test.session&user_guid={{user_guid}}&hash_id={{hash_id}}&callback_url=http%3A%2F%2Flocalhost%3A8080%2Fcallback_url%2F%3Ftoken%3D&callback_type=server&session_name&portrait=true&json_metadata=%7B%22key1%22%3A%20%22value1%22%2C%22key2%22%3A%20%22value2%22%2C%22key3%22%3A%20%22value3%22%7D&language=it","host":["{{endpoint}}"],"query":[{"key":"method","value":"test.session","description":"The current method name to be called."},{"key":"user_guid","value":"{{user_guid}}","description":"The {{user_guid}} that identy the user account."},{"key":"hash_id","value":"{{hash_id}}","description":"The hash-id of the custom test."},{"key":"callback_url","value":"http%3A%2F%2Flocalhost%3A8080%2Fcallback_url%2F%3Ftoken%3D","description":"This is the URL to be used as callback at the test completition."},{"key":"callback_type","value":"server","description":"Whether the callback call is to be made on the server side in the back-end or on the client side"},{"key":"session_name","value":null,"description":"A custom name to be assigned to this session."},{"key":"portrait","value":"true"},{"key":"json_metadata","value":"%7B%22key1%22%3A%20%22value1%22%2C%22key2%22%3A%20%22value2%22%2C%22key3%22%3A%20%22value3%22%7D","description":"{\"key1\": \"value1\",\"key2\": \"value2\",\"key3\": \"value3\"}"},{"key":"language","value":"it","description":"The language which the input refers to (en, it)."}]},"description":"Get a session token to restore a user session."},"response":[],"_postman_id":"6d117e40-b6ef-4b5f-8d5b-0cba7a71d1db"},{"name":"test.score","event":[{"listen":"prerequest","script":{"id":"09d72118-77f3-4196-9184-b2e1a551713f","exec":[""],"type":"text/javascript"}}],"id":"d28f7975-bed1-4059-aa53-f0c735658dd2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"},{"key":"Content-Type","type":"text","value":"application/octet-stream"}],"url":{"raw":"{{endpoint}}?method=test.score&user_guid={{user_guid}}&hash_id={{hash_id}}&language=it","host":["{{endpoint}}"],"query":[{"key":"method","value":"test.score"},{"key":"user_guid","value":"{{user_guid}}","description":"The {{user_guid}} that identy the user account."},{"key":"hash_id","value":"{{hash_id}}"},{"key":"date_from","value":"20210413","disabled":true},{"key":"date_to","value":"20210428","disabled":true},{"key":"token_session","value":"{{token_session}}","disabled":true},{"key":"coverage_index","value":"false","disabled":true},{"key":"language","value":"it"}]}},"response":[],"_postman_id":"d28f7975-bed1-4059-aa53-f0c735658dd2"},{"name":"test.stats","event":[{"listen":"prerequest","script":{"id":"3a11bd54-dc9f-48b4-899f-57bb8bd67f07","exec":[""],"type":"text/javascript"}}],"id":"c6aae539-a940-4917-8ad5-0f82e0c6817d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"},{"key":"Content-Type","type":"text","value":"application/octet-stream"}],"url":{"raw":"{{endpoint}}?method=test.stats&language=it","host":["{{endpoint}}"],"query":[{"key":"method","value":"test.stats"},{"key":"user_guid","value":"{{user_guid}}","description":"The {{user_guid}} that identy the user account.","disabled":true},{"key":"hash_id","value":"{{hash_id}}","description":"The hash_id of a questionnaire.","disabled":true},{"description":"formato yyyymmdd (e.g. 20231001)","key":"date_from","value":"20231001","disabled":true},{"description":"formato yyyymmdd (e.g. 20231001)","key":"date_to","value":"20231001","disabled":true},{"key":"session_name","value":"","disabled":true},{"description":"{\"key1\":\"value1\", \"key3\":\"value3\"}","key":"json_metadata","value":"%7B%22key1%22%3A%22value1%22%2C%20%22key3%22%3A%22value3%22%7D","disabled":true},{"key":"order_by","value":"test_name:DESC","description":"user_guid, hash_id, date, session_name, test_name","type":"text","disabled":true},{"key":"language","value":"it"}]}},"response":[],"_postman_id":"c6aae539-a940-4917-8ad5-0f82e0c6817d"}],"id":"43e5fa3c-2e55-4ca1-8e30-2ede67f04809","_postman_id":"43e5fa3c-2e55-4ca1-8e30-2ede67f04809"},{"name":"report","event":[{"listen":"prerequest","script":{"id":"9e70e72f-0c9c-4d4b-8d71-7ce2eb1a3ab2","exec":["pm.test('user_guid should exist', function () {","    pm.expect(pm.environment.has('user_guid')).to.equal(true);","});","pm.test('hash_id should exist', function () {","    pm.expect(pm.environment.has('hash_id')).to.equal(true);","});","if(!pm.environment.has('user_guid')){","    throw new Error(\"Environment param 'user_guid' is not set.\");","}","if(!pm.environment.has('hash_id')){","    throw new Error(\"Environment param 'hash_id' is not set.\");","}"],"type":"text/javascript"}},{"listen":"test","script":{"id":"c38649dd-d699-4d38-adeb-aec216f616c9","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","if(success === true){","    postman.setNextRequest(\"test.question\");","}"],"type":"text/javascript"}}],"id":"ef19b626-e44a-42af-85ca-85ae93995544","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"},{"key":"X-eggup-posthash","type":"text","value":"{{posthash}}"},{"key":"X-eggup-posthash-algo","type":"text","value":"md5"},{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/octet-stream"}],"url":{"raw":"{{endpoint}}?method=report&hash_id={{hash_id}}&user_guid={{user_guid}}&image_url=https://www.eggup.co/eggup_logo.svg&color_hex=%23ff7800&language=it&name=Mario%20Rossi","host":["{{endpoint}}"],"query":[{"key":"method","value":"report","description":"The current method name to be called."},{"key":"hash_id","value":"{{hash_id}}","description":"The hash-id of the custom test you are requesting the PDF."},{"key":"user_guid","value":"{{user_guid}}","description":"The user ID of the person that completed the test."},{"description":"Optional date, if not present last score for this test is used.","key":"date","type":"text","value":"20200703","disabled":true},{"description":"[ss, sg, gg] The type of SmartCoach to be enabled inside the report.","key":"smart_coach","type":"text","value":"sg","disabled":true},{"key":"image_url","value":"https://www.eggup.co/eggup_logo.svg","description":"Optional remote image url to be used as logo."},{"key":"color_hex","value":"%23ff7800","description":"The hex color to be used."},{"key":"language","value":"it","description":"The desired language of PDF output [en, it]."},{"key":"name","value":"Mario%20Rossi","description":"The name of the person to be pushed inside the PDF report as reference.","type":"text"}]},"description":"Send back one specific answer for a custom test and user."},"response":[],"_postman_id":"ef19b626-e44a-42af-85ca-85ae93995544"},{"name":"smartcoach.seeds","event":[{"listen":"prerequest","script":{"id":"eeeed15f-5d74-42c3-bed7-512dc88baa2d","exec":["pm.test('user_guid should exist', function () {","    pm.expect(pm.environment.has('user_guid')).to.equal(true);","});","pm.test('hash_id should exist', function () {","    pm.expect(pm.environment.has('hash_id')).to.equal(true);","});","if(!pm.environment.has('user_guid')){","    throw new Error(\"Environment param 'user_guid' is not set.\");","}","if(!pm.environment.has('hash_id')){","    throw new Error(\"Environment param 'hash_id' is not set.\");","}"],"type":"text/javascript"}},{"listen":"test","script":{"id":"8718d490-ebb8-4d99-b3f3-9f17115abb81","exec":["var jsonData = JSON.parse(responseBody);","var success = jsonData.result.success;","if(success === true){","    ","}"],"type":"text/javascript"}}],"id":"e9db56d4-7496-4abb-9cf7-921740227ceb","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"X-eggup-apikey","type":"text","value":"{{keyPublic}}"},{"key":"X-eggup-time","type":"text","value":"{{timestamp}}"},{"key":"X-eggup-nonce","type":"text","value":"{{nonce}}"},{"key":"X-eggup-hmac-algo","type":"text","value":"sha1"},{"key":"X-eggup-hmac","type":"text","value":"{{hmac}}"},{"key":"X-eggup-posthash","type":"text","value":"{{posthash}}"},{"key":"X-eggup-posthash-algo","type":"text","value":"md5"},{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/octet-stream"}],"url":{"raw":"{{endpoint}}?method=smartcoach.seeds&hash_id={{hash_id}}&user_guid={{user_guid}}&traits=sg&frequency=2d&seed_types=&group_by=trait&language=it","host":["{{endpoint}}"],"query":[{"key":"method","value":"smartcoach.seeds","description":"The current method name to be called."},{"key":"hash_id","value":"{{hash_id}}","description":"The hash-ID of the custom test of which you want to ask the learning-path."},{"key":"user_guid","value":"{{user_guid}}","description":"The user-ID of the person who completed the custom test."},{"description":"The date of the test completion to be used to build the report, if not specified will be used the last one. (format \"yyyymmdd\", as received in [scores] array, e.g. \"20200611\").","key":"date","value":"20200708","disabled":true},{"key":"traits","value":"sg","description":"String - (optional). The list of traits-ID to be included in this path, as comma separated values.\nSpecial strings can be used for strength/strength, strength/growth, growth/growth or all test's traits (\"ss\", \"sg\", \"gg\", \"all\") paths.\nDefault: sg.\n"},{"key":"frequency","value":"2d","description":"The frequency to be used to generate the gmt_timestamp inside output array, as activation time for each learning-seed inside the path. Available chars: \"m\", \"h\", \"d\", \"w\".\nDefault: 2d."},{"key":"seed_types","value":"","description":"This param defines which seed types and the order to be used in the learning path. Available types are: \"course\", \"book\", \"film\", \"song\", \"podcast\", \"tedtalks\", \"vip\".\nDefault: course,book,film,song,podcast,tedtalks,vip."},{"key":"group_by","value":"trait","description":"How the path should be built, by grouping learning-seeds by \"type\", \"trait\" or \"shuffle\". Optional number can be added (e.g. \"type:3\"), to define how many learning-seeds should be included in a group, with same gmt_timestamp.\nDefault: trait."},{"key":"language","value":"it","description":"It forces the response to be in the chosen language instead of company account default (en, it)."}]},"description":"Send back one specific answer for a custom test and user."},"response":[],"_postman_id":"e9db56d4-7496-4abb-9cf7-921740227ceb"}],"event":[{"listen":"prerequest","script":{"id":"d33b3ddc-2e05-435d-9c45-8ee616280ce9","type":"text/javascript","exec":["pm.test('keyPublic should exist', function () {","    pm.expect(pm.environment.has('keyPublic')).to.equal(true);","});","pm.test('keyPrivate should exist', function () {","    pm.expect(pm.environment.has('keyPrivate')).to.equal(true);","});","pm.test('endpoint should exist', function () {","    pm.expect(pm.environment.has('endpoint')).to.equal(true);","});","if(!pm.environment.has('keyPublic') || !pm.environment.has('keyPrivate') || !pm.environment.has('endpoint')){","    throw new Error(\"Environment params are not set.\");","}","var keyPrivate = pm.environment.get(\"keyPrivate\");","var keyPublic = pm.environment.get(\"keyPublic\");","var uuid = require('uuid');","var moment = require(\"moment\")","var nonce = uuid.v4();","var requestTimeStamp = moment(new Date().toUTCString()).valueOf() / 1000;","console.log(requestTimeStamp);","var requestURI = encodeURIComponent(pm.environment.values.substitute(pm.request.url, null, false).getRaw()).toLowerCase();","console.log(requestURI);","var queryString = pm.variables.replaceIn(pm.request.url).toString();","const paramsString = queryString.split('?')[1];","console.log(paramsString);","var posthash = CryptoJS.MD5(\"\").toString();","var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA1, keyPrivate);","hmac.update(requestTimeStamp.toString());","hmac.update(nonce);","hmac.update(keyPublic);","hmac.update(paramsString);","if(pm.request.method === \"POST\"){","    hmac.update(posthash.toString());","}","var hash = hmac.finalize();","pm.globals.set(\"posthash\", posthash);","pm.globals.set(\"timestamp\", requestTimeStamp);","pm.globals.set(\"nonce\", nonce);","pm.globals.set(\"hmac\", encodeURIComponent(CryptoJS.enc.Base64.stringify(hash)));"]}},{"listen":"test","script":{"id":"46c2a1b6-10d1-4017-aa1b-34c74288e6bd","type":"text/javascript","exec":["pm.test(\"The method has ended successfully.\", function () {","    tests[\"Status code is 200\"] = responseCode.code === 200; //Status code validation","    var jsonData = JSON.parse(responseBody);","    var status = jsonData.status;","    tests[\"Status is equal to 0\"] = status === 0;","    var success = jsonData.result.success;","    tests[\"Success is true\"] = success === true;","    var errors = jsonData.runtime_errors;","    tests[\"No runtime errors\"] = errors === undefined;","    if(errors){","        console.log(errors);","    }","});"]}}]}