{"swagger":"2.0","info":{"description":"This is API documentary for web application 4Room","version":"1.0.0","title":"4Room API","termsOfService":"http://swagger.io/terms/","contact":{"email":"apiteam@swagger.io"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"tags":[{"name":"Authentication","description":""},{"name":"User","description":""},{"name":"Post","description":""},{"name":"Upvote","description":""},{"name":"Follow","description":""},{"name":"Comment","description":""},{"name":"Notification","description":""}],"consumes":["multipart/form-data"],"securityDefinitions":{"bearerAuth":{"type":"apiKey","name":"Authorization","in":"header"}},"paths":{"/register":{"post":{"tags":["Authentication"],"summary":"Register a new account","description":"","consumes":["application/json"],"parameters":[{"in":"body","name":"body","required":true,"description":"The user's profile to create.","schema":{"type":"object","required":["email","password","password_confirmation","name_in_forum"],"properties":{"email":{"type":"string"},"password":{"type":"string"},"password_confirmation":{"type":"string"},"name_in_forum":{"type":"string"},"bio":{"type":"string","format":"text"},"facebook_link":{"type":"string"},"linkedin_link":{"type":"string"},"instagram_link":{"type":"string"},"twitter_link":{"type":"string"}}}}],"produces":["application/json"],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/User"}},"400":{"description":"Password does not match confirmed password / Invalid email or password"}}}},"/login":{"post":{"tags":["Authentication"],"summary":"Log in 4Room","description":"","produces":["application/json"],"responses":{"200":{"description":"success / Invalid email or password","schema":{"$ref":"#/definitions/User"}},"400":{"description":"Login credentials are invalid"},"500":{"description":"Could not create token"}}}},"/logout":{"get":{"tags":["Authentication"],"summary":"Log out 4Room","description":"","produces":["application/json"],"responses":{"200":{"description":"success"}},"security":[{"bearerAuth":[]}]}},"/reset-password":{"post":{"tags":["Authentication"],"summary":"Reset password","description":"","produces":["application/json"],"responses":{"200":{"description":"success"},"422":{"description":"This password reset token is invalid"}}}},"/change-password":{"post":{"tags":["Authentication"],"summary":"Change password","description":"","produces":["application/json"],"responses":{"200":{"description":"success"}}}},"/users":{"get":{"tags":["User"],"summary":"Get all users","description":"Display a listing of the resource.","produces":["application/json"],"responses":{"200":{"description":"success"}}}},"/users/{id}":{"get":{"tags":["User"],"summary":"Get user by ID","description":"Display the specified user's profile.","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/User"}},"400":{"description":"User does not exist in database."}},"security":[{"bearerAuth":[]}]}},"/profile":{"post":{"tags":["User"],"summary":"Update profile of an user","description":"Update user's profile.","produces":["application/json"],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/User"}},"400":{"description":"Could not update profile"}},"security":[{"bearerAuth":[]}]}},"/users/search":{"get":{"tags":["User"],"summary":"Search an user by name in forum","description":"Search 10 users with similar name.","produces":["application/json"],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/User"}}},"security":[{"bearerAuth":[]}]}},"/posts/create":{"post":{"tags":["Post"],"summary":"Create a post","description":"Store a newly created post in database.","produces":["application/json"],"parameters":[{"name":"content","in":"query","required":true,"type":"string","format":"text"},{"name":"file","in":"formData","required":false,"type":"file"}],"responses":{"200":{"description":"Created new post."},"400":{"description":"Could not create new post."}},"security":[{"bearerAuth":[]}]}},"/posts/{id}":{"get":{"tags":["Post"],"summary":"Get all information about the post with id","description":"Display the specified post by id.","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/Post"}},"400":{"description":"Post does not exist in database."}},"security":[{"bearerAuth":[]}]}},"/posts/{id}/edit":{"post":{"tags":["Post"],"summary":"Edit post with id","description":"Update the specified post in database.","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"},{"name":"content","in":"query","required":true,"type":"string"}],"responses":{"200":{"description":"Updated post."},"400":{"description":"Post does not exist in database / User does not own post."}},"security":[{"bearerAuth":[]}]}},"/posts/{id}/delete":{"delete":{"tags":["Post"],"summary":"Delete post with id","description":"Remove the specified post from database.","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"Deleted post."},"400":{"description":"Post does not exist in database / User does not own post."}},"security":[{"bearerAuth":[]}]}},"/users/{id}/posts":{"get":{"tags":["Post"],"summary":"Get all post of user with id of user","description":"","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/Post"}},"400":{"description":"User does not exist in database."}},"security":[{"bearerAuth":[]}]}},"/download/files/{file_path}":{"get":{"tags":["Post"],"summary":"Download file from post","description":"","produces":["application/json"],"parameters":[{"name":"file_path","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"success"}},"security":[{"bearerAuth":[]}]}},"/newsfeed":{"get":{"tags":["Post"],"summary":"Get all newsfeed information","description":"Display a list posts in user's newsfeed","produces":["application/json"],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/Post"}}},"security":[{"bearerAuth":[]}]}},"/upvote-post/{id}":{"post":{"tags":["Upvote"],"summary":"Upvote a post with id","description":"Store a new upvote in database.","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"Upvoted post."},"400":{"description":"Post does not exist in database / User does not own post."}},"security":[{"bearerAuth":[]}]},"delete":{"tags":["Upvote"],"summary":"Delete upvote of a post with id","description":"Remove upvote from database.","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"Removed upvote"},"400":{"description":"User did not upvote post before."}},"security":[{"bearerAuth":[]}]}},"/posts/{id}/upvote":{"get":{"tags":["Upvote"],"summary":"Get users upvote post","description":"Display list users upvote post.","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/User"}},"400":{"description":"Post does not exist in database."}},"security":[{"bearerAuth":[]}]}},"/is-upvote/post/{id}":{"get":{"tags":["Upvote"],"summary":"Check if an user upvoted a post","description":"","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"success"}},"security":[{"bearerAuth":[]}]}},"/follow-user/{id}":{"post":{"tags":["Follow"],"summary":"Store a new follow in database","description":"","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"Followed"},"400":{"description":"Source user already follow Target user / Target user does not exist in database"}},"security":[{"bearerAuth":[]}]},"delete":{"tags":["Follow"],"summary":"Remove follow from database","description":"","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"Unfollow successful"},"400":{"description":"Target user does not exist in database / Source user did not follow Target user before"}},"security":[{"bearerAuth":[]}]}},"/users/{id}/following":{"get":{"tags":["Follow"],"summary":"Display a list followings of specified user","description":"","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/User"}},"400":{"description":"Target user does not exist in database"}},"security":[{"bearerAuth":[]}]}},"/users/{id}/followers":{"get":{"tags":["Follow"],"summary":"Display a list followers of specified user","description":"","produces":["application/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/User"}},"400":{"description":"Target user does not exist in database"}},"security":[{"bearerAuth":[]}]}},"/follow/suggestion":{"get":{"tags":["Follow"],"summary":"Display top 10 suggestion user","description":"","produces":["application/json"],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/User"}}},"security":[{"bearerAuth":[]}]}},"/posts/{post_id}/comments/create":{"post":{"tags":["Comment"],"summary":"Create a new comment","description":"","produces":["application/json"],"parameters":[{"name":"post_id","in":"path","required":true,"type":"integer","format":"int64"},{"name":"content","in":"query","required":true,"type":"string"}],"responses":{"200":{"description":"Created new comment","schema":{"$ref":"#/definitions/Comment"}},"400":{"description":"Could not create comment because this post does not exist"}},"security":[{"bearerAuth":[]}]}},"/posts/{post_id}/comments/{id}/update":{"post":{"tags":["Comment"],"summary":"Update an existing comment","description":"","produces":["application/json"],"parameters":[{"name":"post_id","in":"path","required":true,"type":"integer","format":"int64"},{"name":"id","in":"path","required":true,"type":"integer","format":"int64"},{"name":"content","in":"query","required":true,"type":"string"}],"responses":{"200":{"description":"Updated comment"},"400":{"description":"Comment does not exist in this post / You have not changed the comment yet"}},"security":[{"bearerAuth":[]}]}},"/posts/{post_id}/comments/{id}/delete":{"delete":{"tags":["Comment"],"summary":"Delete comment","description":"","produces":["application/json"],"parameters":[{"name":"post_id","in":"path","required":true,"type":"integer","format":"int64"},{"name":"id","in":"path","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"Deleted comment"},"400":{"description":"This post does not exist in database / Comment does not exist in this post"}},"security":[{"bearerAuth":[]}]}},"/notifications":{"get":{"tags":["Notification"],"summary":"Get all notifications of this user","description":"","produces":["application/json"],"responses":{"200":{"description":"success","schema":{"$ref":"#/definitions/Notification"}}},"security":[{"bearerAuth":[]}]}},"/notifications/count-unread":{"get":{"tags":["Notification"],"summary":"","description":"","produces":["application/json"],"responses":{"200":{"description":"success"}},"security":[{"bearerAuth":[]}]}},"/mark-as-read":{"get":{"tags":["Notification"],"summary":"","description":"","produces":["application/json"],"responses":{"200":{"description":"success"}},"security":[{"bearerAuth":[]}]}}},"definitions":{"User":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"email":{"type":"string"},"password":{"type":"string"},"name_in_forum":{"type":"string"},"bio":{"type":"string","format":"text"},"facebook_link":{"type":"string"},"linkedin_link":{"type":"string"},"instagram_link":{"type":"string"},"twitter_link":{"type":"string"},"role":{"type":"integer","default":1},"avatar_id":{"type":"integer","default":1},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Post":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"user_id":{"type":"integer","format":"int64"},"content":{"type":"string","format":"text"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Comment":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"content":{"type":"string","format":"text"},"user_id":{"type":"integer","format":"int64"},"post_id":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Follow":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"source_id":{"type":"integer","format":"int64"},"target_id":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"File":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"size":{"type":"number","format":"double"},"address":{"type":"string"},"post_id":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Upvote":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"user_id":{"type":"integer","format":"int64"},"post_id":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Notification":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"user_id":{"type":"integer","format":"int64"},"upvote_id":{"type":"integer","format":"int64"},"comment_id":{"type":"integer","format":"int64"},"follow_id":{"type":"integer","format":"int64"}}},"PasswordReset":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"email":{"type":"string"},"token":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ApiResponse":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"},"data":{"type":"object"}}}},"host":"virtserver.swaggerhub.com","basePath":"/anhducpn67/4Room/1.0.0","schemes":["https"]}