For server-side labs, A/B Testing provides a REST API for traffic splitting. The A/B Testing component also records flow logs. These logs serve as the data foundation for subsequent metric calculations.
Request
API endpoint: /rest/abtest
Method: GET
Parameters:
Parameter name
Required
Notes
Example
appId
Yes
The application ID in mPaaS.
-
workspaceId
Yes
The workspace ID in mPaaS.
-
entranceKey
Yes
The lab ID entered when creating a server-side experiment.
-
divertValue
Yes
User ID or device ID.
-
appVersion
No
The client version number.
1.0.9.12
osType
No
The operating system type (platform type). Enumeration values include android, ios, and all.
-
osVersion
No
The client operating system version number.
6.1.4
devType
No
The client device model.
-
Response
Header
Content-Type: application/json;charset=UTF-8
Body
The body is in the following format:
{
"errCode": "",
"errMsg": "",
"result": {
"expVersionId": "3",
"labId": "2",
"resType": "DO_GREY_AB",
"variableInfoMap": {
"var1": {
"description": "var1",
"key": "var1",
"mdsId": "",
"name": "var1",
"value": "old",
"variableType": 2
}
}
},
"success": true
}Body field descriptions:
errMsg: The reason for the error if the
successvalue is false.result: The traffic splitting result.
expVersionId: The ID of the experiment version that is assigned the traffic when an experiment is hit. You can record this ID in your business system. When a conversion behavior occurs, record the relationship between
divertValue(user ID or device ID) andexpVersionId. After you merge this log with the flow log, you can perform custom metric analysis.labId: The auto-increment ID of the lab. This is not commonly used.
resType: The type of experiment traffic splitting, which can be one of the following:
DO_NOTHING: The traffic did not hit a grayscale release or an experiment, and was not split.
DO_GREY: The traffic hit a grayscale release.
DO_GREY_AB: The traffic hit an experiment.
variableInfoMap: A map of variables attached to the experiment. The map's key is the variable name. The map's
valueis an object that contains akeyfield (the variable name) and avaluefield (the traffic splitting result for that variable).
success: Indicates whether the traffic splitting request was successful. A value of `true` indicates success, and a value of `false` indicates failure.