-
Notifications
You must be signed in to change notification settings - Fork 0
/
endpoints.json
147 lines (147 loc) · 4.92 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
{
"GET /api": {
"description": "serves up a json representation of all the available endpoints of the api"
},
"GET /api/users": {
"description": "returns all users, each object contains details about the user (username, name and avatar_url)",
"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": "returns the specified user object",
"exampleResponse": {
"user": {
"username": "icellusedkars",
"name": "sam",
"avatar_url": "https://avatars2.githubusercontent.com/u/24604688?s=460&v=4"
}
}
},
"GET /api/topics": {
"description": "serves an array of all topics",
"queries": [],
"exampleResponse": {
"topics": [{ "slug": "football", "description": "Footie!" }]
}
},
"GET /api/articles": {
"description": "serves an array of all articles",
"queries": ["topic", "sort_by", "order"],
"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
}
]
}
},
"GET /api/articles/:article_id": {
"description": "returns an article object for the specified 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",
"comment_count": 3
}
}
},
"GET /api/articles/:article_id/comments": {
"description": "returns an array of comments for the specified article ID",
"exampleResponse": {
"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": {
"description": "posts an article and returns the posted article. Must use a username that already exists and body must be a string",
"examplePost": {
"author": "icellusedkars",
"title": "Windy Road",
"body": "A very interesting read full of twists and turns",
"topic": "paper",
"article_img_url": "https://as1.ftcdn.net/v2/jpg/01/17/18/72/1000_F_117187243_oxda4jQ0sd1dTFhY7CSn6QMofcQKPqM3.jpg"
},
"exampleResponse": {
"article_id": 14,
"votes": 0,
"comment_count": 0,
"author": "icellusedkars",
"title": "Windy Road",
"body": "A very interesting read full of twists and turns",
"topic": "paper",
"article_img_url": "https://as1.ftcdn.net/v2/jpg/01/17/18/72/1000_F_117187243_oxda4jQ0sd1dTFhY7CSn6QMofcQKPqM3.jpg",
"created_at": "2020-07-09T20:11:00.000Z"
}
},
"POST /api/articles/:article_id/comments": {
"description": "posts a comment on the selected article and returns the posted comment. Must use a username that already exists and body must be a string",
"examplePost": {
"username": "icellusedkars",
"body": "comment"
},
"exampleResponse": {
"comment": {
"article_id": 7,
"author": "icellusedkars",
"body": "comment",
"comment_id": 19,
"votes": 0
}
}
},
"PATCH /api/articles/:article_id": {
"description": "adjusts the specified articles vote count and returns the updated article",
"examplePost": { "inc_votes": 1 },
"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": 101,
"article_img_url": "https://images.pexels.com/photos/158651/news-newsletter-newspaper-information-158651.jpeg?w=700&h=700"
}
}
},
"DELETE /api/comments/:comment_id": {
"description": "deletes the specified comment"
},
"PATCH /api/comments/:comment_id": {
"description": "adjusts the specified comments vote count (via an object with inc_votes key) and returns the updated comment",
"examplePost": { "inc_votes": 4 },
"exampleResponse": {
"comment": {
"body": "Oh, I've got compassion running out of my nose, pal! I'm the Sultan of Sentiment!",
"votes": 20,
"author": "butter_bridge",
"article_id": 9,
"created_at": "2020-07-09T20:11:00.000Z"
}
}
}
}