-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendpoints.json
162 lines (160 loc) · 5.87 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
{
"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": "It will insert new topic into topics table by inserting requested body to topics table",
"queries": [],
"exampleResponse": {
"topics": [{ "slug": "football", "description": "Footie!" }]
}
},
"GET /api/articles/:article_id": {
"description": "It will help us to get all articles which there article_id === :article_id ",
"queries": [],
"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
}
]
}
},
"DELETE /api/articles/:article_id": {
"description": "It will delete article which has this article_id from articles table also it will delete comment if article_id has relationship with comments table.",
"queries": [],
"exampleResponse": {}
},
"GET /api/articles": {
"description": "serves an array of all topics",
"queries": ["topic", "sort_by", "order", "limit", "p/page"],
"exampleResponse": {
"articles": [
{
"title": "Seafood substitutions are increasing",
"topic": "cooking",
"article_id": 2,
"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/comments": {
"description": "It will help us to get all comments with right article_id and limit and p/page number",
"queries": ["limit", "p/page"],
"exampleResponse": {
"comment": [
{
"body": "Oh, I've got compassion running out of my nose, pal! I'm the Sultan of Sentiment!",
"votes": 16,
"author": "butter_bridge",
"article_id": 9,
"created_at": 1586179020000
}
]
}
},
"POST /api/articles/:article_id/comments": {
"description": "It will us to post/update new comment to comments table by article_id and requested body",
"queries": [],
"exampleResponse": {
"comment": [
{
"body": "Oh, I've got compassion running out of my nose, pal! I'm the Sultan of Sentiment!"
}
]
}
},
"PATCH /api/articles/:article_id": {
"description": "It will help us to patch/update specific part from articles table",
"queries": [],
"exampleResponse": {
"articles": [
{
"title": "Seafood substitutions are increasing"
}
]
}
},
"DELETE /api/comments/:comment_id": {
"description": "It will delete comments from table when if comments table have comment_id equal to the params id i.e /:comment_id ",
"queries": [],
"exampleResponse": []
},
"PATCH /api/comments/:comment_id": {
"description": "It will help us to to increment or decrement votes of comments by selecting comment by comment_id and update the votes colum by inc_votes value",
"queries": [],
"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": 15,
"created_at": "2020-04-06T12:17:00.000Z"
}
}
]
},
"GET /api/users": {
"description": "It will help us to get all users from users table which have appropriate properties",
"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": "It will help us to get single user from users through username parameter.",
"queries": [],
"exampleResponse": {
"user": {
"username": "butter_bridge",
"name": "jonny",
"avatar_url": "https://www.healthytherapies.com/wp-content/uploads/2016/06/Lime3.jpg"
}
}
},
"POST /api/articles": {
"description": "It will us to insert new article ot articles table.",
"queries": [],
"exampleResponse": {
"comment": [
{
"author": "jes..",
"title": "Running a Node app...",
"body": "bunch of body...",
"topic": "codding",
"article_img_url": "http...",
"article_id": 2,
"votes": 0,
"created_at": "timeStamp",
"comment_count": "2"
}
]
}
}
}