菜单

AB测试管理

注意:接入Api前请先熟悉api签名机制(参考接口鉴权说明), 即Api请求样例中的一些http请求头的来源

1. 获取A/B测试列表

1.1 请求URL

https://openapi.toponad.com/v3/abtest

1.2 请求方式

GET

1.3 请求参数

字段类型是否必传备注
app_idsArray[string]N应用ID列表,默认所有应用ID,数量最大限制为100
placement_idsArray[string]N广告位ID列表,数量最大限制为100
namestringNA/B测试名称
statusintN状态 1=已结束, 3=测试中,6=待生效
startintN起始偏移量,默认0
limitintN获取个数,默认15,最大一次性获取100

1.4 返回参数

字段类型是否必传备注
dataArray[Object]Y返回结果数据
data.idintYA/B测试的ID
data.app_idstringY应用ID
data.nameStringYA/B测试的名称
data.statusintY状态 1=已结束, 3=测试中,6=待生效
data.start_time_typeintY开始时间的类型 1=立即生效,2=指定生效时间
data.start_time_timezoneintY时区 -12~12 = 西12区 ~ 东12区
data.start_timeintY开始时间,时间戳
data.itemsArray[Object]Y实验分组
data.items.idintY实验分组的ID
data.items.nameintY实验分组的名称
data.items.traffic_variationintY实验分组的权重
data.items.enableboolY实验分组启用状态 false: 停用, true:启用中
data.placement_idsArray[string]Y测试广告位
data.choicesArray[Object]Y从A/B实验中停掉的广告位
data.choices.placement_idstringY广告位ID
data.choices.item_idintY停掉的广告位选择的实验分组ID
data.choices.item_namestringY停掉的广告位选择的实验分组名称

1.5 样例

请求样例:

curl --location --request GET 'https://openapi.toponad.com/v3/abtest?name=test' \
--header 'X-Up-Key: 877f8ae9c6e9ca82c0===b5fff594c373axxx' \
--header 'X-Up-Signature: CE12B506DBCD868C2C6F09E08C139CBC' \
--header 'X-Up-Timestamp: 1626056011000' \
--header 'Content-Type: application/json' \
--data-raw ''

返回样例:

{
    "page_info": {
        "total": 2,
        "start": 0,
        "limit": 15
    },
    "data": [
        {
            "id": 5815,
            "app_id": "a60f54770a583d",
            "name": "adbc",
            "status": 3,
            "start_time_type": 1,
            "start_time_timezone": 8,
            "start_time": 1627639246,
            "items": [
                {
                    "id": 10000080,
                    "name": "A\u7ec4",
                    "traffic_variation": 2,
                    "enable": false
                },
                {
                    "id": 10000081,
                    "name": "B\u7ec4",
                    "traffic_variation": 1,
                    "enable": false
                },
                {
                    "id": 10000082,
                    "name": "C\u7ec4",
                    "traffic_variation": 1,
                    "enable": false
                }
            ],
            "placement_ids": [
                "b60f6e9480e4ba"
            ],
            "choices": [
                {
                    "placement_id": "b60f547a595c75",
                    "item_id": 10000081,
                    "item_name": "B\u7ec4"
                }
            ]
        },
        {
            "id": 5814,
            "app_id": "a60f54770a583d",
            "name": "asbc",
            "status": 1,
            "start_time_type": 1,
            "start_time_timezone": 8,
            "start_time": 1627638003,
            "items": [
                {
                    "id": 10000077,
                    "name": "A\u7ec4",
                    "traffic_variation": 2,
                    "enable": false
                },
                {
                    "id": 10000078,
                    "name": "B\u7ec4",
                    "traffic_variation": 1,
                    "enable": false
                },
                {
                    "id": 10000079,
                    "name": "C\u7ec4",
                    "traffic_variation": 1,
                    "enable": false
                }
            ],
            "placement_ids": [],
            "choices": [
                {
                    "placement_id": "b60f547a595c75",
                    "item_id": 10000077,
                    "item_name": "A\u7ec4"
                },
                {
                    "placement_id": "b60f6e9480e4ba",
                    "item_id": 10000077,
                    "item_name": "A\u7ec4"
                }
            ]
        }
    ]
}

2. 创建A/B测试

2.1 请求URL

https://openapi.toponad.com/v3/abtest

2.2 请求方式

POST

2.3 请求参数

字段类型是否必传备注
namestringYA/B测试名称
app_idstringY应用ID
start_time_typeintY开始时间的类型 1=立即生效,2=指定生效时间
start_time_timezoneintY开始时间的时区 -12~12 = 西12区 ~ 东12区
start_timeintY开始时间,时间戳,立即生效时可以不填
placement_idsArray[String]Y测试广告位, 至少一个
itemsArray[Object]Y实验分组,至少两组
items.namestringY实验分组的名称
items.traffic_variationintY实验分组的权重

2.4 返回参数

字段类型是否必传备注
idintY成功时返回创建的ID,失败时无id

2.5 样例

请求样例:

curl --location --request POST 'https://openapi.toponad.com/v3/abtest' \
--header 'X-Up-Key: 877f8ae9c6e9ca82c0==5b5fff594c373axxx' \
--header 'X-Up-Signature: CE12B506DBCD868C2C6F09E08C139CBC' \
--header 'X-Up-Timestamp: 1626161553000' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "test_1",
    "app_id": "a60f54770a583d",
    "start_time_type": "1",
    "start_time_timezone": "8",
    "start_time": "1627639246",
    "items": [
                    {
                        "name": "AAA",
                        "traffic_variation": 10,
                    },
                    {
                       "name": "BBB",
                       "traffic_variation": 10,
                    },
    ],
    "placement_ids": [
                "b60f547a2904f9"
    ]
}'

