{"info":{"_postman_id":"e43dbdcd-d7e4-45a5-838b-2dd4e36910ce","name":"Category","description":"<html><head></head><body><p>The Categories Collection API provides endpoints for managing article categories within the Newspaper Backend system. Use these endpoints to perform CRUD (Create, Read, Update, Delete) operations on categories, allowing for efficient organization and classification of articles.</p>\n<p><strong>Base URL:</strong> <code>https://newspaper.azurewebsites.net/api/v1/category</code></p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"32008492","collectionId":"e43dbdcd-d7e4-45a5-838b-2dd4e36910ce","publishedId":"2sA2xiWXk6","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2024-03-11T21:44:27.000Z"},"item":[{"name":"Create Category","id":"f1e68119-9a42-4976-ae62-b275ca95ef39","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"name\": \"uncategorized\",\r\n    \"description\": \"Aut veritatis similique saepe inventore tempora in quo. Exercitationem dolores labore officiis quo cum aliquid itaque. Eos dolorum tempora velit et molestias natus facere est. Ipsam omnis sit et placeat consequuntur. Et nam provident.\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_category}}/create-category","description":"<p>This endpoint allows you to create a new category. The request should be sent to {{base_category}}/create-category using the HTTP POST method.</p>\n<h3 id=\"request-body\">Request Body</h3>\n<p>The request body should be in raw JSON format and include the following parameters:</p>\n<ul>\n<li><code>name</code>: (string) The name of the category.</li>\n<li><code>description</code>: (string) A description of the category.</li>\n</ul>\n<h3 id=\"response\">Response</h3>\n<p>The response will include the following fields:</p>\n<ul>\n<li><code>statusCode</code>: A status code indicating the result of the operation.</li>\n<li><code>data</code>: An empty string in this case.</li>\n<li><code>message</code>: An object containing the details of the created category, including its name, description, articles, ID, and version.</li>\n<li><code>success</code>: A boolean value indicating the success of the operation.</li>\n</ul>\n<p>Example Response:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"statusCode\": 0,\n    \"data\": \"\",\n    \"message\": {\n        \"name\": \"\",\n        \"description\": \"\",\n        \"articles\": [],\n        \"_id\": \"\",\n        \"__v\": 0\n    },\n    \"success\": true\n}\n\n</code></pre>\n","urlObject":{"path":["create-category"],"host":["{{base_category}}"],"query":[],"variable":[]}},"response":[{"id":"33d9f649-766c-4c2f-9b47-5a2a50eb8ef4","name":"201 Created","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"name\": \"uncategorized\",\r\n    \"description\": \"Quod et dolor explicabo mollitia. Commodi aut accusantium quam omnis velit officia. Sit qui facere et perspiciatis. Voluptatum rerum eos sed. Molestiae qui amet minus vitae quia eos perferendis velit numquam. Minus qui pariatur reprehenderit et fugiat nemo.\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_category}}/create-category"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"400"},{"key":"ETag","value":"W/\"190-Wlk7QOzSHOCBgP1lbXX+3bUMaJ0\""},{"key":"Date","value":"Mon, 11 Mar 2024 13:04:17 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"statusCode\": 201,\n    \"data\": \"Category created successfully\",\n    \"message\": {\n        \"name\": \"uncategorized\",\n        \"description\": \"A incidunt quos veniam eveniet in sit omnis autem. Pariatur ut iure alias odit possimus autem vero ut nulla. Qui voluptatem exercitationem. Sunt nihil aut iure. Dignissimos ex assumenda ut placeat laborum est iure fugiat.\",\n        \"articles\": [],\n        \"_id\": \"65ef015149b11889a23008a1\",\n        \"__v\": 0\n    },\n    \"success\": true\n}"},{"id":"8fa61188-f492-401c-ac76-65291bc3fdf2","name":"401 Unauthorized","originalRequest":{"method":"POST","header":[],"url":"{{base_category}}/create-category"},"status":"Unauthorized","code":401,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"31"},{"key":"ETag","value":"W/\"1f-crg7ovEEHb9AqDObckZob3ngQr8\""},{"key":"Date","value":"Mon, 11 Mar 2024 12:52:10 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Please authenticate\"\n}"},{"id":"ee9e5b81-f5e0-473a-9d80-f665548a719c","name":"400 Already Exists","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"name\": \"uncategorized\",\r\n    \"description\": \"Enim voluptas voluptatem officia nobis officiis. A aut dolorem quo dolor. Beatae aut dicta vitae dolorem illo expedita qui dolore minima. Optio nulla laudantium velit voluptas dignissimos. Et a amet molestiae et. Qui velit voluptatum sunt sed laborum.\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_category}}/create-category"},"status":"Bad Request","code":400,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"350"},{"key":"Date","value":"Mon, 11 Mar 2024 13:04:42 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Category already exists\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\categoryController.js:16:11\n            <br> &nbsp; &nbsp;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n        </pre>\n    </body>\n</html>"}],"_postman_id":"f1e68119-9a42-4976-ae62-b275ca95ef39"},{"name":"All Categorys","id":"b722be11-1bea-40b3-88c1-9d4f6282d64b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_category}}/","description":"<p>This endpoint makes an HTTP GET request to retrieve the list of categories. The response will be in JSON format with a status code of 200. The response body will contain an array of category objects, where each object includes the category ID, name, description, and a list of articles associated with that category.</p>\n","urlObject":{"path":[""],"host":["{{base_category}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"b722be11-1bea-40b3-88c1-9d4f6282d64b"},{"name":"Get Category","id":"02c6ac34-8334-4baa-ab06-28e36adaf92e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_category}}/65ef015149b11889a23008a1","description":"<p>This endpoint makes an HTTP GET request to retrieve data from the specified category with the given ID. The response will be in JSON format and will include a status code, data, message, and success indicator. </p>\n","urlObject":{"path":["65ef015149b11889a23008a1"],"host":["{{base_category}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"02c6ac34-8334-4baa-ab06-28e36adaf92e"},{"name":"Update Category","id":"feeb4a2c-bd5c-46bd-902f-1b824d969142","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"name\": \"uncategorized-updated\",\r\n    \"description\": \"Sapiente rerum quaerat. Ducimus saepe illum explicabo et tempora tenetur atque aut. Dolor ducimus sit facere corporis repellendus quae.\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_category}}/65ef015149b11889a23008a1","description":"<p>This endpoint makes an HTTP PUT request to update a specific category using the provided category ID in the URL. The request body should contain the updated \"name\" and \"description\" of the category.</p>\n<h3 id=\"request-body\">Request Body</h3>\n<ul>\n<li>name (string, required): The updated name of the category.</li>\n<li>description (string, required): The updated description of the category.</li>\n</ul>\n<h3 id=\"response\">Response</h3>\n<p>The endpoint returns a 404 status code with a \"text/html\" content type in case the category is not found or if there is a database error. The response body contains an error message indicating the cause of the error.</p>\n<h4 id=\"example-response\">Example Response</h4>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"statusCode\": 0,\n    \"data\": \"\",\n    \"message\": {\n        \"_id\": \"\",\n        \"name\": \"\",\n        \"description\": \"\",\n        \"articles\": [],\n        \"__v\": 0\n    },\n    \"success\": true\n}\n\n</code></pre>\n","urlObject":{"path":["65ef015149b11889a23008a1"],"host":["{{base_category}}"],"query":[],"variable":[]}},"response":[{"id":"930e9fd7-1aaf-474a-878a-e2681c62e6a2","name":"200 Success","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"name\": \"uncategorized-updated\",\r\n    \"description\": \"Consequuntur architecto illo sapiente autem accusamus nihil aperiam. Numquam nostrum et. Autem deserunt quisquam cupiditate dolor aliquam voluptatem quibusdam. Sed quia sed alias.\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_category}}/65ef015149b11889a23008a1"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"404"},{"key":"ETag","value":"W/\"194-sbib3qgB4pWq1dDo5j+7kR7mev8\""},{"key":"Date","value":"Mon, 11 Mar 2024 13:11:09 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"statusCode\": 200,\n    \"data\": \"Category updated successfully\",\n    \"message\": {\n        \"_id\": \"65ef015149b11889a23008a1\",\n        \"name\": \"uncategorized-updated\",\n        \"description\": \"Consequatur enim dolorum repudiandae et perspiciatis aut. Ipsa quis nulla rem exercitationem et natus porro. Quae dolor optio dolor qui illum qui. Facere saepe tenetur sit laudantium ea ut. Earum quis et et ut magnam.\",\n        \"articles\": [],\n        \"__v\": 0\n    },\n    \"success\": true\n}"},{"id":"f41d8a65-aa2b-415d-a0f6-1ae8ed5fc069","name":"401 Unauthorized","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"name\": \"uncategorized-updated\",\r\n    \"description\": \"Autem illo temporibus molestiae iure eum beatae fugiat saepe. Sit recusandae perspiciatis reprehenderit ducimus et maxime ea alias debitis. Voluptatibus consequatur beatae consequatur eum blanditiis quas dignissimos. Sint est neque dolores ad vitae. Aliquid aut sequi aut eos aut reprehenderit qui. Aut nemo facere et eligendi earum molestiae esse doloribus dignissimos.\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_category}}/65ef015149b11889a23008a1"},"status":"Unauthorized","code":401,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"31"},{"key":"ETag","value":"W/\"1f-crg7ovEEHb9AqDObckZob3ngQr8\""},{"key":"Date","value":"Mon, 11 Mar 2024 13:12:28 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"error\": \"Please authenticate\"\n}"},{"id":"7fdb8d28-e680-4e76-9a0b-5234190ddbbf","name":"404 Not Found","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"name\": \"uncategorized-updated\",\r\n    \"description\": \"Sit sit in autem. Quidem aut quia. Aut itaque qui aut necessitatibus. Enim temporibus quam qui non dicta.\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_category}}/65ef015149b11889a23008a1"},"status":"Not Found","code":404,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"363"},{"key":"Date","value":"Mon, 11 Mar 2024 13:25:15 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Category Not Found OR Database Error\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\categoryController.js:60:11\n            <br> &nbsp; &nbsp;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n        </pre>\n    </body>\n</html>"},{"id":"e72cca25-c47a-4794-81fd-3aff77f46669","name":"400 Bad Request","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"name\": \"uncategorized-updated\",\r\n    \"description\": \"Cum id hic quia id qui ab. Iste dignissimos cupiditate suscipit dolorem. Vel voluptatem et et eveniet et. Vel repellendus voluptatibus. Fugiat et autem aspernatur. Quasi consequatur nam quas molestiae.\"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_category}}/65ef015149b11889a2300"},"status":"Bad Request","code":400,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"807"},{"key":"Date","value":"Mon, 11 Mar 2024 13:26:58 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Category ID must be 24 characters\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\categoryController.js:57:11\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\utils\\asyncHandler.js:3:21\n            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\layer.js:95:5)\n            <br> &nbsp; &nbsp;at next (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\route.js:137:13)\n            <br> &nbsp; &nbsp;at isUserLoggedin (F:\\Personal Project\\Newspaper-Backend\\middlewares\\isUserLoggedin.js:33:5)\n            <br> &nbsp; &nbsp;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n        </pre>\n    </body>\n</html>"}],"_postman_id":"feeb4a2c-bd5c-46bd-902f-1b824d969142"},{"name":"Delete Category","id":"7fe95993-4437-4a4d-bed2-08af55403a50","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"{{base_category}}/65ef015149b11889a23008a1","description":"<p>This endpoint sends an HTTP DELETE request to the specified category with the given ID. Upon successful deletion, it returns a response with a status code, data, message, and success indicator.</p>\n<p>The response will include the following fields:</p>\n<ul>\n<li>statusCode: The status code of the response.</li>\n<li>data: The data returned in the response.</li>\n<li>message: An object containing details about the deletion, including the ID, name, description, and articles of the deleted category.</li>\n<li>success: A boolean indicator of the success of the deletion operation.</li>\n</ul>\n","urlObject":{"path":["65ef015149b11889a23008a1"],"host":["{{base_category}}"],"query":[],"variable":[]}},"response":[{"id":"0f6c8b66-ef9a-4ca4-925d-c0d1eac85a7a","name":"200 Success","originalRequest":{"method":"DELETE","header":[],"url":"{{base_category}}/65ef015149b11889a23008a1"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"543"},{"key":"ETag","value":"W/\"21f-2LGpQHn9QwxmFGYbhkUUUXw5Krk\""},{"key":"Date","value":"Mon, 11 Mar 2024 13:15:20 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"statusCode\": 200,\n    \"data\": \"Category deleted successfully\",\n    \"message\": {\n        \"_id\": \"65ef015149b11889a23008a1\",\n        \"name\": \"uncategorized-updated\",\n        \"description\": \"Ullam modi velit voluptas maiores repudiandae aut tenetur. Rerum ad dicta alias aut commodi voluptas consectetur atque dignissimos. Corporis repudiandae quidem eaque. Repellendus assumenda distinctio porro exercitationem explicabo tempora consectetur deleniti. Qui itaque sint ipsa aspernatur sunt aut vero tempore veniam. Quia molestias consequatur velit.\",\n        \"articles\": [],\n        \"__v\": 0\n    },\n    \"success\": true\n}"},{"id":"425637b9-9218-4e0f-9191-2f2ac35bb1af","name":"404 Not found","originalRequest":{"method":"DELETE","header":[],"url":"{{base_category}}/65ef015149b11889a23008a1"},"status":"Not Found","code":404,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"357"},{"key":"Date","value":"Mon, 11 Mar 2024 13:23:13 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Category not found OR DB error\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\categoryController.js:77:11\n            <br> &nbsp; &nbsp;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n        </pre>\n    </body>\n</html>"},{"id":"d5842958-6985-463c-a5b7-c3b2c88899bd","name":"400 Bad Request","originalRequest":{"method":"DELETE","header":[],"url":"{{base_category}}/65ef015149b11889a2300"},"status":"Bad Request","code":400,"_postman_previewlanguage":"html","header":[{"key":"X-Powered-By","value":"Express"},{"key":"Content-Security-Policy","value":"default-src 'self'"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"Content-Type","value":"text/html; charset=utf-8"},{"key":"Content-Length","value":"807"},{"key":"Date","value":"Mon, 11 Mar 2024 13:23:35 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"<!DOCTYPE html>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n        <title>Error</title>\n    </head>\n    <body>\n        <pre>Error: Category ID must be 24 characters\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\controllers\\categoryController.js:70:11\n            <br> &nbsp; &nbsp;at F:\\Personal Project\\Newspaper-Backend\\utils\\asyncHandler.js:3:21\n            <br> &nbsp; &nbsp;at Layer.handle [as handle_request] (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\layer.js:95:5)\n            <br> &nbsp; &nbsp;at next (F:\\Personal Project\\Newspaper-Backend\\node_modules\\express\\lib\\router\\route.js:137:13)\n            <br> &nbsp; &nbsp;at isUserLoggedin (F:\\Personal Project\\Newspaper-Backend\\middlewares\\isUserLoggedin.js:33:5)\n            <br> &nbsp; &nbsp;at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n        </pre>\n    </body>\n</html>"}],"_postman_id":"7fe95993-4437-4a4d-bed2-08af55403a50"}]}