-
Notifications
You must be signed in to change notification settings - Fork 0
/
endpoints.json
211 lines (196 loc) · 6.05 KB
/
endpoints.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
{
"GET /api": {
"description": "serves up a json representation of all the available endpoints of the api"
},
"GET /api/articles": {
"description": "serves an array of all articles sorted by created_at in descending order as default. Sort_dir can be 'asc' or 'desc' ",
"queries": ["sort_by", "sort_dir", "title", "topic", "author", "votes", "comment_count"],
"exampleResponse": {
"articles": [
{
"article_id": 4,
"title": "Student SUES Mitch!",
"topic": "mitch",
"author": "rogersop",
"created_at": "2020-05-06 02:05:00",
"votes": 0,
"comment_count": 0,
"article_img_url": "https://images.pexels.com/photos/158651/news-newsletter-newspaper-information-158651.jpeg?w=700&h=700"
}
]
}
},
"POST /api/articles": {
"description": "inserts a new article given the correct required properties and returns the new article with all properties",
"queries": [],
"requestBody": {
"title": "Adventures in Web Wizardry",
"author": "syntaxsorcerer",
"body": "The cake is a lie",
"topic": "code",
"article_img_url": "some-server/test-image.jpg"
},
"exampleResponse": {
"article": [
{
"article_id": 14,
"title": "Adventures in Web Wizardry",
"topic": "code",
"author": "syntaxsorcerer",
"body": "The cake is a lie",
"votes": 0,
"article_img_url": "http://some-server/test-image.jpg",
"created_at": "2024-04-19 03:04:26",
"comment_count": 0
}
]
}
},
"GET /api/articles/:article_id": {
"description": "serves an object containing the matching article accoring to article_id",
"queries": [],
"exampleResponse": {
"article": [
{
"article_id": 3,
"title": "Eight pug gifs that remind me of mitch",
"topic": "mitch",
"author": "icellusedkars",
"body": "some gifs",
"created_at": "2020-11-03 09:11:00",
"comment_count": 2,
"article_img_url":
"https://images.pexels.com/photos/158651/news-newsletter-newspaper-information-158651.jpeg?w=700&h=700"
}
]
}
},
"PATCH /api/articles/:article_id": {
"description": "Updates the number of votes on an existing article",
"requestBody": {
"inc_votes": 1
},
"queries": [],
"exampleResponse": {
"article": {
"article_id": 5,
"title": "UNCOVERED: catspiracy to bring down democracy",
"topic": "cats",
"author": "rogersop",
"votes": 9,
"body": "Bastet walks amongst us, and the cats are taking arms!",
"created_at": "2020-08-03 02:08:00",
"article_img_url":
"https://images.pexels.com/photos/158651/news-newsletter-newspaper-information-158651.jpeg?w=700&h=700"
}
}
},
"DELETE /api/articles/:article_id": {
"description": "Deletes the specified article",
"queries": [],
"exampleResponse": "Status 204"
},
"GET /api/articles/:article_id/comments": {
"description": "serves an array of all comments related to the specified article_id sorted by created_at in descending order",
"queries": [],
"exampleResponse": {
"comments": [
{
"comment_id": 11,
"author": "icellusedkars",
"votes": 0,
"article_id": 3,
"created_at": "2020-09-20 12:09:00",
"body": "Ambidextrous marsupial"
},
{
"comment_id": 10,
"author": "icellusedkars",
"votes": 0,
"article_id": 3,
"created_at": "2020-06-20 08:06:00",
"body": "git push origin master"
}
]
}
},
"POST /api/articles/:article_id/comments": {
"description": "Creates a new comment by the username provided, attatched to the article_id provided",
"requestBody": {
"username": "string",
"body": "string"
},
"queries": [],
"exampleResponse": {
"comment": {
"comment_id": 19,
"article_id": 3,
"author": "theRealDumbledore",
"body": "It does not do to dwell on dreams, and forget to live",
"created_at": "2024-04-16 13:00:00",
"votes": 0
}
}
},
"DELETE /api/comments/:comment_id": {
"description": "Deletes the specified comment",
"queries": [],
"exampleResponse": "Status 204"
},
"PATCH /api/comments/:comment_id": {
"description": "Updates the number of votes on the specified comment",
"requestBody": {
"inc_votes": 10
},
"queries": [],
"exampleResponse": {
"comment_id": 5,
"body": "I hate streaming noses",
"votes": 10,
"author": "icellusedkars",
"article_id": 1,
"created_at": "2020-11-03 09:11:00"
}
},
"GET /api/topics": {
"description": "serves an array of all topics",
"queries": [],
"exampleResponse": {
"topics": [{ "slug": "football", "description": "Footie!" }]
}
},
"POST /api/topics": {
"description": "inserts a new topic given the correct required properties and returns the new topic with all properties",
"queries": [],
"requestBody": {"slug": "blackholes", "description": "nothing to see here"},
"exampleResponse": {
"topic": [{"slug": "blackholes", "description": "nothing to see here"}]
}
},
"GET /api/users": {
"description": "serves an array of all users",
"queries": [],
"exampleResponse": {
"users": [
{
"username": "marauder5",
"name": "Harry",
"avatar_url": "https://www.golenbock.com/wp-content/uploads/2015/01/placeholder-user.png"
}
]
}
},
"GET /api/users/:username": {
"description": "Returns a single user with a username matching the query",
"queries": [],
"exampleResponse": {
"user": [
{
"username": "theRealDUmbledore",
"name": "Albus",
"avatar_url": "https://www.golenbock.com/wp-content/uploads/2015/01/placeholder-user.png"
}
]
}
}
}