-
Notifications
You must be signed in to change notification settings - Fork 108
/
API_PLAYGROUND.http
73 lines (52 loc) · 1.6 KB
/
API_PLAYGROUND.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
##############################
# GROCERY ITEM CATEGORIES
##############################
GET http://localhost:3000/api/grocery/categories
##############################
# GROCERY ITEMS
##############################
GET http://localhost:3000/api/grocery/items
###
# By default this returns 10 items, but we can ask for more with the limit queryparam
GET http://localhost:3000/api/grocery/items?limit=2
###
# Or "offset" the list of results (i.e., for pagination)
GET http://localhost:3000/api/grocery/items?offset=10
###
# We can also filter by category
GET http://localhost:3000/api/grocery/items?category=fruit
##############################
# CURRENT SHOPPING CART
##############################
###
# You can set the contents of your shopping cart as follows.
PUT http://localhost:3000/api/cart/items HTTP/1.1
content-type: application/json
{"data":
[
{"groceryItem": { "id": 132 }, "qty": 9},
{"groceryItem": { "id": 134 }, "qty": 2},
{"groceryItem": { "id": 118 }, "qty": 1}
]
}
##############################
# ORDER
##############################
###
# Get a collection of orders in the system
GET http://localhost:3000/api/orders HTTP/1.1
###
# Get a a single orders in the system by ID
GET http://localhost:3000/api/orders/1 HTTP/1.1
###
# Create a new order. This will result in all cart items being removed
# and a new order being created (and returned)
POST http://localhost:3000/api/order HTTP/1.1
content-type: application/json
{"data":
[
{"groceryItem": { "id": 132 }, "qty": 9},
{"groceryItem": { "id": 134 }, "qty": 2},
{"groceryItem": { "id": 118 }, "qty": 1}
]
}