Skip to content

Commit d53060d

Browse files
febeckmillotp
andauthoredAug 20, 2024··
feat(specs): add /schedule endpoint (#3350)
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
1 parent 9d62976 commit d53060d

File tree

5 files changed

+117
-0
lines changed

5 files changed

+117
-0
lines changed
 

‎specs/abtesting/common/parameters.yml

+10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ abTestID:
1818
description: Unique A/B test identifier.
1919
example: 224
2020

21+
abTestScheduleID:
22+
type: integer
23+
description: Unique scheduled A/B test identifier.
24+
example: 224
25+
2126
endAt:
2227
type: string
2328
description: End date and time of the A/B test, in RFC 3339 format.
@@ -33,6 +38,11 @@ updatedAt:
3338
description: Date and time when the A/B test was last updated, in RFC 3339 format.
3439
example: 2023-06-15T15:06:44.400601Z
3540

41+
scheduledAt:
42+
type: string
43+
description: Date and time when the A/B test is scheduled to start, in RFC 3339 format.
44+
example: 2023-06-15T15:06:44.400601Z
45+
3646
name:
3747
type: string
3848
description: A/B test name.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ScheduleABTestResponse:
2+
type: object
3+
additionalProperties: false
4+
properties:
5+
abTestScheduleID:
6+
$ref: '../parameters.yml#/abTestScheduleID'
7+
required:
8+
- abTestScheduleID
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
post:
2+
tags:
3+
- abtest
4+
operationId: scheduleABTest
5+
x-acl:
6+
- editSettings
7+
summary: Schedule an A/B test
8+
description: |
9+
Schedule an A/B test to be started at a later time.
10+
requestBody:
11+
required: true
12+
content:
13+
application/json:
14+
schema:
15+
title: scheduleABTestsRequest
16+
type: object
17+
additionalProperties: false
18+
properties:
19+
name:
20+
$ref: '../common/parameters.yml#/name'
21+
variants:
22+
type: array
23+
description: A/B test variants.
24+
minItems: 2
25+
maxItems: 2
26+
items:
27+
$ref: '../common/schemas/AddABTestsVariant.yml#/AddABTestsVariant'
28+
scheduledAt:
29+
$ref: '../common/parameters.yml#/scheduledAt'
30+
endAt:
31+
$ref: '../common/parameters.yml#/endAt'
32+
required:
33+
- name
34+
- variants
35+
- scheduledAt
36+
- endAt
37+
responses:
38+
'200':
39+
description: OK
40+
headers:
41+
x-ratelimit-limit:
42+
$ref: '../../common/responses/rateLimit.yml#/x-ratelimit-limit'
43+
x-ratelimit-remaining:
44+
$ref: '../../common/responses/rateLimit.yml#/x-ratelimit-remaining'
45+
x-ratelimit-reset:
46+
$ref: '../../common/responses/rateLimit.yml#/x-ratelimit-reset'
47+
content:
48+
application/json:
49+
schema:
50+
$ref: '../common/schemas/ScheduleABTestResponse.yml#/ScheduleABTestResponse'
51+
'400':
52+
$ref: '../../common/responses/BadRequest.yml'
53+
'402':
54+
$ref: '../../common/responses/FeatureNotEnabled.yml'
55+
'403':
56+
$ref: '../../common/responses/MethodNotAllowed.yml'
57+
'404':
58+
$ref: '../../common/responses/IndexNotFound.yml'

‎specs/abtesting/spec.yml

+2
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,5 @@ paths:
9696
$ref: 'paths/abtest.yml'
9797
/2/abtests/{id}/stop:
9898
$ref: 'paths/stopABTest.yml'
99+
/2/abtests/schedule:
100+
$ref: 'paths/scheduleABTest.yml'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[
2+
{
3+
"testName": "scheduleABTest with minimal parameters",
4+
"parameters": {
5+
"endAt": "2022-12-31T00:00:00.000Z",
6+
"scheduledAt": "2022-11-31T00:00:00.000Z",
7+
"name": "myABTest",
8+
"variants": [
9+
{
10+
"index": "AB_TEST_1",
11+
"trafficPercentage": 30
12+
},
13+
{
14+
"index": "AB_TEST_2",
15+
"trafficPercentage": 50
16+
}
17+
]
18+
},
19+
"request": {
20+
"path": "/2/abtests/schedule",
21+
"method": "POST",
22+
"body": {
23+
"endAt": "2022-12-31T00:00:00.000Z",
24+
"scheduledAt": "2022-11-31T00:00:00.000Z",
25+
"name": "myABTest",
26+
"variants": [
27+
{
28+
"index": "AB_TEST_1",
29+
"trafficPercentage": 30
30+
},
31+
{
32+
"index": "AB_TEST_2",
33+
"trafficPercentage": 50
34+
}
35+
]
36+
}
37+
}
38+
}
39+
]

0 commit comments

Comments
 (0)
Please sign in to comment.