-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapi.http
More file actions
87 lines (71 loc) · 1.78 KB
/
Copy pathapi.http
File metadata and controls
87 lines (71 loc) · 1.78 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
@base_url = http://127.0.0.1:1378
### create_user
# Create a new user (first user becomes admin)
POST {{base_url}}/register HTTP/1.1
Content-Type: application/json
{
"email": "parham.alvani@gmail.com",
"password": "123456",
"name": "Parham Alvani"
}
### login
# Login
POST {{base_url}}/login HTTP/1.1
Content-Type: application/json
{
"email": "parham.alvani@gmail.com",
"password": "123456"
}
### new_home
# Create a new home (with optional base64 photos)
POST {{base_url}}/api/homes HTTP/1.1
Authorization: Bearer {{login.response.body.accessToken}}
Content-Type: application/json
{
"title": "sweet home",
"location": "italy",
"description": "a place to live",
"peoples": 3,
"room": "good",
"bed": "single",
"rooms": 4,
"bathrooms": 1,
"smoking": false,
"guest": true,
"pet": false,
"bills_included": false,
"contract": "good",
"security_deposit": 1000,
"price": 100,
"photos": []
}
### list_homes
# List homes with pagination
GET {{base_url}}/api/homes?skip=0&limit=10 HTTP/1.1
Authorization: Bearer {{login.response.body.accessToken}}
### get_home
# Get a specific home by ID
GET {{base_url}}/api/homes/{{new_home.response.body.id}} HTTP/1.1
Authorization: Bearer {{login.response.body.accessToken}}
### update_home
# Update a home (only owner or admin can update)
PUT {{base_url}}/api/homes/{{new_home.response.body.id}} HTTP/1.1
Authorization: Bearer {{login.response.body.accessToken}}
Content-Type: application/json
{
"title": "updated sweet home",
"location": "italy",
"description": "an updated place to live",
"peoples": 4,
"room": "great",
"bed": "double",
"rooms": 5,
"bathrooms": 2,
"smoking": false,
"guest": true,
"pet": false,
"bills_included": true,
"contract": "long-term",
"security_deposit": 1500,
"price": 150
}