-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlaytesters.API.http
More file actions
142 lines (117 loc) · 4.06 KB
/
Playtesters.API.http
File metadata and controls
142 lines (117 loc) · 4.06 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
@host = http://localhost:5183
@adminKey = your-API-key
### ---------------------------------------------------------
### CREATE TESTER
### POST /api/testers
### ---------------------------------------------------------
POST {{host}}/api/testers
Content-Type: application/json
X-Api-Key: {{adminKey}}
{
"name": "NewTester123"
}
###
### ---------------------------------------------------------
### UPDATE TESTER (by name)
### PATCH /api/testers/{name}
###
### This endpoint allows partial updates to a tester:
### 1. "accessKey":
### - null => leave the current AccessKey unchanged
### - "" (empty) => revoke the AccessKey (sets it to null)
### - GUID => update AccessKey to the provided valid GUID
###
### 2. "name":
### - null => keep the current Name unchanged
### - non-empty => update the tester's Name (min length: 3)
### - invalid/empty/whitespace => returns 400 Bad Request
###
### 3. "totalHoursPlayed":
### - null => leave the current TotalHoursPlayed unchanged
### - >= 0 => update the tester's total hours played
### - < 0 => returns 400 Bad Request
### ---------------------------------------------------------
PATCH {{host}}/api/testers/Tester123
Content-Type: application/json
X-Api-Key: {{adminKey}}
{
"accessKey": ""
}
###
### ---------------------------------------------------------
### LIST ALL TESTERS
### GET /api/testers
###
### Optional Query Parameters:
### - orderBy: sorting strategy (case-insensitive).
### Allowed values:
### - CreatedAtAsc
### - CreatedAtDesc
### - TotalHoursPlayedAsc
### - TotalHoursPlayedDesc
### ---------------------------------------------------------
GET {{host}}/api/testers?orderBy=TotalHoursPlayedDesc
X-Api-Key: {{adminKey}}
###
### ---------------------------------------------------------
### VALIDATE ACCESS (Public)
### POST /api/testers/validate-access
###
### This endpoint checks whether a given tester's access key is valid.
### - If the key is valid, it returns the tester's name.
### - If the key is invalid or missing, it returns an error message.
### ---------------------------------------------------------
POST {{host}}/api/testers/validate-access
Content-Type: application/json
{
"accessKey": "some-guid-here"
}
###
### ---------------------------------------------------------
### UPDATE PLAYTIME (Public)
### PATCH /api/testers/{accessKey}/playtime
###
### Updates the total hours played for a tester.
### This endpoint is public and should be called by the Unity client
### to report how long the tester has been playing.
### The accessKey uniquely identifies the tester and must be provided
### in the URL path. The request increments the stored TotalHoursPlayed
### by the given value in hours (double).
### ---------------------------------------------------------
PATCH {{host}}/api/testers/{accessKey}/playtime
Content-Type: application/json
{
"hoursPlayed": "1.5"
}
###
### ---------------------------------------------------------
### GET ACCESS HISTORY (Paged + Optional Filters)
### GET /api/testers/access-history
###
### Optional Query Parameters:
### - name: filter by tester name
### - ipAddress: filter by IP
### - country: filter by country name
### - fromDate: start date (ISO 8601)
### - toDate: end date (ISO 8601)
### - pageNumber: page number
### - pageSize: results per page
###
### Example below uses all filters.
### ---------------------------------------------------------
GET {{host}}/api/testers/access-history?name=Tester123&ipAddress=127.0.0.1&fromDate=2024-01-01&toDate=2025-01-01&pageNumber=1&pageSize=20
X-Api-Key: {{adminKey}}
###
### ---------------------------------------------------------
### REVOKE ALL KEYS
### POST /api/testers/revoke-all-keys
###
### This endpoint revokes the AccessKey for all testers.
### - Idempotent: calling it multiple times has the same effect.
### - After calling it, all testers will have AccessKey = null.
### - No body is required.
### ---------------------------------------------------------
POST {{host}}/api/testers/revoke-all-keys
Content-Type: application/json
X-Api-Key: {{adminKey}}
###