-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendpoints.json
181 lines (181 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
{
"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": "posts a new topic, and responds with the new topic",
"exampleRequestBody": {
"slug": "baking",
"description": "I love to bake cookies and banana bread!"
},
"exampleResponse": {
"topic": {
"slug": "baking",
"description": "I love to bake cookies and banana bread!"
}
}
},
"GET /api/articles": {
"description": "serves an array of all topics",
"queries": ["author", "topic", "sort_by", "order", "limit", "p"],
"exampleResponse": {
"articles": [
{
"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
}
]
}
},
"POST /api/articles": {
"description": "posts a new article, and responds with the new article",
"exampleRequestBody": {
"author": "happyamy2016",
"title": "Kate loves her cat Pickle",
"body": "Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.",
"topic": "coding",
"article_img_url": "https://www.pexels.com/photo/brown-and-black-cat-37337/"
},
"exampleResponse": {
"article": {
"author": "happyamy2016",
"title": "Kate loves her cat Pickle",
"article_id": 39,
"body": "Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.",
"topic": "coding",
"created_at": "2023-02-23T20:55:05.548Z",
"votes": 0,
"article_img_url": "https://www.pexels.com/photo/brown-and-black-cat-37337/",
"comment_count": 0
}
}
},
"GET /api/articles/:article_id": {
"description": "serves an article, based on article_id given",
"parameters": ["article_id"],
"exampleResponse": {
"article": {
"author": "jessjelly",
"title": "Running a Node App",
"article_id": 1,
"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.",
"topic": "coding",
"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": 8
}
}
},
"PATCH /api/articles/:article_id": {
"description": "updates the votes of a given article_id, and responds with the updated article",
"parameters": ["article_id"],
"exampleRequestBody": { "inc_votes": 31 },
"exampleResponse": {
"article": {
"article_id": 5,
"title": "Please stop worrying about Angular 3",
"topic": "coding",
"author": "jessjelly",
"body": "Another Angular version planned already? Whaaaat? Didn't Angular 2 just ship? Why Angular 3? What? Why? First off, there is no massive rewrite, and won't be for Angular 3. Secondly, let me explain the future of Angular 2 and what Angular 3, Angular 4 will mean for you.",
"created_at": "2020-04-21T16:06:00.000Z",
"votes": 31,
"article_img_url": "https://images.pexels.com/photos/14011035/pexels-photo-14011035.jpeg?w=700&h=700"
}
}
},
"DELETE /api/articles/:article_id": {
"description": "deletes a given article and its associated comments by article_id",
"parameters": ["article_id"]
},
"GET /api/articles/:article_id/comments": {
"description": "serves an array of all comments for a given article_id",
"parameters": ["article_id"],
"exampleResponse": {
"comments": [
{
"comment_id": 89,
"votes": 2,
"created_at": "2020-10-24T06:08:00.000Z",
"author": "cooljmessy",
"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.",
"article_id": 1
}
]
}
},
"POST /api/articles/:article_id/comments": {
"description": "posts a new comment for a given article_id, and responds with the posted comment",
"parameters": ["article_id"],
"exampleRequestBody": {
"username": "cooljmessy",
"body": "This is a new comment for an article."
},
"exampleResponse": {
"comment": {
"comment_id": 301,
"body": "This is a new comment for an article.",
"article_id": 5,
"author": "cooljmessy",
"votes": 0,
"created_at": "2023-02-22T23:47:41.753Z"
}
}
},
"GET /api/users": {
"description": "serves an array of users",
"queries": [],
"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"
}
]
}
},
"GET /api/users/:username": {
"description": "serves a user, based on username given",
"parameters": ["username"],
"exampleResponse": {
"user": {
"username": "cooljmessy",
"name": "Peter Messy",
"avatar_url": "https://vignette.wikia.nocookie.net/mrmen/images/1/1a/MR_MESSY_4A.jpg/revision/latest/scale-to-width-down/250?cb=20170730171002"
}
}
},
"DELETE /api/comments/:comment_id": {
"description": "deletes a given comment by comment_id",
"parameters": ["comment_id"]
},
"PATCH /api/comments/:comment_id": {
"description": "updates the votes of a given comment_id, and responds with the updated comment",
"parameters": ["comment_id"],
"exampleRequestBody": { "inc_votes": 18 },
"exampleResponse": {
"comment": {
"comment_id": 2,
"body": "Nobis consequatur animi. Ullam nobis quaerat voluptates veniam.",
"article_id": 4,
"author": "grumpy19",
"votes": 25,
"created_at": "2020-01-01T15:02:00.000Z"
}
}
}
}