-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-spec.yaml
More file actions
890 lines (844 loc) · 25.5 KB
/
api-spec.yaml
File metadata and controls
890 lines (844 loc) · 25.5 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
openapi: 3.0.0
info:
title: ABsmartly Collector API
version: 1.0.0
description: An OpenAPI Specification that describes the ABsmartly Collector API. This API is mainly used when using ABsmartly in a language that does not yet have a supported SDK.
contact:
name: API Support
email: api@absmartly.com
license:
name: Proprietary
externalDocs:
description: Find out more about ABsmartly
url: "https://www.absmartly.com"
servers:
- url: https://sandbox.absmartly.io/v1
security:
- ApiKey: []
tags:
- name: context
description: Context API
- name: experiment
description: Experiment API
paths:
/healthy:
get:
tags:
- collector
summary: Check Service Health
description: A GET request to check that the service is running as expected.
operationId: collectorHealthCheck
responses:
200:
description: Server is healthy
500:
description: Server is not healthy
/context:
get:
tags:
- context
summary: Get Context Experiment Data
description: A GET request for obtaining data on your experiments.
operationId: contextGet
parameters:
- name: environment
in: query
required: false
description: An environment to filter the results by. These can be found and created in your ABsmartly Web Console settings.
example: development
schema:
type: string
- name: application
in: query
required: false
description: An application to filter the results by. These can be found and created in your ABsmartly Web Console settings.
example: www
schema:
type: string
responses:
200:
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/ContextGetResponse"
400:
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
401:
description: Unauthorized
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
tags:
- context
summary: Create a Context
description: A POST request for creating a new context and assigning variants to your users.
operationId: contextCreate
parameters:
- name: X-Agent
in: header
required: true
description: The User-Agent of your SDK.
example: absmartly-Java-SDK v1.0.1
schema:
type: string
- name: X-Environment
in: header
required: true
description: The environment in which you are running your experiments. These can be found and created in your ABsmartly Web Console settings.
example: development
schema:
type: string
- name: X-Application
in: header
required: true
description: The application in which you are running your experiments. These can be found and created in your ABsmartly Web Console settings.
example: www
schema:
type: string
- name: X-Application-Version
in: header
required: true
description: The application version which you are running your experiments on.
example: 0
schema:
type: integer
format: int64
requestBody:
required: true
description: |
Units data for which to create the context and variant assignments. Unit types can be found and created in your ABsmartly Web Console settings.
```json
{
"type": "user_id" // The name of the unit type
"uid": "4a42766ca6313d26f49985e799ff4f3790fb86efa0fce46edb3ea8fbf1ea3408" // The value of the unit that you are tracking.
}
```
content:
application/json:
schema:
$ref: "#/components/schemas/ContextRequest"
responses:
200:
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/ContextResponse"
400:
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
401:
description: Unauthorized
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
put:
tags:
- context
summary: Publish Experiment Events
description: A PUT request for publishing your exposures, goals and attributes.
operationId: contextPublish
parameters:
- name: X-Agent
in: header
required: true
description: The User-Agent of your SDK.
example: absmartly-Java-SDK v1.0.1
schema:
type: string
- name: X-Environment
in: header
required: true
description: The environment in which you are running your experiments. These can be found and created in your ABsmartly Web Console settings.
example: development
schema:
type: string
- name: X-Application
in: header
required: true
description: The application in which you are running your experiments. These can be found and created in your ABsmartly Web Console settings.
example: www
schema:
type: string
- name: X-Application-Version
in: header
required: true
description: The application version which you are running your experiments on.
example: 0
schema:
type: integer
format: int64
requestBody:
required: true
description: |
The data to be published.
**Hashed**
The hashed value describes whether your values have already been hashed, or if they are to be hashed by the Collector.
**Historic**
The historic value tells the Collector whether this is new or old data.
**Published At**
The publishedAt value is the time at which the request was made.
**Units**
Units are the values which are used to choose the variant
assignments for each user. Unit types can be found and created in
your ABsmartly Web Console settings. The payload takes the form of:
```json
{
"type": "user_id" // The name of the unit type
"uid": "4a42766ca6313d26f49985e799ff4f3790fb86efa0fce46edb3ea8fbf1ea3408" // The value of the unit that you are tracking.
}
```
**Exposures**
Exposures tell the collector information about which variant of an experiment was shown to the user, and when:
```json
{
"id": 3, // The ID of the exposed experiment.
"name": "exp_banner_color", // The name of the exposed experiment.
"unit": "user_id", // The unit that was used together with the experiment seed to generate the variant.
"variant": 1, // The variant that was shown.
"exposedAt": 1609244179528, // The time at which the exposure happened.
"assigned": true, // Whether the user was exposed to the experiment in this specific request, it could be that the user was not assigned because it doesn’t match the audience, or the experiment is already fullOn, or the variant was overriden, etc.
"eligible": true, // Whether the experiment is in the right part of the traffic allocation to this experiment and can be triggered.
"overridden": false, // Whether the variant was overridden or not.
"fullOn": false, // True if this experiment is fullOn and the winning variant is being forced to everyone.
"custom": false, // Whether this variant was a custom assignment.
"audienceMismatch": false // Whether this variant was shown outside of it’s specified target audience.
}
```
**Goals**
Goals are used to track various metrics that are related to your
experiment. Goals can be created and found in your ABsmartly Web
Console settings:
```json
{
"name": "banner_click", // The name of the goal that you are tracking.
"achievedAt": 1609254179528, // The time that the goal was achieved.
"properties": {} // Any properties that you wish to pass along with this goal.
}
```
**Attributes**
Attributes allow for segmentation of your data on the Web Console:
```json
{
"name": "age", // The name of the attribute.
"value": 39, // The attribute's value.
"setAt": 1609244179528 // The time at which the value was set.
}
```
content:
application/json:
schema:
$ref: "#/components/schemas/PublishRequest"
responses:
200:
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/PublishResponse"
400:
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/PublishResponse"
401:
description: Unauthorized
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/context/batch:
put:
tags:
- context
- batch
summary: Publish Experiment Events for Multiple Contexts
description: A PUT request for publishing your exposures, goals and attributes from multiple contexts.
operationId: contextPublishBatch
parameters:
- name: X-Agent
in: header
required: true
description: The User-Agent of your SDK.
example: absmartly-Java-SDK v1.0.1
schema:
type: string
- name: X-Environment
in: header
required: true
description: The environment in which you are running your experiments. These can be found and created in your ABsmartly Web Console settings.
example: development
schema:
type: string
- name: X-Application
in: header
required: true
description: The application in which you are running your experiments. These can be found and created in your ABsmartly Web Console settings.
example: www
schema:
type: string
- name: X-Application-Version
in: header
required: true
description: The application version which you are running your experiments on.
example: 0
schema:
type: integer
format: int64
requestBody:
required: true
description: |
An array of data to publish.
**Hashed**
The hashed value describes whether your values have already been hashed, or if they are to be hashed by the Collector.
**Historic**
The historic value tells the Collector whether this is new or old data.
**Published At**
The publishedAt value is the time at which the request was made.
**Units**
Units are the values which are used to choose the variant
assignments for each user. Unit types can be found and created in
your ABsmartly Web Console settings. The payload takes the form of:
```json
{
"type": "user_id" // The name of the unit type
"uid": "4a42766ca6313d26f49985e799ff4f3790fb86efa0fce46edb3ea8fbf1ea3408" // The value of the unit that you are tracking.
}
```
**Exposures**
Exposures tell the collector information about which variant of an experiment was shown to the user, and when:
```json
{
"id": 3, // The ID of the exposed experiment.
"name": "exp_banner_color", // The name of the exposed experiment.
"unit": "user_id", // The unit that was used together with the experiment seed to generate the variant.
"variant": 1, // The variant that was shown.
"exposedAt": 1609244179528, // The time at which the exposure happened.
"assigned": true, // Whether the user was exposed to the experiment in this specific request, it could be that the user was not assigned because it doesn’t match the audience, or the experiment is already fullOn, or the variant was overriden, etc.
"eligible": true, // Whether the experiment is in the right part of the traffic allocation to this experiment and can be triggered.
"overridden": false, // Whether the variant was overridden or not.
"fullOn": false, // True if this experiment is fullOn and the winning variant is being forced to everyone.
"custom": false, // Whether this variant was a custom assignment.
"audienceMismatch": false // Whether this variant was shown outside of it’s specified target audience.
}
```
**Goals**
Goals are used to track various metrics that are related to your
experiment. Goals can be created and found in your ABsmartly Web
Console settings:
```json
{
"name": "banner_click", // The name of the goal that you are tracking.
"achievedAt": 1609254179528, // The time that the goal was achieved.
"properties": {} // Any properties that you wish to pass along with this goal.
}
```
**Attributes**
Attributes allow for segmentation of your data on the Web Console:
```json
{
"name": "age", // The name of the attribute.
"value": 39, // The attribute's value.
"setAt": 1609244179528 // The time at which the value was set.
}
```
content:
application/json:
schema:
$ref: "#/components/schemas/PublishBatchRequest"
responses:
200:
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/PublishResponse"
400:
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/PublishResponse"
401:
description: Unauthorized
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/experiment:
get:
tags:
- experiment
operationId: experimentGet
summary: Get Experiment Data
description: A GET request for obtaining data on all running experiments.
parameters:
- name: X-Agent
in: header
required: true
description: The User-Agent of your SDK.
example: absmartly-Java-SDK v1.0.1
schema:
type: string
- name: X-Environment
in: header
required: true
description: The environment in which you are running your experiments. These can be found and created in your ABsmartly Web Console settings.
example: development
schema:
type: string
- name: X-Application
in: header
required: true
description: The application in which you are running your experiments. These can be found and created in your ABsmartly Web Console settings.
example: www
schema:
type: string
- name: X-Application-Version
in: header
required: true
description: The application version which you are running your experiments on.
example: 0
schema:
type: integer
format: int64
responses:
200:
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/ExperimentsResponse"
401:
description: Unauthorized
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
ExperimentAssignment:
type: object
required:
- id
- iteration
- name
- variant
- eligible
- config
properties:
id:
type: integer
format: int32
minimum: 0
example: 3
iteration:
type: integer
format: int32
minimum: 0
example: 2
name:
type: string
example: exp_banner_color
variant:
type: integer
format: int32
minimum: 0
maximum: 127
example: 1
eligible:
type: boolean
example: true
audienceMismatch:
type: boolean
example: false
originalVariant:
type: integer
format: int32
minimum: 0
maximum: 127
example: 1
config:
type: string
nullable: true
Unit:
type: object
required:
- type
properties:
type:
type: string
example: user_id
uid:
type: string
minLength: 1
maxLength: 640
example: 4a42766ca6313d26f49985e799ff4f3790fb86efa0fce46edb3ea8fbf1ea3408
Exposure:
type: object
description: Hello world
required:
- id
- name
- variant
- exposedAt
- assigned
- eligible
properties:
id:
type: integer
format: int32
minimum: 0
example: 3
name:
type: string
example: exp_banner_color
unit:
type: string
nullable: true
example: user_id
variant:
type: integer
format: int32
minimum: 0
maximum: 128
example: 1
exposedAt:
type: integer
format: int64
example: 1609244179528
assigned:
type: boolean
example: true
eligible:
type: boolean
example: true
overridden:
type: boolean
example: false
fullOn:
type: boolean
example: false
custom:
type: boolean
example: false
audienceMismatch:
type: boolean
example: false
GoalAchievement:
type: object
required:
- name
- achievedAt
properties:
name:
type: string
example: banner_click
achievedAt:
type: integer
format: int64
example: 1609254179528
properties:
type: object
nullable: true
Attribute:
type: object
required:
- name
- setAt
properties:
name:
type: string
example: age
value:
example: 39
nullable: true
setAt:
type: integer
format: int64
example: 1609244179528
Experiment:
type: object
required:
- id
- name
- iteration
- split
- trafficSplit
- variants
properties:
id:
type: integer
example: 123
name:
type: string
example: exp_banner_color
iteration:
type: integer
example: 0
split:
type: array
items:
type: number
format: double
example: [0.5, 0.5]
trafficSplit:
type: array
items:
type: number
format: double
example: [0.0, 1.0]
variants:
type: array
items:
$ref: "#/components/schemas/ExperimentVariant"
ExperimentVariant:
type: object
required:
- name
properties:
name:
type: string
example: treatment
config:
type: string
nullable: true
example: '{"color":"red"}'
ContextRequest:
type: object
required:
- units
properties:
units:
type: array
items:
$ref: "#/components/schemas/Unit"
ContextResponse:
type: object
required:
- units
- assignments
properties:
units:
type: array
items:
$ref: "#/components/schemas/Unit"
assignments:
type: array
items:
$ref: "#/components/schemas/ExperimentAssignment"
ContextGetResponse:
type: object
required:
- experiments
properties:
experiments:
type: array
items:
$ref: "#/components/schemas/ContextExperiment"
ContextExperiment:
type: object
required:
- id
- name
- iteration
- unitType
- environment
- seed
- split
- trafficSeed
- trafficSplit
- fullOnVariant
- applications
- variants
- audience
- audienceStrict
properties:
id:
type: integer
example: 123
name:
type: string
example: exp_banner_color
iteration:
type: integer
example: 0
unitType:
type: string
example: user_id
environment:
type: string
example: production
seed:
type: integer
format: int64
example: 9453674179528
split:
type: array
items:
type: number
format: double
example: [0.5, 0.5]
trafficSeed:
type: integer
format: int64
example: -56241591889905
trafficSplit:
type: array
items:
type: number
format: double
example: [0.0, 1.0]
fullOnVariant:
type: integer
format: int32
minimum: 0
maximum: 127
example: 1
applications:
type: array
items:
$ref: "#/components/schemas/ExperimentApplication"
variants:
type: array
items:
$ref: "#/components/schemas/ExperimentVariant"
audience:
type: string
example: '{ "filter": [{ "gt": [{ "var": "age" }, { "value": 20 }] }] }'
audienceStrict:
type: boolean
example: false
ExperimentApplication:
type: object
required:
- name
properties:
name:
type: string
example: website
PublishRequest:
type: object
required:
- units
- publishedAt
properties:
hashed:
type: boolean
nullable: true
default: false
historic:
type: boolean
nullable: true
default: false
publishedAt:
type: integer
format: int64
example: 1609244179528
units:
type: array
items:
$ref: "#/components/schemas/Unit"
exposures:
type: array
items:
$ref: "#/components/schemas/Exposure"
goals:
type: array
items:
$ref: "#/components/schemas/GoalAchievement"
attributes:
type: array
items:
$ref: "#/components/schemas/Attribute"
PublishResponseMessage:
type: object
required:
- batchIndex
- eventIndex
- subject
- message
properties:
batchIndex:
type: integer
eventIndex:
type: integer
subject:
type: string
message:
type: string
PublishResponse:
type: object
required:
- ok
properties:
ok:
type: boolean
warnings:
type: array
items:
$ref: "#/components/schemas/PublishResponseMessage"
errors:
type: array
items:
$ref: "#/components/schemas/PublishResponseMessage"
PublishBatchRequest:
type: object
required:
- requests
properties:
requests:
type: array
minItems: 1
maxItems: 500
items:
$ref: "#/components/schemas/PublishRequest"
ExperimentsResponse:
type: object
required:
- ok
- experiments
properties:
experiments:
type: array
items:
$ref: "#/components/schemas/Experiment"
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int64
message:
type: string
securitySchemes:
ApiKey:
type: apiKey
name: X-API-Key
in: header
required: true