{"info":{"_postman_id":"22d52145-d76a-4951-8d72-559195ea68f0","name":"ClientAddressBook","description":"<html><head></head><body><h1 id=\"overview\">Overview</h1>\n<p>The Client Address Book API allows users to execute CRUD actions and persist data to a MongoDB database.</p>\n<h1 id=\"getting-started\">Getting Started</h1>\n<p>To access the API, navigate to <a href=\"https://hub.docker.com/r/scottiecrump/client-address-next\">scottiecrump/client-address-next</a> and follow the provided instructions to run the API in a Docker container.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"Overview","slug":"overview"},{"content":"Getting Started","slug":"getting-started"}],"owner":"3521978","collectionId":"22d52145-d76a-4951-8d72-559195ea68f0","publishedId":"UVJkBZ2Q","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2021-12-08T20:32:26.000Z"},"item":[{"name":"Add New Client","event":[{"listen":"prerequest","script":{"id":"5249b36c-82e3-4742-b413-a14e1dd04885","exec":["const randomPhone = Math.floor(Math.random() * 1000000000)","const randomFullName = pm.variables.replaceIn('Jean Koepp');","","pm.collectionVariables.set(\"randomPhone\", randomPhone);","pm.collectionVariables.set(\"randomFullName\", randomFullName);",""],"type":"text/javascript"}},{"listen":"test","script":{"id":"c9c40f38-8b5e-4c05-a67c-d514204180dd","exec":["pm.test(\"given POST request, returns 200 status\", () => {","    pm.response.to.have.status(200);","});","","pm.test(\"given new client, returns client added message\", () => {","    const response = pm.response.json();","    const name = pm.collectionVariables.get(\"randomFullName\");","","    pm.expect(response.message).to.eql(`${name} successfully added`);","});","","const schema = {","  \"type\": \"object\",","  \"properties\": {","    \"message\": {","      \"type\": \"string\"","    }","  },","  \"required\": [","    \"message\"","  ]","}","","pm.test(\"given valid POST request, response matches schema\", () => {","    pm.response.to.have.jsonSchema(schema);","});",""],"type":"text/javascript"}}],"id":"8a29efae-4203-43ab-b5ac-3e4c4112f6f9","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"\",\n    \"email\": \"Lupe.Daugherty65@hotmail.com\",\n    \"phone\": \"\",\n    \"address\": \"9639 Kyra Centers\",\n    \"company\": \"Volkman Group\",\n    \"notes\": \"Earum iste qui pariatur.\"\n}","options":{"raw":{"language":"json"}}},"url":"{{baseURL}}/api/add-client","description":"<p>Creates a new client. The <code>name</code> value must be unique. The <code>name</code> and <code>email</code> properties are required. The <code>phone</code> property is designed to accept integers only. So, for example, phone number formats such as <code>(111) 222-3333</code> will not work.</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"name\": \"string\",\n  \"email\": \"string\",\n  \"phone\": number,\n  \"address\": \"string\",\n  \"company\": \"string\",\n  \"notes\": \"string\"\n}\n\n</code></pre>\n","urlObject":{"path":["api","add-client"],"host":["{{baseURL}}"],"query":[],"variable":[]}},"response":[{"id":"4fd8a789-b1da-43eb-98f7-186626d1e530","name":"Add New Client","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"name\": \"John Doe\",\n    \"email\": \"jd@mail.com\",\n    \"phone\": 1234567890,\n    \"address\": \"123 Test Street\",\n    \"company\": \"Testers R Us\",\n    \"notes\": \"I love Postman\"\n}","options":{"raw":{"language":"json"}}},"url":"{{baseURL}}/api/add-client"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"ETag","value":"\"29-lLsQjYtpKSO+FWjIJRipb3+YZzE\""},{"key":"Content-Length","value":"41"},{"key":"Vary","value":"Accept-Encoding"},{"key":"Date","value":"Wed, 08 Dec 2021 16:37:56 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"John Doe successfully added\"\n}"}],"_postman_id":"8a29efae-4203-43ab-b5ac-3e4c4112f6f9"},{"name":"Get Clients","event":[{"listen":"test","script":{"id":"b4685db8-dd56-4e66-9cc9-5a3268e35ac0","exec":["const response = pm.response.json()","const lastAddedClientID = response.users[response.users.length - 1].id;","","pm.collectionVariables.set(\"lastAddedClientID\", lastAddedClientID);","","pm.test(\"given GET request, returns 200 status\", () => {","    pm.response.to.have.status(200);","});","","const schema = {","  \"type\": \"object\",","  \"required\": [","    \"users\"","  ],","  \"properties\": {","    \"users\": {","      \"type\": \"array\",","      \"items\": {","        \"type\": \"object\",","        \"required\": [","          \"_id\",","          \"name\",","          \"email\",","          \"__v\",","          \"id\"","        ],","        \"properties\": {","          \"_id\": {","            \"type\": \"string\"","          },","          \"name\": {","            \"type\": \"string\"","          },","          \"email\": {","            \"type\": \"string\"","          },","          \"address\": {","            \"type\": \"string\"","          },","          \"phone\": {","            \"type\": \"integer\"","          },","          \"company\": {","            \"type\": \"string\"","          },","          \"notes\": {","            \"type\": \"string\"","          },","          \"__v\": {","            \"type\": \"integer\"","          },","          \"id\": {","            \"type\": \"string\"","          }","        }","      }","    }","  }","}","pm.test(\"given GET request, response matches schema\", () => {","    pm.response.to.have.jsonSchema(schema);","});",""],"type":"text/javascript"}}],"id":"dcc1be62-7cbe-457c-831d-a652dc7c5765","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{baseURL}}/api/clients","description":"<p>Retrieves an array of all current clients.</p>\n","urlObject":{"path":["api","clients"],"host":["{{baseURL}}"],"query":[],"variable":[]}},"response":[{"id":"d2e31653-6661-4b7c-9ec8-c674db09210b","name":"Success Response","originalRequest":{"method":"GET","header":[],"url":"{{baseURL}}/api/clients"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":null,"cookie":[],"responseTime":null,"body":"{\n    \"users\": [\n        {\n            \"_id\": \"61aa26f711778415b375e07b\",\n            \"name\": \"Kadeem Dorsey\",\n            \"email\": \"delapeq@mailinator.com\",\n            \"address\": \"123 Phillip Carson Street\",\n            \"phone\": 11234567890,\n            \"company\": \"Hendrix Nguyen Plc\",\n            \"notes\": \"Eveniet cumque volu\",\n            \"__v\": 0,\n            \"id\": \"61aa26f711778415b375e07b\"\n        }\n    ]\n}"}],"_postman_id":"dcc1be62-7cbe-457c-831d-a652dc7c5765"},{"name":"Get Client","event":[{"listen":"test","script":{"id":"ee7e56b6-e128-4cbc-b338-3bf305282739","exec":["pm.test(\"given GET request, returns 200 status\", () => {","    pm.response.to.have.status(200);","});","","const schema = {","  \"type\": \"object\",","  \"properties\": {","    \"user\": {","      \"type\": \"object\",","      \"properties\": {","        \"_id\": {","          \"type\": \"string\"","        },","        \"name\": {","          \"type\": \"string\"","        },","        \"email\": {","          \"type\": \"string\"","        },","        \"address\": {","          \"type\": \"string\"","        },","        \"phone\": {","          \"type\": \"integer\"","        },","        \"company\": {","          \"type\": \"string\"","        },","        \"notes\": {","          \"type\": \"string\"","        },","        \"__v\": {","          \"type\": \"integer\"","        },","        \"id\": {","          \"type\": \"string\"","        }","      },","      \"required\": [","        \"_id\",","        \"name\",","        \"email\",","        \"__v\",","        \"id\"","      ]","    }","  },","  \"required\": [","    \"user\"","  ]","}","","pm.test(\"given GET request, response matches schema\", () => {","    pm.response.to.have.jsonSchema(schema);","});",""],"type":"text/javascript"}}],"id":"cf9f815a-ed84-482a-8bf4-192bb46d51f0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{baseURL}}/api/get-client?id=","description":"<p>Returns a single client.</p>\n","urlObject":{"path":["api","get-client"],"host":["{{baseURL}}"],"query":[{"key":"id","value":""}],"variable":[]}},"response":[{"id":"7a165f9b-aa12-4d18-90f5-65b435d01437","name":"Success Response","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{baseURL}}/api/get-client?id=61aae9545e547d5199434e8c","host":["{{baseURL}}"],"path":["api","get-client"],"query":[{"key":"id","value":"61aae9545e547d5199434e8c"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"ETag","value":"\"e6-VRi5vRAjTXU1+DOzgwMOW8KYAz4\""},{"key":"Content-Length","value":"230"},{"key":"Vary","value":"Accept-Encoding"},{"key":"Date","value":"Wed, 08 Dec 2021 16:17:51 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"user\": {\n        \"_id\": \"61aae9545e547d5199434e8c\",\n        \"name\": \"Terry White\",\n        \"email\": \"Zachary59@hotmail.com\",\n        \"address\": \"4714 Jacobs Light\",\n        \"phone\": 532088077,\n        \"company\": \"Waters - Thiel\",\n        \"notes\": \"possimus\",\n        \"__v\": 0,\n        \"id\": \"61aae9545e547d5199434e8c\"\n    }\n}"}],"_postman_id":"cf9f815a-ed84-482a-8bf4-192bb46d51f0"},{"name":"Update Client","event":[{"listen":"test","script":{"id":"2c0221df-0d7e-4a1c-9c2d-b0c8cba10445","exec":["pm.test(\"given valid POST request, returns 201 status\", () => {","    pm.response.to.have.status(201);","});","","pm.test(\"given POST client, returns client updated message\", () => {","    const response = pm.response.json();","    const name = pm.collectionVariables.get(\"randomFullName\");","","    pm.expect(response.message).to.eql(`${name} successfully updated`);","});","","const schema = {","  \"type\": \"object\",","  \"properties\": {","    \"message\": {","      \"type\": \"string\"","    }","  },","  \"required\": [","    \"message\"","  ]","}","","pm.test(\"given valid POST request, response matches schema\", () => {","    pm.response.to.have.jsonSchema(schema);","});",""],"type":"text/javascript"}}],"id":"613d6927-f125-4fbb-95c1-ab7bb854c5e3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"id\": \"\",\n    \"name\": \"\",\n    \"notes\": \"Updated Notes\"\n}","options":{"raw":{"language":"json"}}},"url":"{{baseURL}}/api/update-client","description":"<p>Update details for an existing client. Note: the <code>name</code> value is simply used in the response message. If you do not pass in a <code>name</code> the response will be <code>\"undefined was successfully updated\"</code></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n \"id\": \"string\",\n \"name\": \"string\",\n}\n\n</code></pre>\n","urlObject":{"path":["api","update-client"],"host":["{{baseURL}}"],"query":[],"variable":[]}},"response":[{"id":"125d68f7-f2de-4a30-a931-fb4947925c2b","name":"Success Response","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"id\": \"61aae9545e547d5199434e8c\",\n    \"name\": \"Maureen Kunze\",\n    \"notes\": \"Updated Notes\"\n}","options":{"raw":{"language":"json"}}},"url":"{{baseURL}}/api/update-client"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"ETag","value":"\"30-WFSMtqZXj8vbHnnk+Iawb6Q3hic\""},{"key":"Content-Length","value":"48"},{"key":"Vary","value":"Accept-Encoding"},{"key":"Date","value":"Wed, 08 Dec 2021 16:25:01 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"Maureen Kunze successfully updated\"\n}"}],"_postman_id":"613d6927-f125-4fbb-95c1-ab7bb854c5e3"},{"name":"Delete Client","event":[{"listen":"test","script":{"id":"12a9870d-bbc0-4dd9-9456-7316c8506a24","exec":["pm.test(\"given valid DELETE request, returns 200 status\", () => {","    pm.response.to.have.status(200);","});","","pm.test(\"given deleted client, returns client deleted message\", () => {","    const response = pm.response.json();","    const name = pm.collectionVariables.get(\"randomFullName\");","","    pm.expect(response.message).to.eql(`${name} successfully deleted`);","});","","const schema = {","  \"type\": \"object\",","  \"properties\": {","    \"message\": {","      \"type\": \"string\"","    }","  },","  \"required\": [","    \"message\"","  ]","}","","pm.test(\"given valid DELETE request, response matches schema\", () => {","    pm.response.to.have.jsonSchema(schema);","});",""],"type":"text/javascript"}}],"id":"41e34147-3379-4dca-9c2b-a8253e59e063","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"id\": \"\",\n    \"name\": \"\"\n}","options":{"raw":{"language":"json"}}},"url":"{{baseURL}}/api/delete-client","description":"<p>Remove an existing client. Note: the <code>name</code> value is simply used in the response message. If you do not pass in a <code>name</code> the response will be <code>\"undefined was successfully deleted\"</code></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n\"id\": \"string\",\n  \"name\": \"string\"\n}\n\n</code></pre>\n","urlObject":{"path":["api","delete-client"],"host":["{{baseURL}}"],"query":[],"variable":[]}},"response":[{"id":"a4be7507-3b07-4b8e-90dd-bf649e402bb7","name":"Delete Client","originalRequest":{"method":"DELETE","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"id\": \"61aae9545e547d5199434e8c\",\n    \"name\": \"Maureen Kunze\"\n}","options":{"raw":{"language":"json"}}},"url":"{{baseURL}}/api/delete-client"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"ETag","value":"\"30-LTAYUMlvBqocymZ9qXpT+qYbWR8\""},{"key":"Content-Length","value":"48"},{"key":"Vary","value":"Accept-Encoding"},{"key":"Date","value":"Wed, 08 Dec 2021 16:25:32 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"Maureen Kunze successfully deleted\"\n}"}],"_postman_id":"41e34147-3379-4dca-9c2b-a8253e59e063"}],"variable":[{"key":"randomPhone","value":""},{"key":"randomFullName","value":""},{"key":"lastAddedClientID","value":""}]}