-
Notifications
You must be signed in to change notification settings - Fork 19
/
api.http
75 lines (53 loc) · 1.81 KB
/
api.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
##################################################################
# VS Code with REST Client extension is needed to use this file.
# Download at: https://aka.ms/vscode/rest-client
##################################################################
@settings_api_host = http://localhost:4001
@dice_api_host = http://localhost:4002
@gateway_host = http://localhost:4003
@user_id = test123
# Base64 of { "userId": "test123" }
# You can use https://www.base64encode.org/ to generate your own
@client_principal = eyAidXNlcklkIjogInRlc3QxMjMiIH0=
##################################################################
# Settings API
##################################################################
# Get user settings
GET {{settings_api_host}}/settings/{{user_id}}
###
# Update user settings
PUT {{settings_api_host}}/settings/{{user_id}}
content-type: application/json
{ "sides": 12 }
##################################################################
# Dice API
##################################################################
# Roll dice
POST {{dice_api_host}}/rolls
content-type: application/json
{ "sides": 6 }
###
# Get roll history
GET {{dice_api_host}}/rolls/history?max=8&sides=6
##################################################################
# Gateway API
##################################################################
# Get user settings
GET {{gateway_host}}/api/settings
x-ms-client-principal: {{client_principal}}
###
# Update user settings
PUT {{gateway_host}}/api/settings
content-type: application/json
x-ms-client-principal: {{client_principal}}
{ "sides": 8 }
###
# Roll dices
POST {{gateway_host}}/api/rolls
content-type: application/json
x-ms-client-principal: {{client_principal}}
{ "count": 10 }
###
# Get roll history
GET {{gateway_host}}/api/rolls/history?max=10
x-ms-client-principal: {{client_principal}}