-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendpoints.json
194 lines (194 loc) · 5.06 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
{
"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": "creates a new topic",
"requestBody": [
"slug",
"description"
],
"exampleResponse": {
"topics": [
{
"slug": "topic name here",
"description": "description here"
}
]
}
},
"GET /api/articles": {
"description": "serves an array of all articles by queries",
"queries": [
"author",
"topic",
"sort_by",
"order",
"limit",
"p"
],
"exampleResponse": {
"articles": [
{
"title": "Seafood substitutions are increasing",
"topic": "cooking",
"author": "weegembump",
"body": "Text from the article..",
"created_at": "2018-05-30T15:59:13.341Z",
"votes": 0,
"comment_count": 6
}
],
"total_count": 36
}
},
"GET /api/articles/:article_id": {
"description": "serves an article by article_id",
"exampleResponse": {
"article": {
"article_id": 1,
"title": "Living in the shadow of a great man",
"topic": "mitch",
"author": "butter_bridge",
"body": "I find this existence challenging",
"created_at": "2020-07-09T20:11:00.000Z",
"votes": 100,
"article_img_url": "https://images.pexels.com/photos/158651/news-newsletter-newspaper-information-158651.jpeg?w=700&h=700"
}
}
},
"GET /api/articles/:article_id/comments": {
"description": "serves an array of all comments by article_id",
"queries": [
"limit",
"p"
],
"exampleResponse": {
"comments": [
{
"comment_id": 5,
"body": "I hate streaming noses",
"article_id": 1,
"author": "icellusedkars",
"votes": 0,
"created_at": "2020-11-03T21:00:00.000Z"
}
]
}
},
"POST /api/articles/:article_id/comments": {
"description": "adds a comment for an article by username",
"requestBody": [
"username",
"body"
],
"exampleResponse": {
"comment": {
"comment_id": 303,
"body": "A Cat",
"article_id": 1,
"author": "happyamy2016",
"votes": 0,
"created_at": "2024-01-16T22:31:04.613Z"
}
}
},
"POST /api/article": {
"description": "create a new article in DB",
"requestBody": [
"author",
"title",
"body",
"topic",
"article_img_url"
],
"exampleResponse": {
"article": {
"article_id": 1,
"title": "Living in the shadow of a great man",
"topic": "mitch",
"author": "butter_bridge",
"body": "I find this existence challenging",
"created_at": "2020-07-09T20:11:00.000Z",
"votes": 100,
"article_img_url": "https://images.pexels.com/photos/158651/news-newsletter-newspaper-information-158651.jpeg?w=700&h=700",
"comment_count": 6
}
}
},
"PATCH /api/articles/:article_id": {
"description": "updates an article's vote by article_id",
"requestBody": {
"inc_votes": 10
},
"exampleResponse": {
"article": {
"article_id": 1,
"title": "Living in the shadow of a great man",
"topic": "mitch",
"author": "butter_bridge",
"body": "I find this existence challenging",
"created_at": "2020-07-09T20:11:00.000Z",
"votes": 110,
"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": "delete article from DB by article_id"
},
"DELETE /api/comments/:comment_id": {
"description": "delete comment from DB by comment_id"
},
"PATCH /api/comments/:comment_id": {
"description": "updates an comment's vote by comment_id",
"requestBody": {
"inc_votes": 10
},
"exampleResponse": {
"comment": {
"comment_id": 303,
"body": "A Cat",
"article_id": 1,
"author": "happyamy2016",
"votes": 10,
"created_at": "2024-01-16T22:31:04.613Z"
}
}
},
"GET /api/users": {
"description": "serves an array of all users",
"queries": [],
"exampleResponse": {
"users": [
{
"username": "butter_bridge",
"name": "jonny",
"avatar_url": "https://www.healthytherapies.com/wp-content/uploads/2016/06/Lime3.jpg"
}
]
}
},
"GET /api/users/:username": {
"description": "serves an object with user's data",
"exampleResponse": {
"users": {
"username": "butter_bridge",
"name": "jonny",
"avatar_url": "https://www.healthytherapies.com/wp-content/uploads/2016/06/Lime3.jpg"
}
}
}
}