{"info":{"_postman_id":"61b11d02-763d-45b5-af3e-32038f8f007e","name":"Student expert","description":"Learn the skills to become a certified Postman Student Expert.","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json"},"item":[{"name":"1. Begin training - Requests","item":[{"name":"0. Start training","id":"52423f8d-e9ae-466c-b582-6f410700375a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":"{{training_api}}/training"},"response":[]},{"name":"1. Get matches","id":"4e4db8f3-212c-414e-8837-1224f80021d0","request":{"method":"GET","header":[],"url":{"raw":"{{training_api}}/matches?status=played","host":["{{training_api}}"],"path":["matches"],"query":[{"key":"status","value":"played"}]}},"response":[]},{"name":"2. Add Match","id":"41cb5b0e-da97-421b-b14d-f7aef6b92bd5","request":{"method":"POST","header":[],"body":{"mode":"raw","raw":" {\r\n\"match\": \"Cup Final\",\r\n\"when\": \"{{Thu Jan 30 2020 20: 50: 46 GMT+0000 (Coordinated Universal Time}}\",\r\n\"against\": \"Academical\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{training_api}}/match"},"response":[]},{"name":"3. Update Score","id":"b0d468ab-b03a-423d-b074-a68475bb076a","request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n \"points\": 3\r\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{training_api}}/match?match_id=V5jmudIBg","host":["{{training_api}}"],"path":["match"],"query":[{"key":"match_id","value":"V5jmudIBg"}]}},"response":[]},{"name":"4. Remove match","id":"1841c611-1312-482f-a121-e808436b6780","request":{"method":"DELETE","header":[],"url":{"raw":"{{training_api}}/match/:match_id?match_id=V5jmudIBg","host":["{{training_api}}"],"path":["match",":match_id"],"query":[{"key":"match_id","value":"V5jmudIBg"}],"variable":[{"key":"match_id","value":"V5jmudIBg"}]}},"response":[]}],"id":"7a2b4d3b-8310-4b35-8552-8f65936a172d","event":[{"listen":"prerequest","script":{"id":"219d68a5-7994-4117-8b4a-d44afb220b23","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"86921ab6-3375-4e9f-bdff-f9b99d481774","type":"text/javascript","exec":[""]}}]},{"name":"2. Scripting and Collection Runs","item":[{"name":"Get all players","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test(\"Status code is 400\", function () {\r"," pm.response.to.have.status(400);\r","});\r","var player_list = pm.response.json().data.players;\r","pm.environment.set('player_id', player_list[Math.floor(Math.random() * player_list.length)].id);\r",""]}}],"id":"7926ba06-e288-4e3c-b5b0-6f0adfa7d580","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"body":{"mode":"raw","raw":""},"url":"{{mock_url}}/players"},"response":[]},{"name":"Get specific player","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test('Status code is 200', function () {\r"," pm.response.to.have.status(200); \r","});\r","if(pm.response.json().data.played<750) postman.setNextRequest('Get all players');\r",""]}},{"listen":"prerequest","script":{"type":"text/javascript","exec":["if(!pm.variables.get('player_id')) pm.variables.set('player_id', -1);\r",""]}}],"id":"51249c47-57ba-4126-bc57-030081dab862","request":{"method":"GET","header":[],"url":{"raw":"{{mock_url}}/player?id={{player_id}}","host":["{{mock_url}}"],"path":["player"],"query":[{"key":"id","value":"{{player_id}}"}]},"description":"Get a specific player by passing the player ID as a query parameter.\r\n\r\n* Use the parameter name 'id'"},"response":[]},{"name":"Get stats","event":[{"listen":"test","script":{"type":"text/javascript","exec":["pm.test('Status code is 200', function () {\r"," pm.response.to.have.status(200); \r","});\r","\r","pm.test('Stats include all fields', function () {\r"," var jsonData = pm.response.json().data;\r"," pm.expect(jsonData).to.have.all.keys('won', 'lost', 'drew');\r","});"]}}],"id":"bd8d5d13-2aa2-4f06-bfd7-a0b4e65faad6","request":{"method":"GET","header":[],"url":"{{mock_url}}/stats"},"response":[]}],"id":"1f0a79b2-ffc0-48ec-902b-c991b9a4a86f"},{"name":"3. Check Progress","item":[{"name":"Skill check","event":[{"listen":"test","script":{"type":"text/javascript","exec":["var jsonData = JSON.parse(responseBody);\r","pm.test('Skills Check', function () {\r","pm.environment.set('responseData', jsonData.rand);\r","console.log(jsonData.rand)\r","})"]}}],"id":"0d8797a5-ed6b-4bfb-a505-8e2accf3af80","request":{"auth":{"type":"apikey","apikey":{"key":"auth_key","value":"true","in":"header"}},"method":"POST","header":[{"key":"user-id","value":"{{userId}}","type":"text","description":"plz don't edit or remove this header"},{"key":"course","value":"{{myCourse}}","type":"text","description":"plz don't edit or remove this header"},{"key":"response-value","value":"{{responseData}}","type":"text","description":"plz don't edit or remove this header"}],"body":{"mode":"raw","raw":"{\r\n \"name\": \"Daniel Paul\"\r\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"postman-skill-checker.glitch.me/skills?email=elitedp@hotmail.co.uk","host":["postman-skill-checker","glitch","me"],"path":["skills"],"query":[{"key":"email","value":"elitedp@hotmail.co.uk"}]},"description":"Hit **Send**, complete each requirement and keep sending until you get a success response!"},"response":[]},{"name":"Test collection","event":[{"listen":"test","script":{"type":"text/javascript","exec":["//auth details at collection level","let authObj = pm.response.json().auth;","//request array","let requestArr = pm.response.json().item[0].item;","//mock array ","let mockArr = pm.response.json().item[1].item;","//checks array","let checksArr = pm.response.json().item[2].item;","","//info","pm.test(\"Once all of your tests are passing, save your collection, update the link via the Share flow, and submit it: bit.ly/student-expert-submission\", () =>{"," pm.expect(true).to.eql(true);","})","","//used auth","pm.test(\"Authorized requests\", () => {"," pm.expect(authObj).to.be.an(\"object\");"," pm.expect(authObj).to.have.property(\"apikey\"); "," console.log(authObj);","});","","//used all required methods","pm.test(\"Used GET, POST, PUT, DELETE methods\", () => {"," //first folder should have all methods in requests"," let methArr = requestArr.map(value => value.request.method); "," console.log(methArr);"," pm.expect(methArr).to.include.members([\"GET\", \"POST\", \"PUT\", \"DELETE\"]);","});","","//used params - query and path","pm.test(\"Used query and path parameters\", () => {"," //first folder should have query"," let queryArr = requestArr.filter(value => value.request.url.query).map(value => value.request.url.query);"," console.log(queryArr);"," pm.expect(queryArr).to.have.length.of.above(0);"," //first folder should also have path"," let pathArr = requestArr.filter(value => value.request.url.path).map(value => value.request.url.path);"," var pathParams = pathArr.flat().filter(p => p.startsWith(':')); "," console.log(pathParams);"," pm.expect(pathParams).to.have.length.of.above(0);","});","","//sent body","pm.test(\"Sent body data\", () => {"," //first folder should have a body"," let bodyArr = requestArr.filter(value => value.request.body).map(value => value.request.body); "," console.log(bodyArr);"," pm.expect(bodyArr).to.have.length.of.above(0);","});","","//used vars (can currently only check env with run output - future enhancement - atm check set env var from script)","pm.test(\"Used variables\", () => {"," //should be a var reference in query param for mock folder"," let varsArr = mockArr.filter(value => value.request.url.query).map(value => value.request.url.query);"," let queries = varsArr.flat().filter(value => value.value).map(value => value.value);"," var queryVars = queries.filter(p => encodeURI(p).indexOf('%7B%7B')>-1); "," console.log(queryVars);"," pm.expect(queryVars).to.have.length.of.above(0);"," //base path for main folder should also use var"," //url is object when path or query param, string otherwise"," let addresses = requestArr.filter(value => value.request.url.raw ? value.request.url.raw : value.request.url).map(value => value.request.url.raw ? value.request.url.raw : value.request.url);"," var addressVars = addresses.filter(p => encodeURI(p).indexOf('%7B%7B')>-1); "," console.log(addressVars);"," pm.expect(addressVars).to.have.length.of.above(0);"," //auth should also use var"," pm.expect(encodeURI(authObj.apikey.value).indexOf('%7B%7B')).to.be.above(-1);","","});","","//assed description","pm.test(\"Added request description\", () => {"," //second folder should have a description"," let descArr = mockArr.filter(value => value.request.description).map(value => value.request.description);"," console.log(descArr);"," pm.expect(descArr).to.have.length.of.above(0);","});","","//set var from script and next request - make it env var so we check that too","pm.test(\"Set env variable from script and set next request\", () => {"," //second folder should have set var and next req"," let testsArr = mockArr.filter(value => value.event).map(value => value.event); "," console.log(testsArr);"," let execArr = testsArr.flat().filter(value => value.script.exec).map(value => value.script.exec); "," var setsVars = execArr.flat().filter(p => p.indexOf('environment.set(')>-1); "," console.log(setsVars);"," pm.expect(setsVars).to.have.length.of.above(0);"," var setsReqs = execArr.flat().filter(p => p.indexOf('.setNextRequest')>-1); "," console.log(setsReqs);"," pm.expect(setsReqs).to.have.length.of.above(0);","});","//add skill check test","pm.test('Skills checked', () =>{"," var vars = pm.response.json().variable.map(value => value.key);"," pm.expect(vars).to.include('skilled');","});","//check pulled response property","pm.test('Skill check code retrieving set var value from response property', () => {"," //need to make sure set var from response json in skill check request - third folder"," //need to make sure set var from response json in skill check request - third folder"," pm.expect(JSON.stringify(checksArr[0].event[0].script).indexOf('.rand')).to.be.greaterThan(-1);","});"]}}],"id":"7a737fbf-17e1-4407-b28b-fb335f4c17d9","request":{"method":"GET","header":[],"url":"{{your-collection-link-here}}","description":"Paste your collection public link in as the address and send, checking the test results to see if you completed this step."},"response":[]}],"id":"5faeeec6-5ebd-4772-8f94-291a4aecca76","auth":{"type":"apikey","apikey":{"in":"query","value":"true","key":"auth_key"}},"event":[{"listen":"prerequest","script":{"id":"bf315c95-c89c-4114-b43a-94b86a8f0baf","type":"text/javascript","exec":["var uID = pm.collectionVariables.get(\"userId\");","if(!uID)"," pm.collectionVariables.set(\"userId\", pm.variables.replaceIn('{{$guid}}'));",""]}},{"listen":"test","script":{"id":"4dba54b9-6e24-44ab-ba7b-45a89caa6b33","type":"text/javascript","exec":["var template = `",""," "," ","
","","
","","","`;","","// Set visualizer","pm.visualizer.set(template, {"," // Pass the response body parsed as JSON as `data`"," response: pm.response.json()","});","","if(pm.response.json().done) pm.collectionVariables.set('skilled', true);"]}}]}],"auth":{"type":"apikey","apikey":{"key":"match_key","value":"{{email_key}}"}},"event":[{"listen":"prerequest","script":{"id":"b5dd2169-635b-47c2-bbec-b687982ab892","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"9441c89e-6790-4031-a09f-9ac965dd4270","type":"text/javascript","exec":["var template = `"," "," "," "," "," "," "," "," "," "," "," ","","