{"info":{"_postman_id":"74106811-eeb1-43f6-a37a-e5f52222e8f4","name":"yelpcamp api v1","description":"<html><head></head><body><h1 id=\"introduction\">Introduction</h1>\n<p>YelpCamp API is the backend service for YelpCamp.</p>\n<p>Link: <a href=\"https://yelpcamp-backend-production.up.railway.app/\">https://yelpcamp-backend-production.up.railway.app/</a></p>\n<h1 id=\"overview\">Overview</h1>\n<p>The API was designed to satisfy requirements of YelpCamp Codewell challenge. As such the API may not contain a lot of fields.</p>\n<h2 id=\"available-routes\">Available routes</h2>\n<p><strong>POST:</strong> /api/auth/register - creates a new user</p>\n<p><strong>POST:</strong> /api/auth/login - signs in a user</p>\n<p><strong>POST:</strong> /api/auth/logout - signs out a user</p>\n<p><strong>GET:</strong> /api/camps - returns all campgrounds</p>\n<p><strong>POST:</strong> /api/camps/new - creates a new campground</p>\n<p><strong>GET:</strong> /api/camps/{id} - returns a single campground</p>\n<p><strong>PATCH:</strong> /api/camps/{id} - updates a campground</p>\n<p><strong>GET:</strong> /api/camps/search - returns campgrounds that satisfy the search query</p>\n<p><strong>GET:</strong> /api/comments/{camp_id} - returns comments for a campground</p>\n<p><strong>POST:</strong> /api/comments/new/{camp_id} - creates a new comment</p>\n<h1 id=\"authentication\">Authentication</h1>\n<p>The API if free and does not require any authentication.<br>Some routes such as <code>/api/capms/:id</code> are however protected and require authorization. For this you'd have to register and login as a user would.</p>\n<p>The API is currently still in development and some features may change</p>\n<h2 id=\"log-in\">Log in</h2>\n<p>* Send <strong>POST</strong> request to <code>/api/auth/register</code> with <code>{\"username\":\"\",\"password\":\"}</code> as body<br>* Send <strong>POST</strong> request to <code>/api/auth/login</code> with <code>{\"username\":\"\",\"password\":\"}</code> as body<br>* The request to <code>/api/login</code> responds with a json object containing a <strong>token</strong> e.g</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MmZlN2JiYjg0ZjRiMGQ0MmE3ZmU4ODgiLCJpYXQiOjE2NjI3OTMyMjJ9.CQ3LLlaej7jDynZEUzBQIEH4BysALSY1THi37ftw3P0\"\n}\n\n</code></pre>\n<p>* Use the token to access protected routes by sending the token as <code>auth-token</code> header</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-bash\">curl -i -H \"auth-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MmZlN2JiYjg0ZjRiMGQ0MmE3ZmU4ODgiLCJpYXQiOjE2NjI3OTMyMjJ9.CQ3LLlaej7jDynZEUzBQIEH4BysALSY1THi37ftw3P0\" -H \"Content-Type: application/json\" http:///api/camps/\n\n</code></pre>\n<h1 id=\"error-codes\">Error Codes</h1>\n<p>Incase of an error, the server will respond with status codes <strong>400, 401, 404</strong> or <strong>500</strong> and a JSON object containing an error string</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Status code</strong></th>\n<th><strong>Message</strong></th>\n<th><strong>Description</strong></th>\n<th><strong>Mitigation</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>400</td>\n<td>\"\\ username is required\"</td>\n<td><strong>Bad request -</strong> Caused by sending an invalid request</td>\n<td>Check if you have all request body requirements.</td>\n</tr>\n<tr>\n<td>401</td>\n<td>\"Access denied\"</td>\n<td><strong>Unauthorized -</strong> Caused by trying to access an unauthorized route</td>\n<td>Make sure your request has <strong>auth-token</strong> header.</td>\n</tr>\n<tr>\n<td>404</td>\n<td>\"An error occurred. Try again later.\"</td>\n<td><strong>Not found -</strong> Caused when a request was unsuccessful or when a requested item can not be found</td>\n<td>Confirm that you're sending the right request.</td>\n</tr>\n<tr>\n<td>500</td>\n<td></td>\n<td><strong>Internal server error -</strong> Caused when an error occurs on the server</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n</div><h1 id=\"rate-limit\">Rate limit</h1>\n<p>Knock yourself out!</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"Introduction","slug":"introduction"},{"content":"Overview","slug":"overview"},{"content":"Authentication","slug":"authentication"},{"content":"Error Codes","slug":"error-codes"},{"content":"Rate limit","slug":"rate-limit"}],"owner":"14220861","collectionId":"74106811-eeb1-43f6-a37a-e5f52222e8f4","publishedId":"VVdc8TDA","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2022-09-10T08:03:29.000Z"},"item":[{"name":"auth","item":[{"name":"register","id":"3619e109-efbf-48df-8202-dc4fcb9fd997","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\": \"Ellena\",\r\n    \"password\": \"$E11en12B4#\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://yelpcamp-backend-production.up.railway.app/api/auth/register","urlObject":{"protocol":"https","path":["api","auth","register"],"host":["yelpcamp-backend-production","up","railway","app"],"query":[],"variable":[]}},"response":[],"_postman_id":"3619e109-efbf-48df-8202-dc4fcb9fd997"},{"name":"login","id":"2a0faf6e-3034-44cb-b211-db194b45b794","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"username\": \"Ellena\",\r\n    \"password\": \"$E11en12B4#\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://yelpcamp-backend-production.up.railway.app/api/auth/login","urlObject":{"protocol":"https","path":["api","auth","login"],"host":["yelpcamp-backend-production","up","railway","app"],"query":[],"variable":[]}},"response":[],"_postman_id":"2a0faf6e-3034-44cb-b211-db194b45b794"}],"id":"85be0e3d-54f1-40bf-99db-fe1c8a12125e","_postman_id":"85be0e3d-54f1-40bf-99db-fe1c8a12125e","description":""},{"name":"camps","item":[{"name":"all camps","id":"7b4dc2e4-a83e-40fd-bc09-63b2dbca2d12","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"https://yelpcamp-backend-production.up.railway.app/api/camps/","urlObject":{"protocol":"https","path":["api","camps",""],"host":["yelpcamp-backend-production","up","railway","app"],"query":[],"variable":[]}},"response":[],"_postman_id":"7b4dc2e4-a83e-40fd-bc09-63b2dbca2d12"},{"name":"new camp","id":"96006e33-5b09-4c0f-bca9-3f798b385b6e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"auth-token","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MzI0NTEwOTIwYjU3ZDFhYmUwZDQ1N2UiLCJpYXQiOjE2NjMzMzI3Mzd9.WcFpCtFNiJl-BYqf2S14_lHb9cZ0zV-_ruXVhicw1EI","type":"text"}],"body":{"mode":"formdata","formdata":[{"key":"name","type":"text","value":"Nazlands grounds"},{"key":"price","value":"12000","type":"text"},{"key":"image","type":"file","src":"/C:/Users/Who Me/Downloads/cca.jpg"},{"key":"description","value":"Nazlands is one of the best places during easter","type":"text"}]},"url":"https://yelpcamp-backend-production.up.railway.app/api/camps/new","urlObject":{"protocol":"https","path":["api","camps","new"],"host":["yelpcamp-backend-production","up","railway","app"],"query":[],"variable":[]}},"response":[],"_postman_id":"96006e33-5b09-4c0f-bca9-3f798b385b6e"},{"name":"single camp","id":"cdd28d52-f389-43ea-bd14-3e6fa2b02746","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"auth-token","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MzI0NTEwOTIwYjU3ZDFhYmUwZDQ1N2UiLCJpYXQiOjE2NjMzMzI3Mzd9.WcFpCtFNiJl-BYqf2S14_lHb9cZ0zV-_ruXVhicw1EI","type":"text"}],"url":"https://yelpcamp-backend-production.up.railway.app/api/camps/632470f0a14d9656f42c17ef","urlObject":{"protocol":"https","path":["api","camps","632470f0a14d9656f42c17ef"],"host":["yelpcamp-backend-production","up","railway","app"],"query":[],"variable":[]}},"response":[],"_postman_id":"cdd28d52-f389-43ea-bd14-3e6fa2b02746"},{"name":"update camp","id":"81878967-7197-4960-96ab-acceb2a6b81b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"auth-token","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MzI0NTcxZTA0OTliZGU0ZDJjOWNlN2MiLCJpYXQiOjE2NjMzMjY1NjJ9.wHVLCozbFCnE6dC1QmK3yupRFrGVhMshqMTkAeSbEFk","type":"text"}],"body":{"mode":"formdata","formdata":[{"key":"name","type":"text","value":"Middlelands [updated](03)"},{"key":"price","value":"50000","type":"text"},{"key":"image","type":"file","src":"/C:/Users/Who Me/Downloads/cca.jpg"},{"key":"description","value":"This is the new updated description for MIDDLE LAND","type":"text"}]},"url":"https://yelpcamp-backend-production.up.railway.app/api/camps/632459750499bde4d2c9ce86","urlObject":{"protocol":"https","path":["api","camps","632459750499bde4d2c9ce86"],"host":["yelpcamp-backend-production","up","railway","app"],"query":[],"variable":[]}},"response":[],"_postman_id":"81878967-7197-4960-96ab-acceb2a6b81b"},{"name":"search camps","id":"2f19b156-e8e8-43db-bc73-3e5abc872b57","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"body":{"mode":"raw","raw":"{\r\n    \"query\": \"Dig\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://yelpcamp-backend-production.up.railway.app/api/camps/search","urlObject":{"protocol":"https","path":["api","camps","search"],"host":["yelpcamp-backend-production","up","railway","app"],"query":[],"variable":[]}},"response":[],"_postman_id":"2f19b156-e8e8-43db-bc73-3e5abc872b57"}],"id":"6e051237-ba76-42a7-a8f2-f02ae52c8225","_postman_id":"6e051237-ba76-42a7-a8f2-f02ae52c8225","description":""},{"name":"comments","item":[{"name":"new comment","id":"47b33185-ccea-4c84-bddb-6fedc532d7e7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"auth-token","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MzI0NTcxZTA0OTliZGU0ZDJjOWNlN2MiLCJpYXQiOjE2NjMzMzQ2NTd9.E-Qmju57eQtbHhIuPL3F4O2Tx6g2zxUR31Ez_8si8bM","type":"text"}],"body":{"mode":"raw","raw":"{\r\n    \"comment\": \"Ngoja twende kuchachisha uko\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://yelpcamp-backend-production.up.railway.app/api/comments/new/632471bea14d9656f42c17f3","urlObject":{"protocol":"https","path":["api","comments","new","632471bea14d9656f42c17f3"],"host":["yelpcamp-backend-production","up","railway","app"],"query":[],"variable":[]}},"response":[],"_postman_id":"47b33185-ccea-4c84-bddb-6fedc532d7e7"},{"name":"campground comments","id":"037ae91f-866f-49b7-87d4-c1be67bceb81","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"auth-token","value":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MzI0NTcxZTA0OTliZGU0ZDJjOWNlN2MiLCJpYXQiOjE2NjMzMzQ2NTd9.E-Qmju57eQtbHhIuPL3F4O2Tx6g2zxUR31Ez_8si8bM","type":"text"}],"url":"https://yelpcamp-backend-production.up.railway.app/api/comments/632470f0a14d9656f42c17ef","urlObject":{"protocol":"https","path":["api","comments","632470f0a14d9656f42c17ef"],"host":["yelpcamp-backend-production","up","railway","app"],"query":[],"variable":[]}},"response":[],"_postman_id":"037ae91f-866f-49b7-87d4-c1be67bceb81"}],"id":"5fb57417-a6e2-40bd-8879-d151a7cba39a","_postman_id":"5fb57417-a6e2-40bd-8879-d151a7cba39a","description":""}]}