{"info":{"_postman_id":"a6815b36-39c0-312b-3aa5-af0ff5f91a4d","name":"iReporter","description":"<html><head></head><body><p>A web based system application for reporting instances of corruption and public works.</p>\n<p>Using the Flask-restful framework for routing and API functions, PostgresSQL for database storage and standard HTML, JS and CSS frontend webpages.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"764347","collectionId":"a6815b36-39c0-312b-3aa5-af0ff5f91a4d","publishedId":"RzffJ9Y8","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2018-12-03T18:08:06.000Z"},"item":[{"name":"Challenge 3","item":[{"name":"User","item":[{"name":"Create a user ","event":[{"listen":"test","script":{"id":"ac6d52f6-8714-4a75-928c-61af11a9af10","exec":["pm.environment.set(\"variable_key\", \"variable_value\");","pm.test(\"Body matches string\", function () {","    pm.expect(pm.response.text()).to.include(\"string_you_want_to_search\");","});"],"type":"text/javascript"}}],"id":"865ddd3e-f45f-4eb0-8c11-000850c65413","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{access_token}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n            \"fname\": \"Almost\",\n            \"lname\":\"There\",\n            \"othername\":\"\",\n            \"email\":\"{{normal_email}}\",\n            \"phone\":\"+254721953224\",\n            \"username\":\"{{normal_username}}\",\n            \"password\":\"{{normal_password}}\"\n}"},"url":"{{host_url}}/users/","description":"<p>Endpoint to create a user and return their user details, status message and status code</p>\n<h2 id=\"request-body\">Request body</h2>\n<p>{\n            \"fname\": String // (Required) String providing the first name of a user. Only alphabetic characters accepted,\n            \"lname\": String // (Required) String providing the last name of a user. Only alphabetic characters accepted,\n            \"othername\": String // (Optional) String providing the third name of a user. Only alphabetic characters accepted,\n            \"email\": String // (Required) Email string providing the email of a user. Only valid email strings accepted,\n            \"phone\": String //(Required) Phone number string of a user that starts with Kenyan mobile extension,\n            \"username\": String // (Required) string providing the username of a user. Can be alphanumeric,\n            \"password\": String // (Required) Password string of a user that must have at least one alphabetic and one numeric character. Minimum of 6 characters.\n}</p>\n<h2 id=\"response-body\">Response body</h2>\n<p>{\n    \"data\": [\n        { new_user_object} // The newly created user\n    ],\n    \"msg\": \"User successfully created\",\n    \"status_code\": 201\n}</p>\n","urlObject":{"path":["users",""],"host":["{{host_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"865ddd3e-f45f-4eb0-8c11-000850c65413"},{"name":"Get all users","id":"89b233fb-f2c4-4731-a083-7a7cca634bd1","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Access-token","type":"text","value":"{{admin_token}}"}],"url":"{{host_url}}/users","description":"<p>Endpoint to fetch all created user records, status message and status code</p>\n<h2 id=\"response-body\">Response body</h2>\n<p>{\n    \"data\": [\n        user_1, // JSON object containing user details\n        user_2, // JSON object containing user details\n        ...\n    ],\n    \"msg\": String // String describing the result of the request ,\n    \"status_code\": Int // Int defining the status code of the response\n}</p>\n","urlObject":{"path":["users"],"host":["{{host_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"89b233fb-f2c4-4731-a083-7a7cca634bd1"},{"name":"Get single user details","id":"a2f4292b-954c-4f0f-a017-2e57cd36e770","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Access-token","type":"text","value":"{{access_token}}"}],"url":"{{host_url}}/users/6","description":"<p>Endpoint to fetch a single created user record, status message and status code</p>\n<h2 id=\"request\">Request</h2>\n<p>takes user's id as an integer which is the last parameter of the url</p>\n<h2 id=\"response\">Response</h2>\n<p>{\n    \"data\": [\n        user_details // JSON object of current user details\n    ],\n    \"msg\": String // Message string describing the status of the response,\n    \"status_code\": 200 // Int defining the Http status code\n}</p>\n","urlObject":{"path":["users","6"],"host":["{{host_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a2f4292b-954c-4f0f-a017-2e57cd36e770"}],"id":"b9884b13-6e44-491c-ad24-6ca6542e7785","description":"<p>User resource endpoints</p>\n","_postman_id":"b9884b13-6e44-491c-ad24-6ca6542e7785"},{"name":"Auth","item":[{"name":"Sign In","event":[{"listen":"test","script":{"id":"c52f0b47-9c64-4f13-86b4-8c0f1b6be381","exec":["let token = pm.response.json().data[0][\"token\"]","token = \"Bearer \"+ token","pm.environment.set(\"access_token\", token);"],"type":"text/javascript"}}],"id":"1e7fcaff-acec-44c7-96ec-5b50d3b5acf6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n            \"username\":\"{{normal_username}}\",\n            \"password\":\"{{normal_password}}\"\n\t\n}\n\n"},"url":"{{host_url}}/auth","description":"<p>Sign in a user using their username and password and return a jwt-token, status_code, and message string</p>\n<h2 id=\"request\">Request</h2>\n<p>{\n            \"username\": String // username string used to authenticate a user,\n            \"password\":\"String // User password used to verify the user signing in</p>\n<p>}</p>\n<h2 id=\"response\">Response</h2>\n<p>{\n    \"data\": [\n        {\n            \"token\": String // String that is used as a JWT token to provide access to protected routes,\n            \"user\": user_details // JSON object with entailing user details\n        }\n    ],\n    \"msg\": String // String describing the response results,\n    \"status_code\": Int // Integer defining the Http status code of the response\n}</p>\n","urlObject":{"path":["auth"],"host":["{{host_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"1e7fcaff-acec-44c7-96ec-5b50d3b5acf6"}],"id":"e8ecf1a5-f78c-49b5-bed8-88396e8affa5","description":"<p>User resource endpoints</p>\n","_postman_id":"e8ecf1a5-f78c-49b5-bed8-88396e8affa5"},{"name":"Incident","item":[{"name":"Get all incidents","id":"905b8de7-6714-4a73-bf2d-e41f47885fd2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"Access-token","value":"{{access_token}}","type":"text"}],"url":"{{host_url}}/incidents","description":"<p>Endpoint to fetch all created incident records, status message and status code</p>\n<h2 id=\"response\">Response</h2>\n<p>{\n    \"data\": [\n       incident_details, // JSON object with incident details\n       incident2_details, // JSON object with incident details\n       ...\n    ],\n    \"msg\": String // String describing the response results the get request,\n    \"status_code\": Int // Integer defining the HTTP status of the response\n}</p>\n","urlObject":{"path":["incidents"],"host":["{{host_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"905b8de7-6714-4a73-bf2d-e41f47885fd2"},{"name":"Get a single incident","id":"3a48e4ae-ce99-4828-bee0-b4e54efca5a6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Access-token","value":"{{access_token}}","type":"text"}],"url":"{{host_url}}/incidents/1","description":"<p>Endpoint to fetch a single incident based on the incident id and return the incident details, status message and status_code</p>\n<h2 id=\"request\">Request</h2>\n<p>takes incident's id as an integer which is the last parameter of the url</p>\n<h2 id=\"response\">Response</h2>\n<p>{\n    \"data\": [\n       incident_details, // JSON object with incident details\n    \"msg\": String // String describing the response results the get request,\n    \"status_code\": Int // Integer defining the HTTP status of the response\n}</p>\n","urlObject":{"path":["incidents","1"],"host":["{{host_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3a48e4ae-ce99-4828-bee0-b4e54efca5a6"},{"name":"Create an incident","id":"bacd560c-8569-4666-a94a-99bcb90716f0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"description":"<p>token used in verifying an authorized user</p>\n","key":"Access-token","type":"text","value":"{{access_token}}"}],"body":{"mode":"raw","raw":"{\t\t\t\"title\":\"Corruption in the DCI\",\n\t\t\t\"location\": \"32.42, -23.4324\",\n\t\t\t\"comment\": \"Bribery in gun licensing procedure.\",\n            \"type\":\"red-flag\"\n}"},"url":"{{host_url}}/incidents","description":"<p>Endpoint user to create a new incident record and return the incident record, status message and status code</p>\n<h2 id=\"request-body\">Request body</h2>\n<p>{\n            \"title\": String, // String defining the title of the incident\n            \"comment\": String, // String describing the incident details\n            \"location\": String, // String defining the lat and long coordinates of the incident location\n            \"type\": String // String defining the type of incident - either intervention or red-flag\n}</p>\n<h2 id=\"response-body\">Response body</h2>\n<p>{\n     \"data\": [\n        incident_details // JSON object containing incident details\n     ],\n     \"msg\": String, // String describing the results from the request\n     \"status_code\": Int // Integer describing the Http status of the response\n}</p>\n","urlObject":{"path":["incidents"],"host":["{{host_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"bacd560c-8569-4666-a94a-99bcb90716f0"},{"name":"Update an incident","id":"e2b6d654-f8d3-46b5-8e73-6ef9c3dfd4e4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Content-Type","type":"text","value":"application/json"},{"key":"Access-token","type":"text","value":"{{access_token}}"}],"body":{"mode":"raw","raw":"{\n \"prop_value\":\"-1.332233, 35.644333\"\n}"},"url":"{{host_url}}/incidents/2/location","description":"<p>Endpoint used to update an incident comment or location and return the incident object with updated data, a status message and a status code.</p>\n<h2 id=\"request-body\">Request body</h2>\n<p>Takes 'prop' parameter as the last url parameter, defining the incident property to update - either location or comment</p>\n<p>{\n \"prop_value\": String // String with the new value of the incident property\n}</p>\n<h2 id=\"response-body\">Response body</h2>\n<p>{\n    \"data\": [\n        incident_details // JSON object with incident details\n    ],\n    \"msg\": String, // String describing the response result\n    \"status_code\": Int, // Integer describing the Http status code of the response\n}</p>\n","urlObject":{"path":["incidents","2","location"],"host":["{{host_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e2b6d654-f8d3-46b5-8e73-6ef9c3dfd4e4"},{"name":"Delete an incident","id":"207d5bc3-f2e5-49ff-a677-f024b0fcdbb5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"Access-token","type":"text","value":"{{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"{{host_url}}/incidents/2","description":"<p>Endpoint used to delete an incident record and return a status code and status message</p>\n<h2 id=\"request\">Request</h2>\n<p>takes incident's id as an integer which is the last parameter of the url</p>\n<h2 id=\"response\">Response</h2>\n<p>{\n    \"data\":[\n        {\n            \"id\":Int // Integer of the deleted incident\n        }\n    ],\n    \"msg\": String, // String describing the response of the request\n    \"status_code\": Int // Integer describing the Http status of the response\n}</p>\n","urlObject":{"path":["incidents","2"],"host":["{{host_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"207d5bc3-f2e5-49ff-a677-f024b0fcdbb5"}],"id":"271cd71d-69c9-4617-a74f-759812a6b301","_postman_id":"271cd71d-69c9-4617-a74f-759812a6b301","description":""},{"name":"Admin","item":[{"name":"Update an incident status","id":"9da89e88-21fd-4440-8199-5a4df3f92355","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"Content-Type","type":"text","value":"application/json"},{"key":"Access-token","type":"text","value":"{{admin_token}}"}],"body":{"mode":"raw","raw":"{\n \"status\":\"under investigation\"\n}"},"url":"{{host_url}}/incidents/1/status","description":"<p>Endpoint used to update an incident's status and return the incident object with updated data, a status message and a status code.</p>\n<h2 id=\"request-body\">Request body</h2>\n<p>{\n \"status\": String, // String with the new status of a incident - either draft, resolved, rejected or under investigation\n}</p>\n<h2 id=\"response-body\">Response body</h2>\n<p>{\n    \"data\":[\n        incident_details // JSON object with updated incident details\n    ],\n    \"msg\": String, // String describing the results of the request\n    \"status_code\": Int, // Integer describing Http status code of the response\n}</p>\n","urlObject":{"path":["incidents","1","status"],"host":["{{host_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9da89e88-21fd-4440-8199-5a4df3f92355"},{"name":"Get all incidents","id":"0bd9e4f1-d96f-4064-b676-ae03d18fb869","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Access-token","value":"{{admin_token}}","type":"text"}],"url":"{{host_url}}/incidents/all","description":"<p>Endpoint to fetch all created incident records, status message and status code</p>\n<h2 id=\"response\">Response</h2>\n<p>{\n    \"data\": [\n        incident_details, // JSON object with the incident's details\n        incident2_details, // JSON object with the incident's details\n        ...\n    ],\n    \"msg\": String, // String describing the results of the request\n    \"status_code\": Int, // Integer describing the Http status code of the request\n}</p>\n","urlObject":{"path":["incidents","all"],"host":["{{host_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"0bd9e4f1-d96f-4064-b676-ae03d18fb869"}],"id":"97c4cd8e-cf7d-412f-8d99-c7985053deee","description":"<p>Administrator endpoints used by users with administrator roles</p>\n","_postman_id":"97c4cd8e-cf7d-412f-8d99-c7985053deee"}],"id":"319a4762-8e13-4bc0-996d-55227f848cba","_postman_id":"319a4762-8e13-4bc0-996d-55227f848cba","description":""}]}