API Specification
Contributors: Alicia Wang, Conner Swenberg
Values wrapped in < >
are placeholders for what the field values should be. Also be sure to read the request route carefully when you implement it - typos WILL cause test cases to fail!
NOTE ABOUT ERROR RESPONSES
The server should return an error response for:
POST
requests, if the user does not supply one of the fields in the body (e.g. title, link, username, text, etc.) with a status code of 400 (bad request)Any request if the id in the URL does not exist, with a status code of 404 (not found)
For each of the following routes, we will specify a success response that you must implement, but make sure to also implement error responses accordingly!
Expected Functionality
Get all posts
GET
/api/posts/
Create a post
POST
/api/posts/
Get a specific post
GET
/api/posts/{id}/
Delete a specific post
DELETE
/api/posts/{id}/
Get comments for a specific post
GET
/api/posts/{id}/comments/
Post a comment for a specific post
POST
/api/posts/{id}/comments/
Note: comments should have globally unique IDs! That is, if a comment on one post has ID 5, no other comments, even on other posts should have an ID of 5!
Edit a comment for a specific post
POST
/api/posts/{pid}/comments/{cid}/
Last updated