forked from seregazhuk/reactphp-restful-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
requests.http
85 lines (64 loc) · 1.65 KB
/
requests.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
### Get all products
GET http://localhost:8000/products
### Create a new product
POST http://localhost:8000/products
Authorization: Bearer {{token}}
Content-Type: multipart/form-data; boundary=RestApiBoundary
--RestApiBoundary
Content-Disposition: form/data; name="name"
MacBook Pro
--RestApiBoundary
Content-Disposition: form/data; name="price"
2800
--RestApiBoundary
Content-Disposition: form/data; name="image"; filename="dummy-product.png"
Content-Type: image/png
< dummy-product.png
--RestApiBoundary
### Get product by id
GET http://localhost:8000/products/42
### Update product by id
PUT http://localhost:8000/products/9
Content-Type: application/json
Authorization: Bearer {{token}}
{
"name": "MacBook Pro",
"price": "2900"
}
### Delete product by id
DELETE http://localhost:8000/products/1
Authorization: Bearer {{token}}
### Get all orders
GET http://localhost:8000/orders
Authorization: Bearer {{token}}
Authorization: Bearer {{token}}
### Create a new order
POST http://localhost:8000/orders
Content-Type: application/json
Authorization: Bearer {{token}}
{
"productId": 2,
"quantity": 1
}
### Get order by id
GET http://localhost:8000/orders/1
Authorization: Bearer {{token}}
### Delete order by id
DELETE http://localhost:8000/orders/1
Authorization: Bearer {{token}}
### Create a new user
POST http://localhost:8000/auth/signup
Content-Type: application/json
{
"email": "[email protected]",
"password" : "secret"
}
### Log in a user
POST http://localhost:8000/auth/signin
Content-Type: application/json
{
"email": "[email protected]",
"password" : "secret"
}
> {% client.global.set("token", response.body.token); %}
###