{"info":{"_postman_id":"170cf73c-776d-4e05-ac21-6f919291fda2","name":"Resources Apis","description":"<html><head></head><body><p><strong>Resource APIs Collection</strong></p>\n<p>This collection of APIs allows authenticated users to manage resources on the platform, including uploading, retrieving, linking, and deleting resources associated with blog posts.</p>\n<ol>\n<li><p><strong>Create Resource</strong></p>\n<ul>\n<li><p>Endpoint: POST /api/v1/resource</p>\n</li>\n<li><p>Description: Uploads a resource, such as an image file, to the platform and associates it with the user's account.</p>\n</li>\n<li><p>Request Body: Form-data containing the resource file and user ID.</p>\n</li>\n<li><p>Response: Returns details of the uploaded resource upon success.</p>\n</li>\n</ul>\n</li>\n<li><p><strong>Get Resources</strong></p>\n<ul>\n<li><p>Endpoint: GET /api/v1/resource/blog/:id/author/:authorId</p>\n</li>\n<li><p>Description: Retrieves resources associated with a specific blog post authored by a particular user.</p>\n</li>\n<li><p>Query Parameters: Blog post ID, author ID, and optional skip parameter for pagination.</p>\n</li>\n<li><p>Response: Returns the requested resources associated with the specified blog post.</p>\n</li>\n</ul>\n</li>\n<li><p><strong>Delete Resource</strong></p>\n<ul>\n<li><p>Endpoint: DELETE /api/v1/resource/:id</p>\n</li>\n<li><p>Description: Deletes a specific resource from the platform.</p>\n</li>\n<li><p>Path Parameter: Resource ID.</p>\n</li>\n<li><p>Response: Returns a success message upon successful deletion.</p>\n</li>\n</ul>\n</li>\n<li><p><strong>Linking Blog to Resources</strong></p>\n<ul>\n<li><p>Endpoint: POST /api/v1/resource/blog/:id</p>\n</li>\n<li><p>Description: Links resources to a specific blog post.</p>\n</li>\n<li><p>Path Parameter: Blog post ID.</p>\n</li>\n<li><p>Body: URL-encoded array of resource IDs to be linked.</p>\n</li>\n<li><p>Response: Returns a success message upon successful linking.</p>\n</li>\n</ul>\n</li>\n</ol>\n<p>These APIs provide functionalities to manage resources efficiently, ensuring proper authentication, authorization, and error handling throughout the process. Rate limiting is also applied to prevent abuse and ensure fair usage of the platform.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"31843425","collectionId":"170cf73c-776d-4e05-ac21-6f919291fda2","publishedId":"2sA2xk1BcF","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2024-03-13T13:00:25.000Z"},"item":[{"name":"Create Resource","id":"1e69303f-b160-42c0-8c23-e760b117fca6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"resource","type":"file","id":0,"fileUploadError":"","src":["C:\\Users\\Shubham Gupta\\Pictures\\Screenshots\\snake-game.png"]}]},"url":"{{server}}/resource","description":"<p><strong>Endpoint:</strong> POST /api/v1/resource<br /><strong>Description:</strong> This endpoint allows authenticated users to upload a resource, such as an image file, to the platform. The resource will be associated with the user's account.<br /><strong>Request Body:</strong></p>\n<ul>\n<li><p>Form-data:</p>\n<ul>\n<li>resource: The resource file to be uploaded. It should be provided as a file upload.</li>\n<li>id: The ID of the user who is uploading the resource.</li>\n</ul>\n</li>\n</ul>\n<p><strong>Response:</strong></p>\n<ul>\n<li><p>201 Created: Resource uploaded successfully. Returns the details of the uploaded resource, including its ID and URL.</p>\n</li>\n<li><p>400 Bad Request: If the required fields are missing or the request is invalid.</p>\n</li>\n<li><p>403 Forbidden: If the user is not authenticated or authorized to upload resources.</p>\n</li>\n<li><p>500 Internal Server Error: If an unexpected error occurs on the server.</p>\n</li>\n</ul>\n<p><strong>Notes:</strong></p>\n<ul>\n<li><p>Upon successful upload, the resource will be saved to Cloudinary and associated with the user's account.</p>\n</li>\n<li><p>Access control and authorization are enforced to ensure only authenticated users can upload resources.</p>\n</li>\n<li><p>Rate limiting is applied to prevent abuse and ensure fair usage of the platform.</p>\n</li>\n</ul>\n","urlObject":{"path":["resource"],"host":["{{server}}"],"query":[],"variable":[]}},"response":[{"id":"9af32d80-324d-4fcf-99ec-2950865f80fb","name":"Create Resource","originalRequest":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"resource","type":"file","id":0,"fileUploadError":"","src":["C:\\Users\\Shubham Gupta\\Pictures\\Screenshots\\snake-game.png"]}]},"url":"{{server}}/resource"},"status":"Created","code":201,"_postman_previewlanguage":"JSON","header":[{"key":"Server","value":"nginx","type":"text"},{"key":"Date","value":"Mon, 11 Mar 2024 13:11:59 GMT","type":"text"},{"key":"Content-Type","value":"application/json; charset=utf-8","type":"text"},{"key":"Content-Length","value":"281","type":"text"},{"key":"Connection","value":"keep-alive","type":"text"},{"key":"X-Powered-By","value":"Express","type":"text"},{"key":"Vary","value":"Origin","type":"text"},{"key":"Access-Control-Allow-Credentials","value":"true","type":"text"},{"key":"X-RateLimit-Limit","value":"20","type":"text"},{"key":"X-RateLimit-Remaining","value":"18","type":"text"},{"key":"X-RateLimit-Reset","value":"1710163554","type":"text"},{"key":"ETag","value":"W/\"119-h2y/FeYwtjCoIcQW9U+LncYsBJY\"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"File Uploaded successfully\",\n    \"data\": {\n        \"id\": \"65ef031f5b5510e9e92ddd42\",\n        \"resource_id\": \"blog/resource/demo123/nr9r0l2srhbmyoeevpup\",\n        \"resource_url\": \"https://res.cloudinary.com/dentjriek/image/upload/v1710162719/blog/resource/demo123/nr9r0l2srhbmyoeevpup.png\"\n    }\n}"},{"id":"c085f99e-cf2e-493f-a68b-159ca47e6fec","name":"Create Resource","originalRequest":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"resource","type":"file","id":0,"fileUploadError":"","src":["C:\\Users\\Shubham Gupta\\Pictures\\Screenshots\\snake-game.png"]}]},"url":"{{server}}/resource"},"status":"Created","code":201,"_postman_previewlanguage":"JSON","header":[{"key":"Server","value":"nginx","type":"text"},{"key":"Date","value":"Mon, 11 Mar 2024 13:11:59 GMT","type":"text"},{"key":"Content-Type","value":"application/json; charset=utf-8","type":"text"},{"key":"Content-Length","value":"281","type":"text"},{"key":"Connection","value":"keep-alive","type":"text"},{"key":"X-Powered-By","value":"Express","type":"text"},{"key":"Vary","value":"Origin","type":"text"},{"key":"Access-Control-Allow-Credentials","value":"true","type":"text"},{"key":"X-RateLimit-Limit","value":"20","type":"text"},{"key":"X-RateLimit-Remaining","value":"18","type":"text"},{"key":"X-RateLimit-Reset","value":"1710163554","type":"text"},{"key":"ETag","value":"W/\"119-h2y/FeYwtjCoIcQW9U+LncYsBJY\"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"File Uploaded successfully\",\n    \"data\": {\n        \"id\": \"65ef031f5b5510e9e92ddd42\",\n        \"resource_id\": \"blog/resource/demo123/nr9r0l2srhbmyoeevpup\",\n        \"resource_url\": \"https://res.cloudinary.com/dentjriek/image/upload/v1710162719/blog/resource/demo123/nr9r0l2srhbmyoeevpup.png\"\n    }\n}"}],"_postman_id":"1e69303f-b160-42c0-8c23-e760b117fca6"},{"name":"Get Resources","id":"2eb9a1dc-71b1-4731-86b9-c15316361c00","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"inherit","inherit":{"basicConfig":[]},"isInherited":false},"method":"GET","header":[],"url":"{{server}}/resource/blog/65e0b1e52caebb67117796cf/author/65d35d59d16f5c0562983f98?skip=0","description":"<p><strong>Endpoint:</strong> GET /api/v1/resource/blog/:id/author/:authorId<br /><strong>Description:</strong> This endpoint retrieves resources associated with a specific blog post authored by a particular user.<br /><strong>Request:</strong></p>\n<ul>\n<li>Query Parameters:<ul>\n<li>id: The ID of the blog post for which resources are requested.</li>\n<li>authorId: The ID of the author of the blog post.</li>\n<li>skip: Optional parameter to specify the number of resources to skip. Default value is 0.</li>\n</ul>\n</li>\n</ul>\n<p><strong>Response:</strong></p>\n<ul>\n<li>200 OK: Resources fetched successfully. Returns the requested resources associated with the specified blog post.</li>\n<li>400 Bad Request: If the required query parameters are missing or invalid.</li>\n<li>403 Forbidden: If the user is not authenticated or authorized to access the resources.</li>\n<li>404 Not Found: If no resources are found for the specified blog post and author.</li>\n</ul>\n<p><strong>Notes:</strong></p>\n<ul>\n<li>Access control is enforced to ensure only authorized users can access resources.</li>\n<li>Pagination is supported through the skip query parameter to retrieve resources in batches.</li>\n<li>Rate limiting is applied to prevent abuse and ensure fair usage of the platform.</li>\n</ul>\n","urlObject":{"path":["resource","blog","65e0b1e52caebb67117796cf","author","65d35d59d16f5c0562983f98"],"host":["{{server}}"],"query":[{"key":"skip","value":"0"}],"variable":[]}},"response":[{"id":"c0588d38-db27-4084-af61-4d4fc55b2614","name":"Get Resources","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{server}}/resource/blog/65ef07795b5510e9e92ddd60/author/65eef6745e3bb295cfe56319?skip=0","host":["{{server}}"],"path":["resource","blog","65ef07795b5510e9e92ddd60","author","65eef6745e3bb295cfe56319"],"query":[{"key":"skip","value":"0","sortOrder":0}]}},"status":"OK","code":200,"_postman_previewlanguage":"JSON","header":[{"key":"Server","value":"nginx","type":"text"},{"key":"Date","value":"Mon, 11 Mar 2024 13:41:07 GMT","type":"text"},{"key":"Content-Type","value":"application/json; charset=utf-8","type":"text"},{"key":"Content-Length","value":"471","type":"text"},{"key":"Connection","value":"keep-alive","type":"text"},{"key":"X-Powered-By","value":"Express","type":"text"},{"key":"Vary","value":"Origin","type":"text"},{"key":"Access-Control-Allow-Credentials","value":"true","type":"text"},{"key":"X-RateLimit-Limit","value":"15","type":"text"},{"key":"X-RateLimit-Remaining","value":"13","type":"text"},{"key":"X-RateLimit-Reset","value":"1710165335","type":"text"},{"key":"ETag","value":"W/\"1d7-p3cAqNJYNzYYzkJp5MmO0bka03Q\"","type":"text"},{"key":"X-Cache","value":"MISS","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Resources fetched successfully\",\n    \"areMore\": false,\n    \"data\": [\n        {\n            \"resource\": {\n                \"resource_id\": \"blog/resource/demo123/nr9r0l2srhbmyoeevpup\",\n                \"resource_url\": \"https://res.cloudinary.com/dentjriek/image/upload/v1710162719/blog/resource/demo123/nr9r0l2srhbmyoeevpup.png\"\n            },\n            \"_id\": \"65ef031f5b5510e9e92ddd42\",\n            \"user\": \"65eef6745e3bb295cfe56319\",\n            \"createdAt\": \"2024-03-11T13:11:59.813Z\",\n            \"updatedAt\": \"2024-03-11T13:39:42.192Z\",\n            \"__v\": 0,\n            \"blog\": \"65ef07795b5510e9e92ddd60\"\n        }\n    ]\n}"}],"_postman_id":"2eb9a1dc-71b1-4731-86b9-c15316361c00"},{"name":"Delete Resource","id":"2929eaa1-d215-40ea-93b4-e227d6a115b0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"inherit","inherit":{"basicConfig":[]},"isInherited":false},"method":"DELETE","header":[],"url":"{{server}}/resource/65e1d906637fc5a70910956f","description":"<p><strong>Endpoint:</strong> DELETE /api/v1/resource/:id<br /><strong>Description:</strong> This endpoint allows authenticated users to delete a specific resource from the platform.<br /><strong>Request:</strong></p>\n<ul>\n<li><p>Path Parameter:</p>\n<ul>\n<li>id: The ID of the resource to be deleted.</li>\n</ul>\n</li>\n</ul>\n<p><strong>Response:</strong></p>\n<ul>\n<li>200 OK: Resource deleted successfully. Returns a success message indicating the deletion was successful.</li>\n<li>400 Bad Request: If the required resource ID is missing or invalid.</li>\n<li>403 Forbidden: If the user is not authenticated or authorized to delete the resource.</li>\n<li>404 Not Found: If the specified resource does not exist.</li>\n</ul>\n<p><strong>Notes:</strong></p>\n<ul>\n<li>Access control and authorization are enforced to ensure only authorized users can delete resources.</li>\n<li>Upon deletion, the resource will be removed from Cloudinary and the database.</li>\n<li>Rate limiting is applied to prevent abuse and ensure fair usage of the platform.</li>\n</ul>\n","urlObject":{"path":["resource","65e1d906637fc5a70910956f"],"host":["{{server}}"],"query":[],"variable":[]}},"response":[{"id":"f3b38de7-be78-40d7-8c73-d49a1e0bd044","name":"Delete Resource","originalRequest":{"method":"DELETE","header":[],"url":"{{server}}/resource/65ef02e05b5510e9e92ddd3f"},"status":"OK","code":200,"_postman_previewlanguage":"JSON","header":[{"key":"Server","value":"nginx","type":"text"},{"key":"Date","value":"Mon, 11 Mar 2024 13:13:52 GMT","type":"text"},{"key":"Content-Type","value":"application/json; charset=utf-8","type":"text"},{"key":"Content-Length","value":"54","type":"text"},{"key":"Connection","value":"keep-alive","type":"text"},{"key":"X-Powered-By","value":"Express","type":"text"},{"key":"Vary","value":"Origin","type":"text"},{"key":"Access-Control-Allow-Credentials","value":"true","type":"text"},{"key":"X-RateLimit-Limit","value":"30","type":"text"},{"key":"X-RateLimit-Remaining","value":"29","type":"text"},{"key":"X-RateLimit-Reset","value":"1710163732","type":"text"},{"key":"ETag","value":"W/\"36-gGE0tZT1nG4zsvc2MkxcSGl56QA\"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"File deleted successfully\"\n}"}],"_postman_id":"2929eaa1-d215-40ea-93b4-e227d6a115b0"},{"name":"Linking Blog to resources","id":"58c44ab2-44f6-4b07-b506-0a89aa225bc8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"inherit","inherit":{"basicConfig":[]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"urlencoded","urlencoded":[{"key":"resources","value":"[\"65edaa60f8f0436a024334ac\", \"65edaa67f8f0436a024334af\"]","type":"text","id":1}]},"url":"{{server}}/resource/blog/65e0b1ed2caebb67117796d4","description":"<p><strong>Endpoint:</strong> POST /api/v1/resource/blog/:id<br /><strong>Description:</strong> This endpoint allows authenticated users to link resources to a specific blog post.<br /><strong>Request:</strong></p>\n<ul>\n<li><p>Path Parameter:</p>\n<ul>\n<li>id: The ID of the blog post to which resources are to be linked.</li>\n</ul>\n</li>\n<li><p>Body:</p>\n<ul>\n<li><p>URL-encoded:</p>\n<ul>\n<li>resources: An array of resource IDs to be linked to the blog post.</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<p><strong>Response:</strong></p>\n<ul>\n<li><p>200 OK: Resources linked to the blog post successfully. Returns a success message indicating the linking was successful.</p>\n</li>\n<li><p>400 Bad Request: If the required parameters are missing or invalid, or if the resource IDs are not provided in the correct format.</p>\n</li>\n<li><p>403 Forbidden: If the user is not authenticated or authorized to link resources to the blog post.</p>\n</li>\n<li><p>404 Not Found: If the specified blog post does not exist, or if any of the provided resource IDs are invalid.</p>\n</li>\n</ul>\n<p><strong>Notes:</strong></p>\n<ul>\n<li><p>Access control and authorization are enforced to ensure only authorized users can link resources to blog posts.</p>\n</li>\n<li><p>The provided resource IDs must exist and be associated with the authenticated user.</p>\n</li>\n<li><p>Rate limiting is applied to prevent abuse and ensure fair usage of the platform.</p>\n</li>\n</ul>\n","urlObject":{"path":["resource","blog","65e0b1ed2caebb67117796d4"],"host":["{{server}}"],"query":[],"variable":[]}},"response":[{"id":"6d38e020-4e4f-417a-ab9c-aeb70fcd327e","name":"Linking Blog to resources","originalRequest":{"method":"POST","header":[],"body":{"mode":"urlencoded","urlencoded":[{"key":"resources","value":"[\"65ef031f5b5510e9e92ddd42\"]","type":"text","id":0}]},"url":"{{server}}/resource/blog/65ef07795b5510e9e92ddd60"},"status":"OK","code":200,"_postman_previewlanguage":"JSON","header":[{"key":"Server","value":"nginx","type":"text"},{"key":"Date","value":"Mon, 11 Mar 2024 13:39:42 GMT","type":"text"},{"key":"Content-Type","value":"application/json; charset=utf-8","type":"text"},{"key":"Content-Length","value":"72","type":"text"},{"key":"Connection","value":"keep-alive","type":"text"},{"key":"X-Powered-By","value":"Express","type":"text"},{"key":"Vary","value":"Origin","type":"text"},{"key":"Access-Control-Allow-Credentials","value":"true","type":"text"},{"key":"X-RateLimit-Limit","value":"8","type":"text"},{"key":"X-RateLimit-Remaining","value":"7","type":"text"},{"key":"X-RateLimit-Reset","value":"1710164683","type":"text"},{"key":"ETag","value":"W/\"48-8hGNxGKbftol2qfUfSh9zfoLeas\"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Resources added to blog posts successfully.\"\n}"}],"_postman_id":"58c44ab2-44f6-4b07-b506-0a89aa225bc8"}]}