-
Notifications
You must be signed in to change notification settings - Fork 0
/
endpoints.json
250 lines (250 loc) · 8.44 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
{
"GET /api": {
"description": "serves up a json representation of all the available endpoints of the api"
},
"GET /api/topics": {
"description": "serves an array of all topics",
"queries": [],
"exampleResponse": {
"topics": [
{
"slug": "football",
"description": "Footie!"
}
]
}
},
"POST /api/topics": {
"description": "serves created topic",
"payload": {
"slug": "/^[a-z-]{3,20}$/.test(<String>)",
"description": "<String>"
},
"exampleResponse": {
"topic": {
"slug": "hello",
"description": "Lorem ipsum dolor sit amet"
}
}
},
"GET /api/articles": {
"description": "serves an array of all articles sorted by date in descending order",
"queries": {
"sort_by": "author | title | article_id | topic | created_at | votes",
"order": "ASC | DESC",
"topic": "<String>",
"limit": "<Number>",
"page": "<Number>"
},
"exampleResponse": {
"pagination": {
"total_count": 13,
"current_page": 1,
"total_pages": 3,
"next_page": 2,
"prev_page": null
},
"articles": [
{
"author": "grumpy19",
"title": "The Notorious MSG’s Unlikely Formula For Success",
"article_id": 34,
"topic": "cooking",
"created_at": "2020-11-22T11:13:00.000Z",
"votes": 0,
"article_img_url": "https://images.pexels.com/photos/2403392/pexels-photo-2403392.jpeg?w=700&h=700",
"comment_count": 11
},
{
"author": "tickle122",
"title": "The battle for Node.js security has only begun",
"article_id": 12,
"topic": "coding",
"created_at": "2020-11-15T13:25:00.000Z",
"votes": 0,
"article_img_url": "https://images.pexels.com/photos/10845119/pexels-photo-10845119.jpeg?w=700&h=700",
"comment_count": 7
},
{
"author": "grumpy19",
"title": "JavaScript’s Apply, Call, and Bind Methods are Essential for JavaScript Professionals",
"article_id": 6,
"topic": "coding",
"created_at": "2020-11-11T15:09:00.000Z",
"votes": 0,
"article_img_url": "https://images.pexels.com/photos/4383298/pexels-photo-4383298.jpeg?w=700&h=700",
"comment_count": 11
}
]
}
},
"POST /api/articles": {
"description": "serves created article",
"payload": {
"author": "<Reference String>",
"title": "<String>",
"body": "<String>",
"topic": "<Reference String>",
"article_img_url": "<String>*"
},
"exampleResponse": {
"article": {
"author": "grumpy19",
"title": "The Notorious MSG’s Unlikely Formula For Success",
"article_id": 34,
"topic": "cooking",
"created_at": "2020-11-22T11:13:00.000Z",
"votes": 0,
"article_img_url": "https://images.pexels.com/photos/2403392/pexels-photo-2403392.jpeg?w=700&h=700",
"comment_count": 0
}
}
},
"GET /api/articles/:article_id": {
"description": "serves single article",
"exampleResponse": {
"article": {
"article_id": 1,
"title": "Running a Node App",
"topic": "coding",
"author": "jessjelly",
"body": "This is part two of a series on how to get up and running with Systemd and Node.js. This part dives deeper into how to successfully run your app with systemd long-term, and how to set it up in a production environment.",
"created_at": "2020-11-07T06:03:00.000Z",
"votes": 0,
"article_img_url": "https://images.pexels.com/photos/11035380/pexels-photo-11035380.jpeg?w=700&h=700",
"comment_count": 10
}
}
},
"PATCH /api/articles/:article_id": {
"description": "serves single article with (in/de)creased votes",
"accepts": {
"inc_votes": "<Number<INT>>*"
},
"exampleResponse": {
"article": {
"article_id": 1,
"title": "Running a Node App",
"topic": "coding",
"author": "jessjelly",
"body": "This is part two of a series on how to get up and running with Systemd and Node.js. This part dives deeper into how to successfully run your app with systemd long-term, and how to set it up in a production environment.",
"created_at": "2020-11-07T06:03:00.000Z",
"votes": 10,
"article_img_url": "https://images.pexels.com/photos/11035380/pexels-photo-11035380.jpeg?w=700&h=700",
"comment_count": 10
}
}
},
"DELETE /api/articles/:article_id": {
"description": "deletes single article",
"exampleResponse": {}
},
"GET /api/articles/:article_id/comments": {
"description": "serves all comments of single article sorted by date in descending order",
"queries": {
"limit": "<Number>",
"page": "<Number>"
},
"exampleResponse": {
"pagination": {
"total_count": 11,
"current_page": 1,
"total_pages": 3,
"next_page": 2,
"prev_page": null
},
"comments": [
{
"comment_id": 89,
"body": "Esse et expedita harum non. Voluptatibus commodi voluptatem. Minima velit suscipit numquam ea. Id vitae debitis aut incidunt odio quo quam possimus ipsum.",
"article_id": 1,
"author": "cooljmessy",
"votes": 2,
"created_at": "2020-10-24T06:08:00.000Z"
},
{
"comment_id": 86,
"body": "Et explicabo dignissimos officia dolore rerum aliquam corrupti. Culpa corporis earum et earum officia a est atque at. Quidem quo recusandae delectus autem possimus blanditiis optio. Sed culpa culpa. Exercitationem nemo aspernatur alias ut qui.",
"article_id": 1,
"author": "tickle122",
"votes": 14,
"created_at": "2020-10-04T01:03:00.000Z"
},
{
"comment_id": 31,
"body": "Sit sequi odio suscipit. Iure quisquam qui alias distinctio eos officia enim aut sit. Corrupti ut praesentium ut iste earum itaque qui. Dolores in ab rerum consequuntur. Id ab aliquid autem dolore.",
"article_id": 1,
"author": "weegembump",
"votes": 11,
"created_at": "2020-09-26T16:16:00.000Z"
}
]
}
},
"POST /api/articles/:article_id/comments": {
"description": "serves created comment",
"payload": {
"username": "<Reference String>*",
"body": "<String, 3-MAX>*"
},
"exampleResponse": {
"comment": {
"comment_id": 89,
"body": "Esse et expedita harum non. Voluptatibus commodi voluptatem. Minima velit suscipit numquam ea. Id vitae debitis aut incidunt odio quo quam possimus ipsum.",
"article_id": 1,
"author": "cooljmessy",
"votes": 2,
"created_at": "2020-10-24T06:08:00.000Z"
}
}
},
"DELETE /api/comments/:comment_id": {
"description": "deletes existing comment",
"exampleResponse": {}
},
"PATCH /api/comments/:comment_id": {
"description": "updates votes on existing comment",
"exampleResponse": {
"comment": {
"comment_id": 1,
"body": "Oh, I've got compassion running out of my nose, pal! I'm the Sultan of Sentiment!",
"article_id": 9,
"author": "butter_bridge",
"votes": 20,
"created_at": "2020-04-06T12: 17: 00.000Z"
}
}
},
"GET /api/users": {
"description": "serves an array of all users",
"exampleResponse": {
"users": [
{
"username": "tickle122",
"name": "Tom Tickle",
"avatar_url": "https://vignette.wikia.nocookie.net/mrmen/images/d/d6/Mr-Tickle-9a.png/revision/latest?cb=20180127221953"
},
{
"username": "grumpy19",
"name": "Paul Grump",
"avatar_url": "https://vignette.wikia.nocookie.net/mrmen/images/7/78/Mr-Grumpy-3A.PNG/revision/latest?cb=20170707233013"
},
{
"username": "happyamy2016",
"name": "Amy Happy",
"avatar_url": "https://vignette1.wikia.nocookie.net/mrmen/images/7/7f/Mr_Happy.jpg/revision/latest?cb=20140102171729"
}
]
}
},
"GET /api/users/:username": {
"description": "serves a single user",
"exampleResponse": {
"user": {
"username": "tickle122",
"name": "Tom Tickle",
"avatar_url": "https://vignette.wikia.nocookie.net/mrmen/images/d/d6/Mr-Tickle-9a.png/revision/latest?cb=20180127221953"
}
}
}
}