-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequests.http
More file actions
executable file
·128 lines (103 loc) · 3.33 KB
/
requests.http
File metadata and controls
executable file
·128 lines (103 loc) · 3.33 KB
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
@contentType = application/json
@pseudo = mochizuki
@username = mochizuki@inote.fr
@password = @Tsu@hil145!
@passwordBis = chichi@@YYY14646_
@email = mochizuki@inote.fr
# USER ACCOUNT
#=================================================================
### Register an user with "USER" default role
# Nota : In dev context, need stmp-dev running (smtp server simulation)
# Run, as administrator (sudo in linux), smtp-dev/Rnwood.Smtp4dev binary
# from Inote root project
# Simulated Inbox mail is accessible at :
# http://localhost:5000
POST http://localhost:8080/api/auth/register HTTP/1.1
Content-Type: {{contentType}}
{
"pseudo":"{{pseudo}}",
"username":"{{username}}",
"password":"{{password}}"
}
#### Account activation
# Nota : Pick the activation code in Validation table
# or open fictionous mail box http://localhost:5000 (smtp-dev must be running)
POST http://localhost:8080/api/auth/activation HTTP/1.1
Content-Type: {{contentType}}
{
"code":"453583"
}
#### User sign in
# @name restApi
POST http://localhost:8080/api/auth/sign-in HTTP/1.1
# Nota : keep the Bearer, it must be in headers of all secured endpoints
Content-Type: {{contentType}}
{
"username":"{{username}}",
"password":"{{password}}"
}
@tokenBearer = {{restApi.response.body.bearer}}
@tokenRefresh = {{restApi.response.body.refresh}}
### User sign out
# Nota : Don't forget to set the good bearer given by server when sign in.
POST http://localhost:8080/api/auth/sign-out HTTP/1.1
Authorization: bearer {{tokenBearer}}
### Change password request
# Nota : Don't forget to recuperate activation code
POST http://localhost:8080/api/auth/change-password HTTP/1.1
Content-Type: {{contentType}}
{
"email":"{{email}}"
}
### Send a new password
# Nota: Don't forget to set the good activation code
POST http://localhost:8080/api/auth/new-password HTTP/1.1
Content-Type: {{contentType}}
{
"email":"{{email}}",
"code":"782725",
"password": "{{passwordBis}}"
}
### Send refresh-token
# Nota : Don't forget to set the good refresh UUID, sended when sign in
# @name restApi
POST http://localhost:8080/api/auth/refresh-token HTTP/1.1
Content-Type: {{contentType}}
{
"refresh":"{{tokenRefresh}}"
}
@tokenBearer = {{restApi.response.body.bearer}}
@tokenRefresh = {{restApi.response.body.refresh}}
### Get current user
# Nota : Don't forget to set the good refresh UUID, sended when sign in
GET http://localhost:8080/api/auth/current-user HTTP/1.1
Content-Type: {{contentType}}
Authorization: bearer {{tokenBearer}}
#COMMENTS
#========================================================================
### Send a comment
#Nota : dont forget to set the good bearer
POST http://localhost:8080/api/comment/create HTTP/1.1
Content-Type: {{contentType}}
Authorization: bearer {{tokenBearer}}
{
"msg": "Hello"
}
### Read All comments
#Don't forget to set the good bearer
GET http://localhost:8080/api/comments HTTP/1.1
Content-Type: {{contentType}}
Authorization: bearer {{tokenBearer}}
#USERS
#========================================================================
### Get an user by username
POST http://localhost:8080/api/users/get-user HTTP/1.1
Content-Type: {{contentType}}
Authorization: bearer {{tokenBearer}}
{
"username": "{{email}}"
}
### Get all users
GET http://localhost:8080/api/users/get-all-users HTTP/1.1
Content-Type: {{contentType}}
Authorization: bearer {{tokenBearer}}