{"info":{"_postman_id":"7fe479d7-4a74-47f5-bfb8-09bbd5ab1391","name":"Cafe and Wifi API","description":"<html><head></head><body><h1 id=\"cafe-and-wifi-api\">Cafe and Wifi API</h1>\n<p>This API provides endpoints to manage and discover cafes, including their amenities, locations, and pricing. It is designed for applications that need to display, add, update, or remove cafes, as well as for users seeking cafes with specific features such as WiFi, power sockets, or affordable coffee.</p>\n<h2 id=\"endpoints-overview\">Endpoints Overview</h2>\n<ul>\n<li><strong>GET /all</strong>: Retrieve a list of all cafes with their details.</li>\n<li><strong>GET /search?loc=LOCATION</strong>: Search for cafes in a specific location.</li>\n<li><strong>GET /random</strong>: Get details for a random cafe.</li>\n<li><strong>POST /add</strong>: Add a new cafe to the database.</li>\n<li><strong>PATCH /update-price/?new_price=PRICE</strong>: Update the coffee price for a specific cafe.</li>\n<li><strong>DELETE /report-closed/?api_key=KEY</strong>: Delete a cafe (requires API key).</li>\n</ul>\n<h2 id=\"getting-started\">Getting Started</h2>\n<ul>\n<li>Base URL: <code>http://localhost:5000/</code></li>\n<li>All endpoints return JSON responses.</li>\n<li>Some endpoints require parameters in the query string or request body.</li>\n</ul>\n<h2 id=\"authentication\">Authentication</h2>\n<ul>\n<li>Deleting a cafe requires an API key as a query parameter.</li>\n</ul>\n<h2 id=\"example-usage\">Example Usage</h2>\n<ul>\n<li>See individual request documentation for example requests and responses.</li>\n</ul>\n<h2 id=\"contact\">Contact</h2>\n<p>For questions or support, contact the API maintainer.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"Cafe and Wifi API","slug":"cafe-and-wifi-api"}],"owner":"50726073","collectionId":"7fe479d7-4a74-47f5-bfb8-09bbd5ab1391","publishedId":"2sB3dSP8Yv","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2025-12-10T20:18:31.000Z"},"item":[{"name":"all cafes","id":"4e04eb9a-6a6b-4968-a900-7eb603406f10","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://127.0.0.1:5000/all","description":"<p><strong>GET /all</strong></p>\n<p>Retrieves a list of all cafes in the database, including their amenities, location, and other details. This endpoint is useful for displaying all available cafes to users, such as in a directory or map view.</p>\n<p><strong>Response</strong></p>\n<ul>\n<li>Returns a JSON object with a single key <code>cafe</code>, which contains an array of cafe objects.</li>\n<li>Each cafe object includes:<ul>\n<li><code>id</code>: Unique identifier for the cafe</li>\n<li><code>name</code>: Name of the cafe</li>\n<li><code>location</code>: Area or neighborhood</li>\n<li><code>seats</code>: Number of seats (may be a range or estimate)</li>\n<li><code>coffee_price</code>: Typical price for a coffee (string, may include currency symbol)</li>\n<li><code>has_wifi</code>: Boolean, whether WiFi is available</li>\n<li><code>has_sockets</code>: Boolean, whether power sockets are available</li>\n<li><code>has_toilet</code>: Boolean, whether toilets are available</li>\n<li><code>can_take_calls</code>: Boolean, whether phone calls are allowed</li>\n<li><code>img_url</code>: URL to an image of the cafe</li>\n<li><code>map_url</code>: URL to the cafe's location on a map</li>\n</ul>\n</li>\n</ul>\n<p><strong>Example Response</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"cafe\": [\n    {\n      \"can_take_calls\": false,\n      \"coffee_price\": \"£3.00\",\n      \"has_sockets\": true,\n      \"has_toilet\": true,\n      \"has_wifi\": true,\n      \"id\": 7,\n      \"img_url\": \"https://lh3.googleusercontent.com/p/AF1Q...\",\n      \"location\": \"Shoreditch\",\n      \"map_url\": \"https://g.page/acehotellondon?share\",\n      \"name\": \"Ace Hotel Shoreditch\",\n      \"seats\": \"50+\"\n    }\n  ]\n}\n</code></pre>\n","urlObject":{"protocol":"http","port":"5000","path":["all"],"host":["127","0","0","1"],"query":[],"variable":[]}},"response":[],"_postman_id":"4e04eb9a-6a6b-4968-a900-7eb603406f10"},{"name":"search cafe by location","id":"35a83aab-2afb-4dfd-a604-39888efa35f0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/search?loc=Peckham","description":"<p>Search for cafes in a specific location.</p>\n<p>This GET endpoint returns a list of cafes that match the provided location. You must supply the 'loc' query parameter with the name of the location you want to search for (e.g., 'Peckham').</p>\n<p><strong>Required Query Parameter:</strong></p>\n<ul>\n<li><code>loc</code> (string): The location to search for cafes (e.g., 'Peckham').</li>\n</ul>\n<p><strong>Example Request:</strong><br />GET /search?loc=Peckham</p>\n<p><strong>Example Response:</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"cafe\": [\n    {\n      \"id\": 4,\n      \"name\": \"Old Spike\",\n      \"location\": \"Peckham\",\n      \"coffee_price\": \"£2.80\",\n      \"has_wifi\": true,\n      \"has_sockets\": true,\n      \"has_toilet\": false,\n      \"can_take_calls\": false,\n      \"seats\": \"0-10\",\n      \"img_url\": \"https://lh3.googleusercontent.com/p/AF1Q...\",\n      \"map_url\": \"https://www.google.com/maps/place/Old+Sp...\"\n    },\n    ...\n  ]\n}\n\n</code></pre>\n","urlObject":{"protocol":"http","port":"5000","path":["search"],"host":["localhost"],"query":[{"key":"loc","value":"Peckham"}],"variable":[]}},"response":[],"_postman_id":"35a83aab-2afb-4dfd-a604-39888efa35f0"},{"name":"random cafe","id":"7ed4e2e5-9176-4a1d-b835-2e7f9bda05ec","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:5000/random","description":"<p>Returns details for a random cafe, including its name, location, amenities (wifi, sockets, toilet), coffee price, seating capacity, and relevant URLs (image and map).</p>\n<p><strong>Endpoint:</strong> GET /random</p>\n<p><strong>Purpose:</strong></p>\n<ul>\n<li>Discover a random cafe from the database, useful for users seeking a spontaneous suggestion.</li>\n</ul>\n<p><strong>Response:</strong></p>\n<ul>\n<li>Returns a JSON object with a single key <code>cafe</code>, containing a cafe object with all details.</li>\n</ul>\n<p><strong>Example Response:</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"cafe\": {\n    \"id\": 3,\n    \"name\": \"Coffee House\",\n    \"location\": \"Downtown\",\n    \"coffee_price\": \"$3.50\",\n    \"has_wifi\": true,\n    \"has_sockets\": false,\n    \"has_toilet\": true,\n    \"can_take_calls\": true,\n    \"seats\": \"20-30\",\n    \"img_url\": \"https://example.com/cafe.jpg\",\n    \"map_url\": \"https://maps.example.com/cafe\"\n  }\n}\n</code></pre>\n","urlObject":{"protocol":"http","port":"5000","path":["random"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"7ed4e2e5-9176-4a1d-b835-2e7f9bda05ec"},{"name":"add new cafe","id":"5ec3dbdb-cf14-4039-990a-da5ac531a5ac","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"urlencoded","urlencoded":[{"key":"name","value":"Varka","type":"text","uuid":"352052ff-9916-477f-a91b-4b8f03ee9424"},{"key":"map_url","value":"https://yandex.by/maps/-/CLsjrVNx","type":"text","uuid":"32d7f071-dc3e-4573-a99e-c5d00d75df09"},{"key":"img_url","value":"https://avatars.mds.yandex.net/get-altay/13525210/2a00000194c6bfde993cd41a44df7f9abd32/XXXL","type":"text","uuid":"5e5940ec-a448-4e07-aada-e7dbd7ae536f"},{"key":"location","value":"Minsk","type":"text","uuid":"6dda3053-cddd-428d-b2ac-97a64406c273"},{"key":"seats","value":"10","type":"text","uuid":"d82d2937-9494-451e-9188-cac6247fe7de"},{"key":"has_toilet","value":"1","type":"text","uuid":"71689042-c964-4c00-8878-57499764e047"},{"key":"has_wifi","value":"1","type":"text","uuid":"d9d00223-f58f-45cc-9f79-42e7d9441a93"},{"key":"has_sockets","value":"0","type":"text","uuid":"16680f7a-049c-4238-b151-bd9ff7cc30ea"},{"key":"can_take_calls","value":"0","type":"text","uuid":"e30e7f14-6e26-4e97-917c-3c6902428fc3"},{"key":"coffee_price","value":"$3","type":"text","uuid":"e0dc4c27-be38-4f46-9e92-964a1f68787c"}]},"url":"http://localhost:5000/add","description":"<p>Adds a new cafe to the database.</p>\n<p><strong>Endpoint:</strong> POST /add</p>\n<p><strong>Required Parameters (x-www-form-urlencoded):</strong></p>\n<ul>\n<li><code>name</code> (string): Name of the cafe</li>\n<li><code>map_url</code> (string): Link to the cafe location on a map</li>\n<li><code>img_url</code> (string): URL to an image of the cafe</li>\n<li><code>location</code> (string): City or area where the cafe is located</li>\n<li><code>seats</code> (integer): Number of seats available</li>\n<li><code>has_toilet</code> (0 or 1): Whether the cafe has a toilet (1 = yes, 0 = no)</li>\n<li><code>has_wifi</code> (0 or 1): Whether the cafe has WiFi (1 = yes, 0 = no)</li>\n<li><code>has_sockets</code> (0 or 1): Whether the cafe has power sockets (1 = yes, 0 = no)</li>\n<li><code>can_take_calls</code> (0 or 1): Whether calls can be taken (1 = yes, 0 = no)</li>\n<li><code>coffee_price</code> (string): Price of a cup of coffee (e.g., \"$3\")</li>\n</ul>\n<p><strong>Example Successful Response:</strong></p>\n<p><code>json {   \"response\": {     \"success\": \"Successfully added the new cafe.\"   } }</code></p>\n","urlObject":{"protocol":"http","port":"5000","path":["add"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"5ec3dbdb-cf14-4039-990a-da5ac531a5ac"},{"name":"change price","id":"cbbb7871-8600-4cce-a8b5-3ee7f46fcdf1","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[],"body":{"mode":"urlencoded","urlencoded":[]},"url":"http://localhost:5000/update-price/22?new_price=$4","description":"<p>Updates the price of coffee for a specific cafe.</p>\n<p><strong>Endpoint:</strong> PATCH /update-price/?new_price=</p>\n<p><strong>Required Parameters:</strong></p>\n<ul>\n<li><code>cafe_id</code> (path): The unique ID of the cafe to update.</li>\n<li><code>new_price</code> (query): The new price for a cup of coffee (e.g., \"$4\").</li>\n</ul>\n<p><strong>Example Request:</strong>\nPATCH /update-price/22?new_price=$4</p>\n<p><strong>Example Response:</strong></p>\n<p>```json\n{\n  \"success\": \"Successfully updated the price for cafe with id 22.\"\n}\n`</p>\n","urlObject":{"protocol":"http","port":"5000","path":["update-price","22"],"host":["localhost"],"query":[{"key":"new_price","value":"$4"}],"variable":[]}},"response":[],"_postman_id":"cbbb7871-8600-4cce-a8b5-3ee7f46fcdf1"},{"name":"delete cafe with wrong api_key","id":"aa8b9fbf-95c8-4170-9763-543344e540e5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"body":{"mode":"urlencoded","urlencoded":[]},"url":"http://localhost:5000/report-closed/22?api_key=TopSecretAPIKey3","description":"<p>Deletes a cafe from the database if the correct API key is provided.</p>\n<p><strong>Endpoint:</strong> DELETE /report-closed/?api_key=</p>\n<p><strong>Required Parameters:</strong></p>\n<ul>\n<li><code>cafe_id</code> (path): The unique ID of the cafe to delete.</li>\n<li><code>api_key</code> (query): The API key required for authorization.</li>\n</ul>\n<p><strong>Example Request:</strong>\nDELETE /report-closed/22?api_key=TopSecretAPIKey3</p>\n<p><strong>Example Response (success):</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"success\": \"Cafe with id 22 has been deleted.\"\n}\n</code></pre>\n<p><strong>Example Response (failure):</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"error\": \"Invalid API key. Cafe could not be deleted.\"\n}\n</code></pre>\n","urlObject":{"protocol":"http","port":"5000","path":["report-closed","22"],"host":["localhost"],"query":[{"key":"api_key","value":"TopSecretAPIKey3"}],"variable":[]}},"response":[],"_postman_id":"aa8b9fbf-95c8-4170-9763-543344e540e5"},{"name":"delete cafe with right api_key","id":"ea74d997-d1a5-498d-b360-a72c25d15d2a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"body":{"mode":"urlencoded","urlencoded":[]},"url":"http://localhost:5000/report-closed/22?api_key=TopSecretAPIKey","description":"<p>Deletes a specific cafe by its ID. Requires a valid 'api_key' as a query parameter for authorization. On success, returns a confirmation message. If the 'api_key' is missing or invalid, or if the cafe does not exist, returns an error response.</p>\n","urlObject":{"protocol":"http","port":"5000","path":["report-closed","22"],"host":["localhost"],"query":[{"key":"api_key","value":"TopSecretAPIKey"}],"variable":[]}},"response":[],"_postman_id":"ea74d997-d1a5-498d-b360-a72c25d15d2a"}]}