-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAPI.http
More file actions
217 lines (181 loc) · 4.53 KB
/
API.http
File metadata and controls
217 lines (181 loc) · 4.53 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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# Register
POST https://lunchapi.hsuan.app/api/register
Content-Type: application/json
Accept: application/json
{
"name" : "admin",
"email" : "a8102366@gm.tnfsh.tn.edu.tw",
"password" : "strong_password"
}
> {%
client.global.set("auth_token", response.body.json.access_token);
%}
###
# Register store manager
POST https://lunchapi.hsuan.app/api/register
Content-Type: application/json
Accept: application/json
{
"name" : "Store Manager",
"email" : "a8102366@gm.tnfsh.tn.edu.tw",
"password" : "strong_password",
"registration_code" : "AABBCCDD"
}
> {%
client.global.set("auth_token", response.body.json.access_token);
%}
###
# Login
POST https://lunchapi.hsuan.app/api/login
Content-Type: application/json
Accept: application/json
{
"email" : "a8102366@gm.tnfsh.tn.edu.tw",
"password" : "strong_password"
}
> {%
client.global.set("auth_token", response.body.access_token);
%}
###
# Login With Admin
POST https://lunchapi.hsuan.app/api/login/
Content-Type: application/json
Accept: application/json
{
"email" : "admin@admin.com",
"password" : "adminadmin"
}
> {%
client.global.set("auth_token", response.body.access_token);
%}
###
# Google
POST https://lunchapi.hsuan.app/api/google
Content-Type: application/json
Accept: application/json
{
"token": "000"
}
> {%
client.global.set("auth_token", response.body.json.access_token);
%}
###
# Change password
POST https://lunchapi.hsuan.app/api/change_password
Content-Type: application/json
Accept: application/json
{
"email" : "a8102366@gm.tnfsh.tn.edu.tw",
"password" : "strong_password",
"new_password": "strong_password"
}
###
# User
GET https://lunchapi.hsuan.app/api/me
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
###
# List Stores (Not authenticated)
GET https://lunchapi.hsuan.app/api/stores
Content-Type: application/json
Accept: application/json
###
# List Stores
GET https://lunchapi.hsuan.app/api/stores
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
###
# Create Stores
POST https://lunchapi.hsuan.app/api/stores
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
{
"name" : "Test Store"
}
> {%
client.global.set("store_id", response.body.id);
%}
###
# Show
GET https://lunchapi.hsuan.app/api/stores/34e4e411-4e6c-40e5-8094-1f2ab6439ed0/products
#GET https://lunchapi.hsuan.app/api/stores/{{store_id}}
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
###
# Delete
DELETE https://lunchapi.hsuan.app/api/stores/{{store_id}}
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
###
# Show Products
GET https://lunchapi.hsuan.app/api/stores/{{store_id}}/products
#GET https://lunchapi.hsuan.app/api/stores/70828fba-b5bb-425d-b281-f2d350433d9c/products
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
###
# New Product
#POST https://lunchapi.hsuan.app/api/stores/{{store_id}}/products
POST https://lunchapi.hsuan.app/api/stores/70828fba-b5bb-425d-b281-f2d350433d9c/products
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
{
"name" : "test",
"description" : "test product",
"price" : 50,
"store_id" : "{{store_id}}",
"image" : "https://google.com/favicon.ico"
}
> {%
client.global.set("product_id", response.body.id);
%}
###
# Show Product
GET https://lunchapi.hsuan.app/api/stores/{{store_id}}/products/{{product_id}}
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
###
# List Transactions
GET https://lunchapi.hsuan.app/api/transactions
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
###
# Create
POST https://lunchapi.hsuan.app/api/transactions
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
{
"name" : "test",
"qty" : 2,
"store_id" : "{{store_id}}",
"product_id" : "{{product_id}}",
"comment" : "hi",
"options" : {
"麵體": "硬",
"口味": "辣"
}
}
> {%
client.global.set("transaction_id", response.body.id);
%}
###
# Show
GET https://lunchapi.hsuan.app/api/transactions/{{transaction_id}}
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}
###
#List Transactions
GET https://lunchapi.hsuan.app/api/transactions
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{auth_token}}