A/B testing API client (v2)
An updated version of the A/B testing API (v3) is available. For differences, compatibility, and migration guidance, see A/B testing API v2 vs v3.
The A/B testingV2 API client is part of the Algolia.Search package.
You can add this package to your Package.swift file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Algolia API clients",
platforms: [
.macOS(.v11)
],
dependencies: [
.package(
url: "https://github.com/algolia/algoliasearch-client-swift.git", from: "9.26.0")
],
targets: [
.executableTarget(
name: "Algolia API clients",
dependencies: [
.product(name: "AbtestingV2", package: "algoliasearch-client-swift")
]
)
]
)
To use the A/B testingV2 client, add this import to your files:
1
import Abtesting
To create an instance of the client:
1
let client = try AbtestingClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)
Make sure to use the region that matches your Algolia application’s analytics region:
region.us for the United States and region.de for Europe.
You can check your analytics region in the Infrastructure > Analytics section of the Algolia dashboard.
List of methods
Each method makes one request to the A/B testing API v2.
A/B testing
| client.listABTests | List all A/B tests |
| client.addABTests | Create an A/B test |
| client.getABTest | Retrieve A/B test details |
| client.deleteABTest | Delete an A/B test |
| client.stopABTest | Stop an A/B test |
| client.scheduleABTest | Schedule an A/B test |
| client.estimateABTest | Estimate the sample size and duration of an A/B test |