-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrest.http
170 lines (114 loc) · 5.05 KB
/
rest.http
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
### All Users
GET http://localhost:8080/api/users
### Single user by ID w/o req.query
GET http://localhost:8080/api/users/1
Content-Type: application/json
### Single user by ID with req.query.read = true
GET http://localhost:8080/api/users/1?read=true
Content-Type: application/json
### Single user by ID with req.query.read = true
GET http://localhost:8080/api/users/1?read=false
Content-Type: application/json
### Signup for non-staff users
POST http://localhost:8080/api/users/signup
Content-Type: application/json
{
"username": "user2@example.io",
"name": "Boyd D. Montgomery",
"password": "password2#"
}
### Signup for staff users
POST http://localhost:8080/api/users/staff/signup
Content-Type: application/json
{
"username": "user1@example.io",
"name": "Juan Dela Cruz",
"password": "password1%",
"admin": true
}
### Login
POST http://localhost:8080/api/users/login
Content-Type: application/json
{
"username": "user2@example.io",
"password": "password2#"
}
### Update user by username with req.params.username
PATCH http://localhost:8080/api/users/user1@example.io
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODAyMjEzOTMsImV4cCI6MTY4MDIyNDk5MywiYXVkIjoiMSIsImlzcyI6ImFybmVsaW1wZXJpYWwuY29tIn0.EiqEUmdv03Op_XV_76QGjOR9Fxre2Y6WI1NeOUj4Do4
{
"username": "user2@example.io",
"name": "Boyd K. Montgomery",
"password": "password2#"
}
### Logout
DELETE http://localhost:8080/api/users/logout
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODAyMzEzNjYsImV4cCI6MTY4MDIzNDk2NiwiYXVkIjoiMSIsImlzcyI6ImFybmVsaW1wZXJpYWwuY29tIn0.VuYWpzRTNFCAvmYo9bx4u1kQc-d_gTbV5gwsPd-8Wng
### Deactivate account by auth users
PATCH http://localhost:8080/api/users/deactivate-account/user2@example.io
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODAyOTkxMzYsImV4cCI6MTY4MDMwMjczNiwiYXVkIjoiMiIsImlzcyI6ImFybmVsaW1wZXJpYWwuY29tIn0.fP1D61w6CmA4xUB82-3TJZZKNI6bBijHtsKy_C0ehAM
{
"disabled": true
}
### Reactivate an account by staff users only
PATCH http://localhost:8080/api/users/reactivate-account/user2@example.io
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODAyOTkxOTUsImV4cCI6MTY4MDMwMjc5NSwiYXVkIjoiMSIsImlzcyI6ImFybmVsaW1wZXJpYWwuY29tIn0.N0ewAYPljvojmWjyGPSRQozXRnPyzZO0aj5_W9N5l04
{
"disabled": false
}
### Request new access token using refresh token as req.body
POST http://localhost:8080/api/users/auth-tokens
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODAyMDc4MzgsImV4cCI6MTY4MDIxMTQzOCwiYXVkIjoiMSIsImlzcyI6ImFybmVsaW1wZXJpYWwuY29tIn0.nw8L4CzT5mXvbiYx8mDQdDYuAVFhJCZi2uzj5DZURc4
{
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODAyMDc4MzgsImV4cCI6MTY4Mjc5OTgzOCwiYXVkIjoiMSIsImlzcyI6ImFybmVsaW1wZXJpYWwuY29tIn0.5ClMUHgz9KHRw66pURPKk7VxIMX3pOzEVkDqVvPxRrw"
}
### All Blogs w/o req.query.search
GET http://localhost:8080/api/blogs
### All Blogs with req.query.search (Search for title & author field)
GET http://localhost:8080/api/blogs?search=TDD Harms Architecture
### Single blog by ID
GET http://localhost:8080/api/blogs/blog/2
### Create blog
POST http://localhost:8080/api/blogs
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODAyODE4MzksImV4cCI6MTY4MDI4NTQzOSwiYXVkIjoiMSIsImlzcyI6ImFybmVsaW1wZXJpYWwuY29tIn0.KcOQYnB_S94fttzZjEAd0TVTS_Yp1ej7MnoFS_eOiCc
{
"title": "TDD Harms Architecture I",
"url": "http://blog.cleancoder.com/uncle-bob/2017/03/03/TDD-Harms-Architecture.html",
"author": "Robert C. Martin I",
"likes": 1,
"year": 2000
}
### Update blog by ID
PUT http://localhost:8080/api/blogs/update/1
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODAyMjQ3MjYsImV4cCI6MTY4MDIyODMyNiwiYXVkIjoiMSIsImlzcyI6ImFybmVsaW1wZXJpYWwuY29tIn0.c8DhWwH0pJVAZP1sVBx5Sc8cmXvEJ2pOuQDUNbgHMXg
{
"title": "TDD Harms Architecture",
"url": "http://blog.cleancoder.com/uncle-bob/2017/03/03/TDD-Harms-Architecture.html",
"author": "Robert C. Martin",
"likes": 9,
"year": 2004
}
### Delete blog by ID
DELETE http://localhost:8080/api/blogs/omit/1
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODAyMjIyNDEsImV4cCI6MTY4MDIyNTg0MSwiYXVkIjoiMSIsImlzcyI6ImFybmVsaW1wZXJpYWwuY29tIn0.kQpbbO3-G15wIs-Nn2ma5MuJ-Irs41l4Dy6k5e4sLsI
### Aggregate blogs by author
GET http://localhost:8080/api/authors
### List readings
GET http://localhost:8080/api/readinglists
### Retrieve reading by ID
GET http://localhost:8080/api/readinglists/retrieve/2
### Update reading by ID
PATCH http://localhost:8080/api/readinglists/update/1
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODAyODE4MzksImV4cCI6MTY4MDI4NTQzOSwiYXVkIjoiMSIsImlzcyI6ImFybmVsaW1wZXJpYWwuY29tIn0.KcOQYnB_S94fttzZjEAd0TVTS_Yp1ej7MnoFS_eOiCc
{
"read": true
}