C#
using Auth0.ManagementApi;
using System.Threading.Tasks;
using Auth0.ManagementApi.Experimentation;
using System.Collections.Generic;
public partial class Examples
{
public async Task Example() {
var client = new ManagementApiClient(
token: "<token>",
clientOptions: new ClientOptions { BaseUrl = "https://{YOUR_DOMAIN}/api/v2" }
);
await client.Experimentation.Segments.CreateAsync(
new CreateSegmentRequestContent {
Name = "name",
Rules = new List<SegmentRule>(){
new SegmentRule(),
}
}
);
}
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.experimentation.types.CreateSegmentRequestContent;
import com.auth0.client.mgmt.types.SegmentRule;
import java.util.Arrays;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.experimentation().segments().create(
CreateSegmentRequestContent
.builder()
.name("name")
.rules(
Arrays.asList(
SegmentRule
.builder()
.build()
)
)
.build()
);
}
}<?php
namespace Example;
use Auth0\SDK\API\Management\Wrapper\ManagementClient;
use Auth0\SDK\API\Management\Wrapper\ManagementClientOptions;
use Auth0\SDK\API\Management\Experimentation\Segments\Requests\CreateSegmentRequestContent;
use Auth0\SDK\API\Management\Types\SegmentRule;
$client = new ManagementClient(new ManagementClientOptions(
domain: '{YOUR_DOMAIN}',
token: '<token>',
));
$client->experimentation->segments->create(
new CreateSegmentRequestContent([
'name' => 'name',
'rules' => [
new SegmentRule([]),
],
]),
);
from auth0.management import ManagementClient, SegmentRule
client = ManagementClient(
domain="{YOUR_DOMAIN}",
token="<token>",
)
client.experimentation.segments.create(
name="name",
rules=[
SegmentRule()
],
)
require "auth0"
client = Auth0::Management.new(token: "<token>", base_url: "https://{YOUR_DOMAIN}/api/v2")
client.experimentation.segments.create(
name: "name",
rules: [{}]
)
curl --request POST \
--url https://{tenantDomain}/api/v2/experimentation/segments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"rules": [
{
"match": {
"client_id": [
"<string>"
],
"connection": [
"<string>"
],
"connection_type": [
"<string>"
],
"organization_id": [
"<string>"
],
"domain": [
"<string>"
],
"device_type": [
"<string>"
],
"browser": [
"<string>"
],
"platform": [
"<string>"
],
"user_agent": [
"<string>"
],
"country": [
"<string>"
],
"region": [
"<string>"
]
},
"not_match": {
"client_id": [
"<string>"
],
"connection": [
"<string>"
],
"connection_type": [
"<string>"
],
"organization_id": [
"<string>"
],
"domain": [
"<string>"
],
"device_type": [
"<string>"
],
"browser": [
"<string>"
],
"platform": [
"<string>"
],
"user_agent": [
"<string>"
],
"country": [
"<string>"
],
"region": [
"<string>"
]
}
}
],
"description": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
rules: [
{
match: {
client_id: ['<string>'],
connection: ['<string>'],
connection_type: ['<string>'],
organization_id: ['<string>'],
domain: ['<string>'],
device_type: ['<string>'],
browser: ['<string>'],
platform: ['<string>'],
user_agent: ['<string>'],
country: ['<string>'],
region: ['<string>']
},
not_match: {
client_id: ['<string>'],
connection: ['<string>'],
connection_type: ['<string>'],
organization_id: ['<string>'],
domain: ['<string>'],
device_type: ['<string>'],
browser: ['<string>'],
platform: ['<string>'],
user_agent: ['<string>'],
country: ['<string>'],
region: ['<string>']
}
}
],
description: '<string>'
})
};
fetch('https://{tenantDomain}/api/v2/experimentation/segments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenantDomain}/api/v2/experimentation/segments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"match\": {\n \"client_id\": [\n \"<string>\"\n ],\n \"connection\": [\n \"<string>\"\n ],\n \"connection_type\": [\n \"<string>\"\n ],\n \"organization_id\": [\n \"<string>\"\n ],\n \"domain\": [\n \"<string>\"\n ],\n \"device_type\": [\n \"<string>\"\n ],\n \"browser\": [\n \"<string>\"\n ],\n \"platform\": [\n \"<string>\"\n ],\n \"user_agent\": [\n \"<string>\"\n ],\n \"country\": [\n \"<string>\"\n ],\n \"region\": [\n \"<string>\"\n ]\n },\n \"not_match\": {\n \"client_id\": [\n \"<string>\"\n ],\n \"connection\": [\n \"<string>\"\n ],\n \"connection_type\": [\n \"<string>\"\n ],\n \"organization_id\": [\n \"<string>\"\n ],\n \"domain\": [\n \"<string>\"\n ],\n \"device_type\": [\n \"<string>\"\n ],\n \"browser\": [\n \"<string>\"\n ],\n \"platform\": [\n \"<string>\"\n ],\n \"user_agent\": [\n \"<string>\"\n ],\n \"country\": [\n \"<string>\"\n ],\n \"region\": [\n \"<string>\"\n ]\n }\n }\n ],\n \"description\": \"<string>\"\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))
}{
"id": "<string>",
"name": "<string>",
"rules": [
{
"match": {
"client_id": [
"<string>"
],
"connection": [
"<string>"
],
"connection_type": [
"<string>"
],
"organization_id": [
"<string>"
],
"domain": [
"<string>"
],
"device_type": [
"<string>"
],
"browser": [
"<string>"
],
"platform": [
"<string>"
],
"user_agent": [
"<string>"
],
"country": [
"<string>"
],
"region": [
"<string>"
]
},
"not_match": {
"client_id": [
"<string>"
],
"connection": [
"<string>"
],
"connection_type": [
"<string>"
],
"organization_id": [
"<string>"
],
"domain": [
"<string>"
],
"device_type": [
"<string>"
],
"browser": [
"<string>"
],
"platform": [
"<string>"
],
"user_agent": [
"<string>"
],
"country": [
"<string>"
],
"region": [
"<string>"
]
}
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>"
}Create a segment for the Experiment Center.
Create a new segment with rule-based membership criteria for use in experiments.
POST
https://{tenantDomain}/api/v2
/
experimentation
/
segments
C#
using Auth0.ManagementApi;
using System.Threading.Tasks;
using Auth0.ManagementApi.Experimentation;
using System.Collections.Generic;
public partial class Examples
{
public async Task Example() {
var client = new ManagementApiClient(
token: "<token>",
clientOptions: new ClientOptions { BaseUrl = "https://{YOUR_DOMAIN}/api/v2" }
);
await client.Experimentation.Segments.CreateAsync(
new CreateSegmentRequestContent {
Name = "name",
Rules = new List<SegmentRule>(){
new SegmentRule(),
}
}
);
}
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.experimentation.types.CreateSegmentRequestContent;
import com.auth0.client.mgmt.types.SegmentRule;
import java.util.Arrays;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.domain("{YOUR_DOMAIN}")
.token("<token>")
.build();
client.experimentation().segments().create(
CreateSegmentRequestContent
.builder()
.name("name")
.rules(
Arrays.asList(
SegmentRule
.builder()
.build()
)
)
.build()
);
}
}<?php
namespace Example;
use Auth0\SDK\API\Management\Wrapper\ManagementClient;
use Auth0\SDK\API\Management\Wrapper\ManagementClientOptions;
use Auth0\SDK\API\Management\Experimentation\Segments\Requests\CreateSegmentRequestContent;
use Auth0\SDK\API\Management\Types\SegmentRule;
$client = new ManagementClient(new ManagementClientOptions(
domain: '{YOUR_DOMAIN}',
token: '<token>',
));
$client->experimentation->segments->create(
new CreateSegmentRequestContent([
'name' => 'name',
'rules' => [
new SegmentRule([]),
],
]),
);
from auth0.management import ManagementClient, SegmentRule
client = ManagementClient(
domain="{YOUR_DOMAIN}",
token="<token>",
)
client.experimentation.segments.create(
name="name",
rules=[
SegmentRule()
],
)
require "auth0"
client = Auth0::Management.new(token: "<token>", base_url: "https://{YOUR_DOMAIN}/api/v2")
client.experimentation.segments.create(
name: "name",
rules: [{}]
)
curl --request POST \
--url https://{tenantDomain}/api/v2/experimentation/segments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"rules": [
{
"match": {
"client_id": [
"<string>"
],
"connection": [
"<string>"
],
"connection_type": [
"<string>"
],
"organization_id": [
"<string>"
],
"domain": [
"<string>"
],
"device_type": [
"<string>"
],
"browser": [
"<string>"
],
"platform": [
"<string>"
],
"user_agent": [
"<string>"
],
"country": [
"<string>"
],
"region": [
"<string>"
]
},
"not_match": {
"client_id": [
"<string>"
],
"connection": [
"<string>"
],
"connection_type": [
"<string>"
],
"organization_id": [
"<string>"
],
"domain": [
"<string>"
],
"device_type": [
"<string>"
],
"browser": [
"<string>"
],
"platform": [
"<string>"
],
"user_agent": [
"<string>"
],
"country": [
"<string>"
],
"region": [
"<string>"
]
}
}
],
"description": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
rules: [
{
match: {
client_id: ['<string>'],
connection: ['<string>'],
connection_type: ['<string>'],
organization_id: ['<string>'],
domain: ['<string>'],
device_type: ['<string>'],
browser: ['<string>'],
platform: ['<string>'],
user_agent: ['<string>'],
country: ['<string>'],
region: ['<string>']
},
not_match: {
client_id: ['<string>'],
connection: ['<string>'],
connection_type: ['<string>'],
organization_id: ['<string>'],
domain: ['<string>'],
device_type: ['<string>'],
browser: ['<string>'],
platform: ['<string>'],
user_agent: ['<string>'],
country: ['<string>'],
region: ['<string>']
}
}
],
description: '<string>'
})
};
fetch('https://{tenantDomain}/api/v2/experimentation/segments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenantDomain}/api/v2/experimentation/segments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rules\": [\n {\n \"match\": {\n \"client_id\": [\n \"<string>\"\n ],\n \"connection\": [\n \"<string>\"\n ],\n \"connection_type\": [\n \"<string>\"\n ],\n \"organization_id\": [\n \"<string>\"\n ],\n \"domain\": [\n \"<string>\"\n ],\n \"device_type\": [\n \"<string>\"\n ],\n \"browser\": [\n \"<string>\"\n ],\n \"platform\": [\n \"<string>\"\n ],\n \"user_agent\": [\n \"<string>\"\n ],\n \"country\": [\n \"<string>\"\n ],\n \"region\": [\n \"<string>\"\n ]\n },\n \"not_match\": {\n \"client_id\": [\n \"<string>\"\n ],\n \"connection\": [\n \"<string>\"\n ],\n \"connection_type\": [\n \"<string>\"\n ],\n \"organization_id\": [\n \"<string>\"\n ],\n \"domain\": [\n \"<string>\"\n ],\n \"device_type\": [\n \"<string>\"\n ],\n \"browser\": [\n \"<string>\"\n ],\n \"platform\": [\n \"<string>\"\n ],\n \"user_agent\": [\n \"<string>\"\n ],\n \"country\": [\n \"<string>\"\n ],\n \"region\": [\n \"<string>\"\n ]\n }\n }\n ],\n \"description\": \"<string>\"\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))
}{
"id": "<string>",
"name": "<string>",
"rules": [
{
"match": {
"client_id": [
"<string>"
],
"connection": [
"<string>"
],
"connection_type": [
"<string>"
],
"organization_id": [
"<string>"
],
"domain": [
"<string>"
],
"device_type": [
"<string>"
],
"browser": [
"<string>"
],
"platform": [
"<string>"
],
"user_agent": [
"<string>"
],
"country": [
"<string>"
],
"region": [
"<string>"
]
},
"not_match": {
"client_id": [
"<string>"
],
"connection": [
"<string>"
],
"connection_type": [
"<string>"
],
"organization_id": [
"<string>"
],
"domain": [
"<string>"
],
"device_type": [
"<string>"
],
"browser": [
"<string>"
],
"platform": [
"<string>"
],
"user_agent": [
"<string>"
],
"country": [
"<string>"
],
"region": [
"<string>"
]
}
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>"
}Autorisations
bearerAuthoAuth2ClientCredentials
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Corps
application/jsonapplication/x-www-form-urlencoded
Create a segment for experiment targeting
A human-readable name for the segment
Required string length:
3 - 255Pattern:
^(?!.*\x00)\S(.*\S)?$An ordered list of rules. A segment matches if any rule matches.
Minimum array length:
1Show child attributes
Show child attributes
A description of the segment
Required string length:
3 - 1024Pattern:
^(?!.*\x00)\S(.*\S)?$⌘I