Create a new A/B test to optimize QR code performance by splitting traffic between multiple destination URLs or designs.
Body Parameters
The name of the A/B test.
The UUID of the primary QR code to test. You can retrieve this from the List QR Codes endpoint.
Array of variant configurations. At least 2 variants are required.
Name of the variant (e.g., “Control”, “Design B”).
variants[].destination_url
The destination URL for this variant.
variants[].traffic_weight
Percentage of traffic to route to this variant. Must sum to 100 if traffic_split_mode is ‘weighted’.
Optional description for the test.
How traffic is split. One of equal or weighted.
Minimum number of scans required before statistical significance is calculated.
Target confidence level percentage (e.g., 90, 95, 99).
Request Examples
cURL
Node.js
Python
Go
Java
curl -X POST https://jmpy.me/api/v1/qr-ab-tests \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Menu Layout Test",
"description": "Testing new vs old menu PDF",
"primary_qr_id": "qr_123456789",
"traffic_split_mode": "equal",
"variants": [
{
"name": "Original Menu",
"destination_url": "https://restaurant.com/menu-v1",
"traffic_weight": 50
},
{
"name": "New Menu",
"destination_url": "https://restaurant.com/menu-v2",
"traffic_weight": 50
}
]
}'
const response = await fetch('https://jmpy.me/api/v1/qr-ab-tests', {
method: 'POST',
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Menu Layout Test',
primary_qr_id: 'qr_123456789',
variants: [
{ "name": "Original Menu", "destination_url": "https://restaurant.com/menu-v1", "traffic_weight": 50 },
{ "name": "New Menu", "destination_url": "https://restaurant.com/menu-v2", "traffic_weight": 50 }
]
})
});
import requests
response = requests.post(
'https://jmpy.me/api/v1/qr-ab-tests',
headers={
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json'
},
json={
'name': 'Menu Layout Test',
'primary_qr_id': 'qr_123456789',
'variants': [
{'name': 'Original Menu', 'destination_url': 'https://restaurant.com/menu-v1', 'traffic_weight': 50},
{'name': 'New Menu', 'destination_url': 'https://restaurant.com/menu-v2', 'traffic_weight': 50}
]
}
)
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
url := "https://jmpy.me/api/v1/qr-ab-tests"
payload := map[string]interface{}{
"name": "Menu Layout Test",
"primary_qr_id": "qr_123456789",
"variants": []map[string]interface{}{
{"name": "Original Menu", "destination_url": "https://restaurant.com/menu-v1", "traffic_weight": 50},
{"name": "New Menu", "destination_url": "https://restaurant.com/menu-v2", "traffic_weight": 50},
},
}
jsonPayload, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
http.DefaultClient.Do(req)
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.URI;
import java.net.http.HttpResponse;
String json = "{ \"name\": \"Menu Layout Test\", \"primary_qr_id\": \"qr_123456789\", \"variants\": [...] }";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://jmpy.me/api/v1/qr-ab-tests"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
client.send(request, HttpResponse.BodyHandlers.ofString());
{
"test": {
"id": "test_987654321",
"user_id": "usr_55555",
"name": "Menu Layout Test",
"description": "Testing new vs old menu PDF",
"primary_qr_id": "qr_123456789",
"traffic_split_mode": "equal",
"min_sample_size": 100,
"confidence_level": 95,
"status": "draft",
"created_at": "2024-03-20T10:00:00Z",
"variants": [
{
"id": "var_1",
"test_id": "test_987654321",
"name": "Original Menu",
"destination_url": "https://restaurant.com/menu-v1",
"traffic_weight": 50
},
{
"id": "var_2",
"test_id": "test_987654321",
"name": "New Menu",
"destination_url": "https://restaurant.com/menu-v2",
"traffic_weight": 50
}
]
},
"message": "QR A/B test created successfully"
}
Create a new A/B test to optimize QR code performance by splitting traffic between multiple destination URLs or designs.
Body Parameters
The name of the A/B test.
The UUID of the primary QR code to test.
Array of variant configurations. At least 2 variants are required.
Name of the variant (e.g., “Control”, “Design B”).
variants[].destination_url
The destination URL for this variant.
variants[].traffic_weight
Percentage of traffic to route to this variant. Must sum to 100 if traffic_split_mode is ‘weighted’.
Optional description for the test.
How traffic is split. One of equal or weighted.
Minimum number of scans required before statistical significance is calculated.
Target confidence level percentage (e.g., 90, 95, 99).
curl -X POST https://jmpy.me/api/v1/qr-ab-tests \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Menu Layout Test",
"description": "Testing new vs old menu PDF",
"primary_qr_id": "qr_123456789",
"traffic_split_mode": "equal",
"variants": [
{
"name": "Original Menu",
"destination_url": "https://restaurant.com/menu-v1",
"traffic_weight": 50
},
{
"name": "New Menu",
"destination_url": "https://restaurant.com/menu-v2",
"traffic_weight": 50
}
]
}'
{
"test": {
"id": "test_987654321",
"user_id": "usr_55555",
"name": "Menu Layout Test",
"description": "Testing new vs old menu PDF",
"primary_qr_id": "qr_123456789",
"traffic_split_mode": "equal",
"min_sample_size": 100,
"confidence_level": 95,
"status": "draft",
"created_at": "2024-03-20T10:00:00Z",
"variants": [
{
"id": "var_1",
"test_id": "test_987654321",
"name": "Original Menu",
"destination_url": "https://restaurant.com/menu-v1",
"traffic_weight": 50
},
{
"id": "var_2",
"test_id": "test_987654321",
"name": "New Menu",
"destination_url": "https://restaurant.com/menu-v2",
"traffic_weight": 50
}
]
},
"message": "QR A/B test created successfully"
}