{"info":{"_postman_id":"9bf3f0a6-0c96-4b6b-acbb-933d86301fb3","name":"Medieval Store","description":"<html><head></head><body><p>Medieval Store is a RESTful API developed using TypeScript, Express.js and other technologies during the Back-end module at Trybe. This API simulates the running of a medieval/fantasy store, in which users can manage products and orders through CRUD operations.</p>\n<p>The endpoints were divided into three main groups:</p>\n<p>* Users &amp; Login<br>* Products<br>* Orders</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"22527487","collectionId":"9bf3f0a6-0c96-4b6b-acbb-933d86301fb3","publishedId":"2s83YWn66h","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2022-09-26T19:03:10.000Z"},"item":[{"name":"Users & Login","item":[{"name":"User registration","id":"03b42e8b-d65d-4ab8-b4e3-6462b8fdb098","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"username\": \"Muzoll The Hollow\",\n  \"classe\": \"Fighter\",\n  \"level\": 17,\n  \"password\": \"454545\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/users/","description":"<p>This route allows the registration of a new user. The registration is succeeded if valid <strong>username</strong>, <strong>classe, level</strong> and <strong>password</strong> are provided in the request's body.</p>\n<p>If the username, classe, level and password are valid, the system shall return status code 201 and a JWT token. This token will be used to authenticate the user on other endpoints.</p>\n","urlObject":{"path":["users",""],"host":["http://localhost:3000"],"query":[],"variable":[]}},"response":[{"id":"50b623da-e06e-42a3-8567-3b75680a74b5","name":"Object containing generated token","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n  \"username\": \"Lorril Sarleth\",\n  \"classe\": \"Ranger\",\n  \"level\": 27,\n  \"password\": \"4RR0W3\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/users/"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\"\n}"}],"_postman_id":"03b42e8b-d65d-4ab8-b4e3-6462b8fdb098"},{"name":"User login","id":"b0e4dd33-aa2a-436b-a60f-282363d7785f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"username\": \"Luric Kelmaris\",\n  \"password\": \"123123\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/login","description":"<p>This route allows the user to login into the system. The login is succeeded if valid <strong>username</strong> and <strong>password</strong> are provided in the request's body.</p>\n<p>If the username and password are valid, the system shall return status code 20 and a JWT token. This token will be used to authenticate the user on other endpoints.</p>\n","urlObject":{"path":["login"],"host":["http://localhost:3000"],"query":[],"variable":[]}},"response":[{"id":"d6ae46ee-fb63-4c36-a437-08d878ad8fe6","name":"Object containing generated token","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n  \"username\": \"Luric Kelmaris\",\n  \"password\": \"123123\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/login/"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c\"\n}"}],"_postman_id":"b0e4dd33-aa2a-436b-a60f-282363d7785f"}],"id":"883853f3-25ce-4e2c-86c1-1ebcd3c8dd91","description":"<p>These routes allow users to login, having their data validated in the database, and register a new username.</p>\n<p>*   The word <strong>classe</strong> was used instead of class for it is a reserved word in TypeScript;</p>\n","_postman_id":"883853f3-25ce-4e2c-86c1-1ebcd3c8dd91"},{"name":"Products","item":[{"name":"List products","id":"413b91fe-66cb-4967-af82-cfb65a959e5f","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"http://localhost:3000/products/","description":"<p>This route returns all existing products' information.</p>\n<p>It does not require authentication via JsonWebToken, meaning the data shall be returned even if the user is not logged in.</p>\n<p>The requests to this route shall receive as response a status code 200 and an object array containing product id, name, amount and order id.</p>\n","urlObject":{"path":["products",""],"host":["http://localhost:3000"],"query":[],"variable":[]}},"response":[{"id":"9a954782-c0df-4ba7-8900-b7043e4effdd","name":"Object array containing products information","originalRequest":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"http://localhost:3000/products/"},"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":"400"},{"key":"ETag","value":"W/\"190-laHt6dQ6m7zhh1c8iNhUShNVKYo\""},{"key":"Date","value":"Tue, 13 Sep 2022 19:36:51 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"[\n    {\n        \"id\": 1,\n        \"name\": \"Short Sword\",\n        \"amount\": \"20 gold pieces\",\n        \"orderId\": 1\n    },\n    {\n        \"id\": 2,\n        \"name\": \"Battle Axe\",\n        \"amount\": \"10 gold pieces\",\n        \"orderId\": 1\n    },\n    {\n        \"id\": 3,\n        \"name\": \"Morningstar\",\n        \"amount\": \"15 gold pieces\",\n        \"orderId\": 2\n    },\n    {\n        \"id\": 4,\n        \"name\": \"Rapier\",\n        \"amount\": \"25 gold pieces\",\n        \"orderId\": 2\n    },\n    {\n        \"id\": 5,\n        \"name\": \"Longbow\",\n        \"amount\": \"50 gold pieces\",\n        \"orderId\": 3\n    }\n]"}],"_postman_id":"413b91fe-66cb-4967-af82-cfb65a959e5f"},{"name":"Insert a product","id":"3f0b1369-9eb3-4374-9eba-1f8ae4de003b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"Rapier\",\n  \"amount\": \"18 silver pieces\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/products/","description":"<p>This route is used to create a new product in the database. The product insertion is valid if <strong>name</strong> and <strong>amount</strong> are provided in the request body.</p>\n<p>It does not require authentication via JsonWebToken, meaning the new product is created even if the user is not logged in.</p>\n<p>The successful requests to this route shall receive as response a status code 201 and an object containing product id, name and amount.</p>\n","urlObject":{"path":["products",""],"host":["http://localhost:3000"],"query":[],"variable":[]}},"response":[{"id":"5231ad06-6212-4cb5-bcb6-84a17a09eec4","name":"Object with created product information","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"Morning Star\",\n  \"amount\": \"21 gold pieces\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/products/"},"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":"56"},{"key":"ETag","value":"W/\"38-4KKXK3KZaRRH5LYYo24c0yR59Ao\""},{"key":"Date","value":"Tue, 13 Sep 2022 20:10:43 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"id\": 6,\n    \"name\": \"Glaive\",\n    \"amount\": \"30 gold pieces\"\n}"},{"id":"27fa553f-ff4b-4bd0-8fdc-f1132f7a3a61","name":"Object with created product information","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"Rapier\",\n  \"amount\": \"18 silver pieces\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/products/"},"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":"52"},{"key":"ETag","value":"W/\"34-vHJa6sx2f8edMBaMYZZuAL0R9+Q\""},{"key":"Date","value":"Tue, 13 Sep 2022 20:11:06 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Keep-Alive","value":"timeout=5"}],"cookie":[],"responseTime":null,"body":"{\n    \"id\": 7,\n    \"name\": \"Sling\",\n    \"amount\": \"1 silver piece\"\n}"}],"_postman_id":"3f0b1369-9eb3-4374-9eba-1f8ae4de003b"}],"id":"37524ad5-4e3f-4d8b-98d5-81a7a4648a35","description":"<p>These routes allow creation and listing of products.</p>\n<p>*   <strong>amount</strong> represents the item's cost.</p>\n","_postman_id":"37524ad5-4e3f-4d8b-98d5-81a7a4648a35"},{"name":"Orders","item":[{"name":"List orders","id":"51fbf60e-f028-4bd4-b301-bee07ee4545f","request":{"method":"GET","header":[{"key":"Accept","value":"application/json"}],"url":"http://localhost:3000/orders/","description":"<p>This route returns all existing orders' information.</p>\n<p>It does not require authentication via JsonWebToken, meaning the data shall be returned even if the user is not logged in.</p>\n<p>The requests to this route shall receive as response a status code 200 and an object array containing id, userId and productsIds, the last one being an array.</p>\n","urlObject":{"path":["orders",""],"host":["http://localhost:3000"],"query":[],"variable":[]}},"response":[{"id":"a981468d-e9e8-489b-b8cf-af146c4ce007","name":"Object array containing orders information","originalRequest":{"method":"GET","header":[],"url":"http://localhost:3000/orders/"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"[\n  {\n    \"id\": 5,\n    \"userId\": 3,\n    \"productsIds\": [\n      6,\n      6\n    ]\n  },\n  {\n    \"id\": 5,\n    \"userId\": 3,\n    \"productsIds\": [\n      6,\n      6\n    ]\n  }\n]"}],"_postman_id":"51fbf60e-f028-4bd4-b301-bee07ee4545f"},{"name":"Insert an order","id":"88691bdd-21fd-4019-9158-7f02511ee193","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"productsIds\": [\n    6,\n    6\n  ]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/orders/","description":"<p>This route is used to create a new order in the database. The order insertion is valid if <strong>productsIds</strong> is provided in the request body.</p>\n<p>This route requires the user to be logged in, expecting a valid token sent through header in the <strong>authorization</strong> key.</p>\n<p>The successful requests to this route shall receive as response a status code 201 and an object containing id, userId and productsIds.</p>\n","urlObject":{"path":["orders",""],"host":["http://localhost:3000"],"query":[],"variable":[]}},"response":[{"id":"23ba1bbc-6118-4245-89b8-5738e1aa37c2","name":"Object with created order information","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n  \"productsIds\": [\n    6,\n    6\n  ]\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:3000/orders/"},"status":"Created","code":201,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"}],"cookie":[],"responseTime":null,"body":"{\n  \"userId\": 1,\n  \"productsIds\": [\n    6,\n    6\n  ]\n}"}],"_postman_id":"88691bdd-21fd-4019-9158-7f02511ee193"}],"id":"2b843eeb-5f70-45a0-8725-e04f4d9d25f4","description":"<p>These routes allow creation and listing of orders.</p>\n<p>* <strong>id</strong> is the identifier of the sale/order.<br />* <strong>userId</strong> represents which user is associated to that order.<br />* <strong>productsIds</strong> is an array containing the ids of each product in the order.</p>\n","_postman_id":"2b843eeb-5f70-45a0-8725-e04f4d9d25f4"}],"variable":[{"id":"ffb23507-d44c-40f0-b5f1-103465b3d685","key":"baseUrl","value":"http://localhost:3000","type":"string"}]}