AB Testing: Add User to Experiment
curl --request POST \
--url https://backend.nebuly.com/api/external/add-user-to-experiment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user": "<string>",
"experiment_flag_name": "<string>",
"assignment_probability": 123
}
'import requests
url = "https://backend.nebuly.com/api/external/add-user-to-experiment"
payload = {
"user": "<string>",
"experiment_flag_name": "<string>",
"assignment_probability": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user: '<string>',
experiment_flag_name: '<string>',
assignment_probability: 123
})
};
fetch('https://backend.nebuly.com/api/external/add-user-to-experiment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://backend.nebuly.com/api/external/add-user-to-experiment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'user' => '<string>',
'experiment_flag_name' => '<string>',
'assignment_probability' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://backend.nebuly.com/api/external/add-user-to-experiment"
payload := strings.NewReader("{\n \"user\": \"<string>\",\n \"experiment_flag_name\": \"<string>\",\n \"assignment_probability\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://backend.nebuly.com/api/external/add-user-to-experiment")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user\": \"<string>\",\n \"experiment_flag_name\": \"<string>\",\n \"assignment_probability\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://backend.nebuly.com/api/external/add-user-to-experiment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user\": \"<string>\",\n \"experiment_flag_name\": \"<string>\",\n \"assignment_probability\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": true
}AB Testing: Add User to Experiment
POST
/
api
/
external
/
add-user-to-experiment
AB Testing: Add User to Experiment
curl --request POST \
--url https://backend.nebuly.com/api/external/add-user-to-experiment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user": "<string>",
"experiment_flag_name": "<string>",
"assignment_probability": 123
}
'import requests
url = "https://backend.nebuly.com/api/external/add-user-to-experiment"
payload = {
"user": "<string>",
"experiment_flag_name": "<string>",
"assignment_probability": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user: '<string>',
experiment_flag_name: '<string>',
assignment_probability: 123
})
};
fetch('https://backend.nebuly.com/api/external/add-user-to-experiment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://backend.nebuly.com/api/external/add-user-to-experiment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'user' => '<string>',
'experiment_flag_name' => '<string>',
'assignment_probability' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://backend.nebuly.com/api/external/add-user-to-experiment"
payload := strings.NewReader("{\n \"user\": \"<string>\",\n \"experiment_flag_name\": \"<string>\",\n \"assignment_probability\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://backend.nebuly.com/api/external/add-user-to-experiment")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user\": \"<string>\",\n \"experiment_flag_name\": \"<string>\",\n \"assignment_probability\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://backend.nebuly.com/api/external/add-user-to-experiment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user\": \"<string>\",\n \"experiment_flag_name\": \"<string>\",\n \"assignment_probability\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": true
}Add a user to an existing A/B testing experiment.
Body
string
required
The identifier of the user to add to the experiment
string
required
The unique flag name assigned to the experiment
number
The sampling rate for assigning users to the experiment (between 0 and 1). If not provided, the sample rate specified in the UI will be used. Set to 1 to assign all new users to the experiment.
Response
boolean
Indicates if the user was successfully added to the experiment