-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendpoints.json
243 lines (243 loc) · 6.65 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
{
"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",
"exampleResponse": {
"topics": [{ "slug": "football", "description": "Footie!" }]
}
},
"POST /api/topics": {
"description": "adds a new topic and serves the created topic",
"data_format": { "slug": "football", "description": "Footie!" },
"exampleResponse": {
"topic": { "slug": "football", "description": "Footie!" }
}
},
"GET /api/articles": {
"description": "serves an array of all topics",
"queries": {
"topic": "topic_name",
"sort_by": "asc OR desc, defualt desc",
"order": "property_name",
"limit": "some integer or 'all', default 10",
"p": "some integer e.g. 1, ignored if limit is 'all'"
},
"exampleResponse": {
"articles": [
{
"author": "Legolad",
"title": "Seafood substitutions are increasing",
"article_id": 3,
"topic": "cooking",
"created_at": 1527695953341,
"votes": 5,
"article_img_url": "https://someurl.co.uk",
"comment_count": 2
}
],
"total_count": 1
}
},
"POST /api/articles": {
"description": "adds a new article for a specified user on a specified topic, image url is optional.",
"data_format": {
"author": "Legolad",
"title": "Seafood substitutions are increasing",
"body": "Some article text",
"topic": "cooking",
"article_img_url (Optional)": "https://someurl.co.uk"
},
"exampleResponse": {
"article": {
"author": "Legolad",
"title": "Seafood substitutions are increasing",
"body": "Some article text",
"topic": "cooking",
"article_img_url": "https://someurl.co.uk",
"article_id": 15,
"votes": 0,
"created_at": 1527695953341,
"comment_count": 0
}
}
},
"GET /api/articles/:articles_id": {
"description": "serves the specific article",
"exampleResponse": {
"article":{
"author": "Legolad",
"title": "Seafood substitutions are increasing",
"article_id": 3,
"body": "ipsum morem",
"topic": "cooking",
"created_at": 1527695953341,
"votes": 5,
"article_img_url": "https://someurl.co.uk",
"comment_count": 2
}
}
},
"PATCH /api/articles/:articles_id": {
"description": "updates the votes of a specified article by the amount given, which must be an integer",
"data_format": {"inc_votes": 10},
"exampleResponse": {
"article":{
"author": "Legolad",
"title": "Seafood substitutions are increasing",
"article_id": 3,
"body": "ipsum morem",
"topic": "cooking",
"created_at": 1527695953341,
"votes": 15,
"article_img_url": "https://someurl.co.uk",
"comment_count": 2
}
}
},
"DELETE /api/articles/:articles_id": {
"description": "removes the specified article and its comments",
"exampleResponse": {}
},
"GET /api/articles/:articles_id/comments": {
"description": "serves an array of comments of the specified article",
"queries": {
"limit": "some Integer or 'all', default 10",
"p": "some integer e.g. 1, ignored if limit is 'all'"
},
"exampleResponse": {
"comments":[
{
"comment_id": 1,
"votes": 50,
"created_at": 1527695953341,
"author": "Legolad",
"body": "ipsum morem",
"article_id": 3
}
],
"total_count": 1
}
},
"POST /api/articles/:articles_id/comments": {
"description": "adds a comment from a user for a specified article",
"data_format": {"username": "Legolad", "body": "ipsum morem"},
"exampleResponse": {
"comment":[
{
"comment_id": 10,
"votes": 0,
"created_at": 1527695953999,
"author": "Legolad",
"body": "ipsum morem",
"article_id": 3
}
]
}
},
"GET /api/comments/comment_id": {
"description": "serves the specific comment",
"exampleResponse": {
"comment":{
"comment_id": 4,
"body": "Some comment",
"article_id": 7,
"author": "Legolad",
"votes": 15,
"created_at": 1527695953341
}
}
},
"PATCH /api/comments/comment_id": {
"description": "updates the votes of a specified comment by the amount given, which must be an integer",
"data_format": {"inc_votes": 10},
"exampleResponse": {
"comment":{
"comment_id": 4,
"body": "Some comment",
"article_id": 7,
"author": "Legolad",
"votes": 15,
"created_at": 1527695953341
}
}
},
"DELETE /api/comments/comment_id": {
"description": "removes the specified comment",
"exampleResponse": {}
},
"GET /api/users": {
"description": "serves an array of all users",
"exampleResponse": {
"users": [
{
"username": "Legolad",
"name": "Legolas",
"avatr_url": "https://someurl.com"
}
]
}
},
"POST /api/users": {
"description": "adds a new user",
"data_format" : {
"username": "Legolad",
"name": "Legolas",
"avatr_url (Optional)": "https://someurl.com"
},
"exampleResponse": {
"user": {
"username": "Legolad",
"name": "Legolas",
"avatr_url": "https://someurl.com"
}
}
},
"GET /api/users/:username": {
"description": "serves specified user",
"exampleResponse": {
"users":{
"username": "Legolad",
"name": "Legolas",
"avatr_url": "https://someurl.com"
}
}
},
"DELETE /api/users/:username": {
"description": "deletes the specified user",
"exampleResponse": {}
},
"GET /api/users/:username/comments": {
"description": "serves all comments by the specified user",
"exampleResponse": {
"comments":[
{
"comment_id": 1,
"votes": 50,
"created_at": 1527695953341,
"author": "Legolad",
"body": "ipsum morem",
"article_id": 3
}
]
}
},
"GET /api/users/:username/articles": {
"description": "serves all articles by the specified user",
"exampleResponse": {
"articles": [
{
"author": "Legolad",
"title": "Seafood substitutions are increasing",
"article_id": 3,
"topic": "cooking",
"created_at": 1527695953341,
"votes": 5,
"article_img_url": "https://someurl.co.uk",
"comment_count": 2
}
]
}
}
}