返回样例:

{
    "id": 5816
}

3. 更新A/B测试

3.1 请求URL

https://openapi.toponad.com/v3/abtest/:id

3.2 请求方式

PUT

3.3 请求参数

字段类型是否必传备注
idintYA/B测试ID
namestringYA/B测试名称
start_time_typeintY开始时间的类型 1=立即生效,2=指定生效时间
start_time_timezoneintY开始时间的时区 -12~12 = 西12区 ~ 东12区
start_timeintY开始时间,时间戳,立即生效时可以不填
itemsArray[Object]Y实验分组(所有的实验组都需要上报)
items.idintY实验分组的ID
items.namestringY实验分组的名称
items.traffic_variationintY实验分组的权重
items.enableboolY实验分组启用状态 false: 停用, true:启用中
placement_idsArray[string]Y测试广告位
choicesArray[Object]N从A/B实验中停掉的广告位
choices.placement_idstringN广告位ID
choices.item_idintN停掉的广告位选择的实验分组ID
choices.item_namestringN停掉的广告位选择的实验分组名称

3.4 返回参数

字段类型是否必传备注
idintY

3.5 样例

请求样例:

curl --location --request PUT 'https://openapi.toponad.com/v3/abtest/5810' \
--header 'X-Up-Key: 877f8ae9c6e9ca82c0==5b5fff594c373axxx' \
--header 'X-Up-Signature: CE12B506DBCD868C2C6F09E08C139CBC' \
--header 'X-Up-Timestamp: 1626161553000' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "test_45678",
    "start_time_type": "2",
    "start_time_timezone": "8",
    "start_time": "1627639246",
    "items": [
                    {
                        "id" : 10000066,
                        "name": "AAA",
                        "traffic_variation": 10,
                        "enable": true
                    },
                    {
                        "id" : 10000067,
                        "name": "BBB",
                        "traffic_variation": 10,
                        "enable": true
                    },
    ],
    "placement_ids": [
                "b60f547a3d8b5d"
    ]
}'

返回样例:

{
    "id": 5810
}

4. 停用A/B测试

4.1 请求URL

https://openapi.toponad.com/v3/abtest/:id/stop

4.2 请求方式

PUT

4.3 请求参数

字段类型是否必传备注
placement_idstringY广告位ID
item_idintY停掉的广告位选择的实验分组ID

4.4 返回参数

字段类型是否必传备注
idintY

4.5 样例

请求样例:

curl --location --request PUT 'https://openapi.toponad.com/v3/abtest/5810/stop' \
--header 'X-Up-Key: 877f8ae9c6e9ca82c0==5b5fff594c373axxx' \
--header 'X-Up-Signature: CE12B506DBCD868C2C6F09E08C139CBC' \
--header 'X-Up-Timestamp: 1626161553000' \
--header 'Content-Type: application/json' \
--data-raw '{
    "choices" : [
        {
            "placement_id" : "b60f547a3d8b5d",
            "item_id" : 10000066,
        }
    ]
}'

返回样例:

{
    "id": 5810
}

5. 获取A/B测试详情

5.1 请求URL

https://openapi.toponad.com/v3/abtest/:id

5.2 请求方式

GET

5.3 请求参数

5.4 返回参数

字段类型是否必传备注
idintYA/B测试的ID
namestringYA/B测试名称
app_idstringY应用ID
statusintY状态 1=已结束, 3=测试中,6=待生效
start_time_typeintY开始时间的类型 1=立即生效,2=指定生效时间
start_time_timezoneintY开始时间的时区 -12~12 = 西12区 ~ 东12区
start_timeintY开始时间,时间戳
itemsArray[Object]Y实验分组
items.idintY实验分组的ID
items.namestringY实验分组的名称
items.traffic_variationintY实验分组的权重
items.enableboolY实验分组启用状态 false: 停用, true:启用中
placement_idsArray[string]Y测试广告位
choicesArray[Object]Y从A/B实验中停掉的广告位
choices.placement_idstringY广告位ID
choices.item_idintY停掉的广告位选择的实验分组ID
choices.item_namestringY停掉的广告位选择的实验分组名称

5.5 样例

请求样例:

url --location --request GET 'https://openapi.toponad.com/v3/abtest/5810' \
--header 'X-Up-Key: 877f8ae9c6e9ca82c0===b5fff594c373axxx' \
--header 'X-Up-Signature: CE12B506DBCD868C2C6F09E08C139CBC' \
--header 'X-Up-Timestamp: 1626056011000' \
--header 'Content-Type: application/json' \
--data-raw ''

返回样例:

{
    "id": 5810,
    "name": "test_45678",
    "publisher_id": 0,
    "app_id": "a60f54770a583d",
    "status": 3,
    "start_time_type": 1,
    "start_time_timezone": 8,
    "start_time": 1627635702,
    "items": [
        {
            "id": 10000066,
            "name": "AAA",
            "traffic_variation": 10,
            "enable": false
        },
        {
            "id": 10000067,
            "name": "BBB",
            "traffic_variation": 10,
            "enable": false
        }
    ],
    "placement_ids": [
        "b60f547a3d8b5d"
    ],
    "choices": [
        {
            "placement_id": "b60f547a2904f9",
            "item_id": 10000066,
            "item_name": "AAA"
        }
    ]
}


上一个
广告源管理(新版v3)
下一个
报表上传
最近修改: 2025-08-21Powered by