-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_main.http
42 lines (32 loc) · 980 Bytes
/
test_main.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
# Test your FastAPI endpoints
### Authorization by grant_type=password, part 1. Retrieve and save access token.
POST http://127.0.0.1:8000/api/v1/auth/token
Accept: application/json
Content-Type: application/x-www-form-urlencoded
[email protected]&password=admin
> {%
client.global.set("authorization", "Bearer " + response.body.access_token);
%}
### Use token to authorize, part 2. List users
GET http://127.0.0.1:8000/api/v1/users
Authorization: {{authorization}}
###
### List users, part 2. Retrieve and save user ID
POST http://127.0.0.1:8000/api/v1/users
Accept: application/json
Authorization: {{authorization}}
Content-Type: application/json
{
"email": "{{$random.email}}",
"password": "{{$random.alphanumeric(8)}}"
}
> {%
client.global.set("user_id", response.body.id);
%}
###
### Get user by ID
GET http://127.0.0.1:8000/api/v1/users/{{user_id}}
Accept: application/json
Authorization: {{authorization}}
Content-Type: application/json
###