{"endpoints":{"GET /api":{"description":"Serves up a JSON representation of all available endpoints of the API."},"GET /api/topics":{"description":"Returns an array of all topics.","exampleResponse":{"topics":[{"slug":"football","description":"Footie!"}]}},"POST /api/topics":{"description":"Creates a new topic","request_body":{"slug":"string (required)","description":"string (required)"},"exampleResponse":{"topics":[{"slug":"programming","description":"computers and stuff?"}]}},"GET /api/articles":{"description":"Returns an array of articles with optional sorting, filtering, and pagination.","queries":["sort_by (string) Column to sort by (e.g., 'author', 'title', 'created_at', default: 'created_at')","order (string) Sort order ('asc' for ascending, 'desc' for descending, default: 'desc')","topic (string) Filter articles by topic (optional)","limit (integer) Number of articles per page (default: 10)","p (integer) Page number (default: 1)"],"exampleResponse":{"articles":[{"article_id":8,"title":"Example Article","topic":"mitch","author":"john_doe","created_at":"2023-01-15T12:30:00.000Z","votes":10,"comment_count":5,"total_count":"12"}]}},"POST /api/articles":{"description":"Adds a new article.","request_body":{"author":"string (required)","title":"string (required)","body":"string (required)","topic":"string (required)","article_img_url":"string (optional, defaults to a placeholder)"},"response":{"article_id":"integer","author":"string","title":"string","body":"string","topic":"string","article_img_url":"string","votes":"integer (defaults to 0)","created_at":"timestamp","comment_count":"integer"}},"GET /api/articles/:article_id":{"description":"Returns a single article matching the given article_id, including a comment count.","queries":["article_id (integer)"],"exampleResponse":{"article":{"author":"weegembump","title":"Seafood substitutions are increasing","article_id":4,"body":"Text from the article..","topic":"cooking","created_at":"2018-05-30T15:59:13.341Z","votes":0,"article_img_url":"https://images.pexels.com/photos/1267320/pexels-photo-1267320.jpeg?w=700&h=700","comment_count":0}}},"PATCH /api/articles/:article_id":{"description":"Updates the vote count of an article matching the given article_id.","request_body":{"inc_votes":"integer"},"response":{"article_id":"integer","votes":"integer"},"exampleResponse":{"article":{"article_id":4,"votes":9}}},"DELETE /api/articles/:article_id":{"description":"Removes an article matching the given article_id.","queries":["article_id (integer)"],"response":{}},"GET /api/articles/:article_id/comments":{"description":"Returns a paginated array of comments for the given article_id.","queries":["article_id (integer) - The ID of the article","limit (integer, optional) - Number of comments per page (default: 10)","p (integer, optional) - Page number (default: 1)"],"exampleRequest":"/api/articles/1/comments?limit=4&p=2","exampleResponse":{"comments":[{"comment_id":7,"votes":2,"created_at":"2018-06-01T12:34:56.789Z","author":"happyCoder","body":"This is a comment text.","article_id":1}]}},"POST /api/articles/:article_id/comments":{"description":"Adds a comment to the article matching the given article_id.","request_body":{"username":"string","body":"string"},"response":{"comment_id":"integer","article_id":"integer","body":"string","votes":"integer","author":"string","created_at":"timestamp"},"exampleResponse":{"comment":{"comment_id":19,"article_id":3,"body":"You shall not parse!","votes":0,"author":"grandalf_the_tired","created_at":"2025-03-11T12:32:44.086Z"}}},"PATCH /api/comments/:comment_id":{"description":"Updates the vote count of a comment matching the given comment_id.","request_body":{"inc_votes":"integer"},"exampleResponse":{"comment":{"comment_id":19,"article_id":3,"body":"You shall not parse!","votes":1,"author":"grandalf_the_tired","created_at":"2025-03-11T12:32:44.086Z"}}},"DELETE /api/comments/:comment_id":{"description":"Deletes a comment matching the given comment_id.","queries":["comment_id (integer)"],"exampleResponse":{}},"GET /api/users":{"description":"Returns an array of all users.","queries":[],"exampleResponse":[{"username":"stacey-dooly-and-the-lockdown-babies","name":"tony","avatar_url":"https://avatars2.githubusercontent.com/u/24394918?s=400&v=4"}]},"GET /api/users/:username":{"description":"Returns a single user matching the given username.","queries":["username (string)"],"exampleResponse":{"user":{"username":"stacey-dooly-and-the-lockdown-babies","name":"tony","avatar_url":"https://avatars2.githubusercontent.com/u/24394918?s=400&v=4"}}}}}