{"swagger":"2.0","info":{"description":"This is the protocol that will be used by Group B in the CS3099 federated social media project. Here is a link to the document describing how digital signatures work. https://datatracker.ietf.org/doc/draft-ietf-httpbis-message-signatures/?include_text=1","version":"1.0.0","title":"3099 Group B Protocol","license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"tags":[{"name":"Users","description":"Requests relating to the Users"},{"name":"Forums","description":"Requests relating to the Forums"},{"name":"Subforums","description":"Requests relating to the Subforums"},{"name":"Posts","description":"Requests relating to the Posts"},{"name":"Comments","description":"Requests relating to the Comments"},{"name":"Public Key","description":"Requests relating to the Public Key"}],"paths":{"/api/users/{id}":{"get":{"tags":["Users"],"summary":"Gets individual user","description":"This request obtains an individual user based on the user id. It will return a single user json object\n","produces":["application/json"],"parameters":[{"name":"id","in":"path","description":"ID of user to return","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"User Exists and the Json object has been retrived successfully.","schema":{"$ref":"#/definitions/IndividualUser"}},"403":{"description":"Forbidden. If permissions not allowed."},"404":{"description":"User not found."}}}},"/api/users":{"get":{"tags":["Users"],"summary":"Gets list of users","description":"This request obtains the list of all users. It will return a json object that contains an array of individual user objects\n","produces":["application/json"],"responses":{"200":{"description":"The list of users has been retrieved successfully","schema":{"$ref":"#/definitions/Users"}},"403":{"description":"Forbidden. If permissions not allowed."}}}},"/api/forums/{id}":{"get":{"tags":["Forums"],"summary":"Gets individual forum","description":"This request obtains an individual forum based on the forum id. It will return a single forum json object\n","produces":["application/json"],"parameters":[{"name":"id","in":"path","description":"ID of forum to return","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"Forum Exists and the Json object has been retrived successfully.","schema":{"$ref":"#/definitions/IndividualForum"}},"403":{"description":"Forbidden. If permissions not allowed."},"404":{"description":"User not found."}}}},"/api/forums":{"get":{"tags":["Forums"],"summary":"Gets list of forums","description":"This request obtains the list of all forums. It will return a json object that contains an array of individual forum objects\n","produces":["application/json"],"responses":{"200":{"description":"The list of forums has been retrieved successfully","schema":{"$ref":"#/definitions/Forums"}},"403":{"description":"Forbidden. If permissions not allowed."}}}},"/api/subforums/{id}":{"get":{"tags":["Subforums"],"summary":"Gets individual subforum","description":"This request obtains an individual subforum based on the subforum id. It will return a single subforum json object\n","produces":["application/json"],"parameters":[{"name":"id","in":"path","description":"ID of subforum to return","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"Subforum Exists and the Json object has been retrived successfully.","schema":{"$ref":"#/definitions/IndividualSubforum"}},"403":{"description":"Forbidden. If permissions not allowed."},"404":{"description":"User not found."}}}},"/api/forums/{id}/subforums":{"get":{"tags":["Subforums"],"summary":"Gets list of subforums","description":"This request obtains the list of all subforums for a given form. It will return a json object that contains an array of individual subforum objects\n","parameters":[{"name":"id","in":"path","description":"ID of forum for which all subforums are to be obtained","required":true,"type":"integer","format":"int64"}],"produces":["application/json"],"responses":{"200":{"description":"The list of subforums has been retrieved successfully","schema":{"$ref":"#/definitions/Subforums"}},"403":{"description":"Forbidden. If permissions not allowed."}}}},"/api/posts/{id}":{"get":{"tags":["Posts"],"summary":"Gets an Individual Post","description":"This request obtains an individual post based on the post id. It will return a single post json object\n","parameters":[{"name":"id","in":"path","description":"ID of post to be obtained","required":true,"type":"integer","format":"int64"}],"produces":["application/json"],"responses":{"200":{"description":"The list of posts has been retrieved successfully","schema":{"$ref":"#/definitions/IndividualPost"}},"403":{"description":"Forbidden. If permissions not allowed."},"404":{"description":"Post not found."}}}},"/api/subforums/{id}/posts":{"get":{"tags":["Posts"],"summary":"Gets list of posts","description":"This request obtains the list of all posts for a given subform. It will return a json object that contains an array of individual post objects\n","parameters":[{"name":"id","in":"path","description":"ID of subforum for which all posts are to be obtained","required":true,"type":"integer","format":"int64"}],"produces":["application/json"],"responses":{"200":{"description":"The list of posts has been retrieved successfully","schema":{"$ref":"#/definitions/Posts"}},"403":{"description":"Forbidden. If permissions not allowed."}}},"post":{"tags":["Posts"],"summary":"Creates a new Post","description":"This request sends an individual post. It is used to create a new post. The json object will be sent in the request body of the http request.\n","parameters":[{"name":"id","in":"path","description":"ID of subforum for which all posts are to be obtained","required":true,"type":"integer","format":"int64"},{"name":"post","in":"body","description":"The required information for the post in a json format","required":true,"schema":{"$ref":"#/definitions/PostRequestBody"}}],"consumes":["application/json"],"produces":["application/json"],"responses":{"200":{"description":"The post has been sent successfully and a json object of the sent post is returned","schema":{"$ref":"#/definitions/IndividualPost"}},"403":{"description":"Forbidden. If permissions not allowed."}}}},"/api/comments/{id}":{"get":{"tags":["Comments"],"summary":"Gets an Individual Comment","description":"This request obtains an individual comment based on the comment id. It will return a single comment json object\n","parameters":[{"name":"id","in":"path","description":"ID of comment to be obtained","required":true,"type":"integer","format":"int64"}],"produces":["application/json"],"responses":{"200":{"description":"The list of comments has been retrieved successfully","schema":{"$ref":"#/definitions/IndividualComment"}},"403":{"description":"Forbidden. If permissions not allowed."},"404":{"description":"Comment not found."}}}},"/api/posts/{id}/comments":{"get":{"tags":["Comments"],"summary":"Gets list of parent comments of a post","description":"This request obtains the list of all parent comments for a given post. It will return a json object that contains an array of individual comment objects. To obtain children comments of the returned comments, a seperate get request is required.\n","parameters":[{"name":"id","in":"path","description":"ID of post for which all comments are to be obtained","required":true,"type":"integer","format":"int64"}],"produces":["application/json"],"responses":{"200":{"description":"The list of comments has been retrieved successfully","schema":{"$ref":"#/definitions/Comments"}},"403":{"description":"Forbidden. If permissions not allowed."},"404":{"description":"Post not found."}}},"post":{"tags":["Comments"],"summary":"Creates a new comment","description":"This request sends an individual comment. It is used to create a new comment. The json object will be sent in the request body of the http request. It is worth noting that this request is for creating a top level parent comment and not a child comment.\n","parameters":[{"name":"id","in":"path","description":"ID of post for the comment to be added to","required":true,"type":"integer","format":"int64"},{"name":"comment","in":"body","description":"The required information for the comment in a json format","required":true,"schema":{"$ref":"#/definitions/CommentRequestBody"}}],"consumes":["application/json"],"produces":["application/json"],"responses":{"200":{"description":"The comment has been sent successfully and an indivdual comment json object will be returned","schema":{"$ref":"#/definitions/IndividualComment"}},"403":{"description":"Forbidden. If permissions not allowed."},"404":{"description":"Post not found."}}}},"/api/key":{"get":{"tags":["Public Key"],"summary":"Gets the public key for a server","description":"This requests obtains the public key for the server.\n","responses":{"200":{"description":"The key has been obtained","schema":{"$ref":"#/definitions/PublicKeyRequestBody"}}}}}},"definitions":{"IndividualUser":{"type":"object","required":["id","username","_links"],"properties":{"id":{"type":"integer","format":"int64","example":1},"username":{"type":"string","example":"SamwiseGamgee123"},"_links":{"type":"object","required":["self","users"],"properties":{"self":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/users/1"}}},"users":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/users"}}}}}}},"Users":{"type":"object","required":["_embedded","_links"],"properties":{"_embedded":{"type":"object","required":["userList"],"properties":{"userList":{"type":"array","items":{"$ref":"#/definitions/IndividualUser"}}}},"_links":{"type":"object","required":["self"],"properties":{"self":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/users"}}}}}}},"IndividualForum":{"type":"object","required":["id","forumName","_links"],"properties":{"id":{"type":"integer","format":"int64","example":1},"forumName":{"type":"string","example":"Computer Science"},"_links":{"type":"object","required":["self","forums","subforums"],"properties":{"self":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/forums/1"}}},"forums":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/forums"}}},"subforums":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/forums/1/subforums"}}}}}}},"Forums":{"type":"object","required":["_embedded","_links"],"properties":{"_embedded":{"type":"object","required":["forumList"],"properties":{"forumList":{"type":"array","items":{"$ref":"#/definitions/IndividualForum"}}}},"_links":{"type":"object","required":["self"],"properties":{"self":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/forums"}}}}}}},"IndividualSubforum":{"type":"object","required":["id","subforumName","forumId","_links"],"properties":{"id":{"type":"integer","format":"int64","example":1},"subforumName":{"type":"string","example":"CS3050"},"forumId":{"type":"integer","format":"int64","example":1},"_links":{"type":"object","required":["self","forum","posts"],"properties":{"self":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/subforums/1"}}},"forum":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/forums/1"}}},"posts":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/subforums/1/posts"}}}}}}},"Subforums":{"type":"object","required":["_embedded","_links"],"properties":{"_embedded":{"type":"object","required":["subforumList"],"properties":{"subforumList":{"type":"array","items":{"$ref":"#/definitions/IndividualSubforum"}}}},"_links":{"type":"object","required":["self"],"properties":{"self":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/forums/1/subforums"}}}}}}},"IndividualPost":{"type":"object","required":["id","postTitle","postContents","userId","subforumId","_links"],"properties":{"id":{"type":"integer","format":"int64","example":1},"postTitle":{"type":"string","example":"This is a post"},"postContents":{"type":"string","example":"Markdown goes here"},"userId":{"type":"integer","format":"int64","example":1},"subforumId":{"type":"integer","format":"int64","example":1},"_links":{"type":"object","required":["self","subforum","forum","user","comments"],"properties":{"self":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/posts/1"}}},"subforum":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/subforums/1"}}},"forum":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/forums/1"}}},"user":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/users/1"}}},"comments":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/posts/1/comments"}}}}}}},"Posts":{"type":"object","required":["_embedded","_links"],"properties":{"_embedded":{"type":"object","required":["postList"],"properties":{"postList":{"type":"array","items":{"$ref":"#/definitions/IndividualPost"}}}},"_links":{"type":"object","required":["self"],"properties":{"self":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/subforums/1/posts"}}}}}}},"PostRequestBody":{"type":"object","required":["postTitle","postContents","userId"],"properties":{"postTitle":{"type":"string","example":"This is a title"},"postContents":{"type":"string","example":"Markdown goes here"},"userId":{"type":"integer","format":"int64","example":1}}},"IndividualComment":{"type":"object","required":["id","commentContent","userId","postId","_links"],"properties":{"id":{"type":"integer","format":"int64","example":1},"commentContent":{"type":"string","example":"This is a comment"},"userId":{"type":"integer","format":"int64","example":1},"postId":{"type":"integer","format":"int64","example":1},"_links":{"type":"object","required":["self","subforum","forum","user","comments"],"properties":{"self":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/posts/1"}}},"post":{"type":"object","properties":{"href":{"type":"string","format":"url","example":"<url>/api/posts/1"}}},"parentComment":{"type":"object","properties":{"href":{"type":"string","format":"url","example":"<url>/api/comments/1"}}},"subforum":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/subforums/1"}}},"forum":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/forums/1"}}},"user":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/users/1"}}},"comments":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/comments/1/comments"}}}}}}},"Comments":{"type":"object","required":["_embedded","_links"],"properties":{"_embedded":{"type":"object","required":["commentList"],"properties":{"commentList":{"type":"array","items":{"$ref":"#/definitions/IndividualComment"}}}},"_links":{"type":"object","required":["self"],"properties":{"self":{"type":"object","required":["href"],"properties":{"href":{"type":"string","format":"url","example":"<url>/api/posts/1/comments"}}}}}}},"CommentRequestBody":{"type":"object","required":["commentContent","userId","username"],"properties":{"commentContent":{"type":"string","example":"This is a comment"},"userId":{"type":"integer","format":"int64","example":1},"username":{"type":"string","example":"SamwiseGamgee123"}}},"PublicKeyRequestBody":{"type":"object","required":["key"],"properties":{"key":{"type":"string","example":"AAAAB3NzaC1yc2EAAAABJQAAAQB/nAmOjTmezNUDKYvEeIRf2YnwM9/uUG1d0BYsc8/tRtx+RGi7N2lUbp728MXGwdnL9od4cItzky/zVdLZE2cycOa18xBK9cOWmcKS0A8FYBxEQWJ/q9YVUgZbFKfYGaGQxsER+A0w/fX8ALuk78ktP31K69LcQgxIsl7rNzxsoOQKJ/CIxOGMMxczYTiEoLvQhapFQMs3FL96didKr/QbrfB1WT6s3838SEaXfgZvLef1YB2xmfhbT9OXFE3FXvh2UPBfN+ffE7iiayQf/2XR+8j4N4bW30DiPtOQLGUrH1y5X/rpNZNlWW2+jGIxqZtgWg7lTy3mXy5x836Sj/6L"}}}},"schemes":["http"]}