---
schema_version: "1"
id: 7e57e54ce33d9b3e07dff06cf9a5c456d9f2d87a284e04340134683dcf12c282
title: Data A/B Tests (deprecated)
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/b2c-commerce/references/generated-api-specs/ocapi-data-ab-tests.md
canonical_url: https://developer.salesforce.com/docs/commerce/b2c-commerce/references/ocapi-data-ab-tests
source_site: developer.salesforce.com
content_type: documentation
content_hash: 195055e858c875ce6a733145493e1994f76fc4c034f4d48e1992c4c3f996d145
products:
  - B2C Commerce
  - Salesforce APIs
---
Data A/B Tests (deprecated)

# Data A/B Tests (deprecated)

Data API endpoints enable developers to build applications for merchants: Create, update, delete business objects, like products, customers, pricing and promotions or assignments. They typically provide read and write access and are designed for moderate usage.

**Version:** 25.6

## Servers

*   `https://{host}/s/-/dw/data/v25_6`

Protocols: https.

## Security

*   `oauth2_application` (oauth2) Authentication flow with client ID and password with account manager.
    *   OAuth flow application (tokenUrl: https://account.demandware.com:443/dwsso/oauth2/access\_token)
    *   Scope x-info: Scopes are NOT supported. This is just a dummy, because the 'scopes' field is required.
*   `client_id` (apiKey) Add client ID for application identification. Alternative as 'client\_id' query parameter.
    *   API key in header: x-dw-client-id

## Operations

### GET Get AB/Tests

`GET /sites/{site_id}/ab_tests`

Operation ID: `Get AB/Tests`. Tags: sites. Security: oauth2\_application.

Action to get all the A/B tests with searching.

#### Parameters

*   `site_id` (path, string, required) ID of the site that the A/B tests are contained within.  
    Minimum length: 1. Maximum length: 256.
*   `start` (query, integer (int32)) Optional start index for retrieving the items from a given index (default 0).  
    Minimum: 0.
*   `count` (query, integer (int32)) Optional count for retrieving only a subset of the items (default is 25).  
    Minimum: 0.
*   `select` (query, string) The property selector.

#### Responses

*   **default**
    
    Media type: `application/json, text/xml`. Schema: `ab_tests`.
    

### PUT Bind Promotion to A/B Test

`PUT /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/promotions/{promotion_id}`

Operation ID: `Bind Promotion to A/B Test`. Tags: sites. Security: oauth2\_application.

Action to bind a single promotion to a given abTest.

This endpoint may return the following faults:

*   404 - ABTestNotFoundException - Indicates that the abTest with the given abTest ID is not found.
*   404 - ABTestSegmentNotFoundException - thrown when the segment with the given id is not found.
*   404 - PromotionNotFoundException - Indicates that the promotion with the given promotion ID is not found.
*   404 - SiteNotFoundException - thrown when the site with the given id is not found.

#### Parameters

*   `site_id` (path, string, required) The ID of the site that contains the abTest and promotion.  
    Minimum length: 1.
*   `ab_test_id` (path, string, required) The ID of the abTest which contains the segment.  
    Minimum length: 1.
*   `segment_id` (path, string, required) The ID of the segment to to which the promotion is to be assigned.  
    Minimum length: 1.
*   `promotion_id` (path, string, required) The ID of the promotion that is to be assigned to the abTest.  
    Minimum length: 1.

#### Responses

*   **204**
*   **404** `ABTestNotFoundException` - Indicates that the abTest with the given abTest ID is not found. or `ABTestSegmentNotFoundException` - thrown when the segment with the given id is not found. or `PromotionNotFoundException` - Indicates that the promotion with the given promotion ID is not found. or `SiteNotFoundException` - thrown when the site with the given id is not found.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    

### DELETE Unbind Promotions

`DELETE /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/promotions/{promotion_id}`

Operation ID: `Unbind Promotions`. Tags: sites. Security: oauth2\_application.

Action to unbind one promotions from a given abTest.

This endpoint may return the following faults:

*   404 - ABTestNotFoundException - Indicates that the abTest with the given abTest ID is not found.
*   404 - ABTestSegmentNotFoundException - thrown when the segment with the given id is not found.
*   404 - PromotionNotFoundException - thrown when promotion is not found for one of the specified promotion ids.
*   404 - SiteNotFoundException - thrown when the site with the given id is not found.

#### Parameters

*   `site_id` (path, string, required)  
    Minimum length: 1.
*   `ab_test_id` (path, string, required) The abTest ID that promotions are to be unbound from  
    Minimum length: 1.
*   `segment_id` (path, string, required) the segment to bind to  
    Minimum length: 1.
*   `promotion_id` (path, string, required) The ID of the promotion that is to be assigned to the abTest.  
    Minimum length: 1.

#### Responses

*   **204**
*   **404** `ABTestNotFoundException` - Indicates that the abTest with the given abTest ID is not found. or `ABTestSegmentNotFoundException` - thrown when the segment with the given id is not found. or `PromotionNotFoundException` - thrown when promotion is not found for one of the specified promotion ids. or `SiteNotFoundException` - thrown when the site with the given id is not found.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    

### PUT Bind Slot Configuration

`PUT /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/slot_configurations/{slot_id}/{slot_config_id}`

Operation ID: `Bind Slot Configuration`. Tags: sites. Security: oauth2\_application.

Action to bind a slot configuration to a given abTest.

This endpoint may return the following faults:

*   400 - InvalidContextTypeException - Indicates the slot context type is not one of "global", "category", or "folder"
*   404 - ABTestNotFoundException - Indicates that the abTest with the given abTest ID is not found.
*   404 - ABTestSegmentNotFoundException - thrown when the segment with the given id is not found.
*   404 - SiteNotFoundException - thrown when the site with the given id is not found.
*   404 - SlotConfigurationIdentifierNotFoundException - Indicates that the slot with the given slot ID, slot configuration ID and context type is not found.
*   404 - SlotWithContextTypeNotFoundException - Indicates that the slot with the given slot ID and context type is not found.

#### Parameters

*   `ab_test_id` (path, string, required) The id of the abTest  
    Minimum length: 1.
*   `segment_id` (path, string, required)  
    Minimum length: 1.
*   `site_id` (path, string, required) The id of the site  
    Minimum length: 1.
*   `slot_id` (path, string, required) The of the slot  
    Minimum length: 1.
*   `slot_config_id` (path, string, required) The id of the slot configuration  
    Minimum length: 1.
*   `context` (query, string) The context string, which consists of three parts: the context type (which must be folder, category or global), an equals sign (=), and the context id (either the category id or folder id). If you do not set this query parameter, the global context is used by default.  
    Minimum length: 1.

#### Responses

*   **204**
*   **400** `InvalidContextTypeException` - Indicates the slot context type is not one of "global", "category", or "folder"
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **404** `ABTestNotFoundException` - Indicates that the abTest with the given abTest ID is not found. or `ABTestSegmentNotFoundException` - thrown when the segment with the given id is not found. or `SiteNotFoundException` - thrown when the site with the given id is not found. or `SlotConfigurationIdentifierNotFoundException` - Indicates that the slot with the given slot ID, slot configuration ID and context type is not found. or `SlotWithContextTypeNotFoundException` - Indicates that the slot with the given slot ID and context type is not found.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    

### DELETE Unbind Slot Configuration

`DELETE /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/slot_configurations/{slot_id}/{slot_config_id}`

Operation ID: `Unbind Slot Configuration`. Tags: sites. Security: oauth2\_application.

Action to unbind a slot configuration from a given abTest.

This endpoint may return the following faults:

*   400 - InvalidContextTypeException - Indicates the slot context type is not one of "global", "category", or "folder"
*   404 - ABTestNotFoundException - Indicates that the abTest with the given abTest ID is not found.
*   404 - ABTestSegmentNotFoundException - thrown when the segment with the given id is not found.
*   404 - SiteNotFoundException - thrown when the site with the given id is not found.
*   404 - SlotConfigurationIdentifierNotFoundException - Indicates that the slot with the given slot ID, slot configuration ID and context type is not found.
*   404 - SlotWithContextTypeNotFoundException - Indicates that the slot with the given slot ID and context type is not found.

#### Parameters

*   `ab_test_id` (path, string, required) The id of the abTest  
    Minimum length: 1.
*   `segment_id` (path, string, required)  
    Minimum length: 1.
*   `site_id` (path, string, required) The id of the site  
    Minimum length: 1.
*   `slot_id` (path, string, required) The of the slot  
    Minimum length: 1.
*   `slot_config_id` (path, string, required) The id of the slot configuration  
    Minimum length: 1.
*   `context` (query, string) The context string, which consists of three parts: the context type (which must be folder, category or global), an equals sign (=), and the context id (either the category id or folder id).  
    Minimum length: 1.

#### Responses

*   **204**
*   **400** `InvalidContextTypeException` - Indicates the slot context type is not one of "global", "category", or "folder"
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **404** `ABTestNotFoundException` - Indicates that the abTest with the given abTest ID is not found. or `ABTestSegmentNotFoundException` - thrown when the segment with the given id is not found. or `SiteNotFoundException` - thrown when the site with the given id is not found. or `SlotConfigurationIdentifierNotFoundException` - Indicates that the slot with the given slot ID, slot configuration ID and context type is not found. or `SlotWithContextTypeNotFoundException` - Indicates that the slot with the given slot ID and context type is not found.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    

### PUT Bind SortingRule to A/B Test

`PUT /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/sorting_rules/{sorting_rule_id}/{category_id}`

Operation ID: `Bind SortingRule to A/B Test`. Tags: sites. Security: oauth2\_application.

Action to bind a single sorting rule to a given abTest.

This endpoint may return the following faults:

*   400 - InvalidCategoryException - Indicates that the category with the given category ID is not found.
*   404 - ABTestNotFoundException - Indicates that the abTest with the given abTest ID is not found.
*   404 - ABTestSegmentNotFoundException - thrown when the segment with the given id is not found.
*   404 - SiteNotFoundException - thrown when the site with the given id is not found.
*   404 - SortingRuleNotFoundException - Indicates that the sorting rule with the given sorting rule ID is not found.
*   409 - SortingRuleCampaignAssignConflictException - Indicates that there is a sorting rule already assigned to the given abTest ID and category ID. The sorting rule with the given sorting rule ID cannot be assigned to the same abTest ID and category ID.

#### Parameters

*   `site_id` (path, string, required) The ID of the site that contains the abTest, sorting rule and category.  
    Minimum length: 1.
*   `ab_test_id` (path, string, required) The ID of the abTest to which the sorting rule is to be assigned.  
    Minimum length: 1.
*   `segment_id` (path, string, required)  
    Minimum length: 1.
*   `sorting_rule_id` (path, string, required) The ID of sorting rule that is to be assigned to the abTest.  
    Minimum length: 1.
*   `category_id` (path, string, required) The ID of the category that is associated with the sorting rule.  
    Minimum length: 1.
*   `rule_context` (query, string) the optional context of the sorting rule, either "site" (default) or "global"

#### Responses

*   **204**
*   **400** `InvalidCategoryException` - Indicates that the category with the given category ID is not found.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **404** `ABTestNotFoundException` - Indicates that the abTest with the given abTest ID is not found. or `ABTestSegmentNotFoundException` - thrown when the segment with the given id is not found. or `SiteNotFoundException` - thrown when the site with the given id is not found. or `SortingRuleNotFoundException` - Indicates that the sorting rule with the given sorting rule ID is not found.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **409** `SortingRuleCampaignAssignConflictException` - Indicates that there is a sorting rule already assigned to the given abTest ID and category ID. The sorting rule with the given sorting rule ID cannot be assigned to the same abTest ID and category ID.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    

### DELETE Unbind SortingRule

`DELETE /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/sorting_rules/{sorting_rule_id}/{category_id}`

Operation ID: `Unbind SortingRule`. Tags: sites. Security: oauth2\_application.

Action to unbind a single sorting rule from a given abTest.

This endpoint may return the following faults:

*   400 - InvalidCategoryException - Indicates that the category with the given category ID is not found.
*   404 - ABTestNotFoundException - Indicates that the abTest with the given abTest ID is not found.
*   404 - ABTestSegmentNotFoundException - thrown when the segment with the given id is not found.
*   404 - SiteNotFoundException - thrown when the site with the given id is not found.
*   404 - SortingRuleNotFoundException - Indicates that the sorting rule with the given sorting rule ID is not found.

#### Parameters

*   `site_id` (path, string, required) The ID of the site that contains the abTest, sorting rule and category.  
    Minimum length: 1.
*   `ab_test_id` (path, string, required) The ID of the abTest to which the sorting rule is to be assigned.  
    Minimum length: 1.
*   `segment_id` (path, string, required)  
    Minimum length: 1.
*   `sorting_rule_id` (path, string, required) The ID of sorting rule that is to be assigned to the abTest.  
    Minimum length: 1.
*   `category_id` (path, string, required) The ID of the category that is associated with the sorting rule.  
    Minimum length: 1.
*   `rule_context` (query, string) the optional context of the sorting rule, either "site" (default) or "global"

#### Responses

*   **204**
*   **400** `InvalidCategoryException` - Indicates that the category with the given category ID is not found.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **404** `ABTestNotFoundException` - Indicates that the abTest with the given abTest ID is not found. or `ABTestSegmentNotFoundException` - thrown when the segment with the given id is not found. or `SiteNotFoundException` - thrown when the site with the given id is not found. or `SortingRuleNotFoundException` - Indicates that the sorting rule with the given sorting rule ID is not found.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    

### GET Get an A/B Test

`GET /sites/{site_id}/ab_tests/{id}`

Operation ID: `Get an A/B Test`. Tags: sites. Security: oauth2\_application.

Action to get an A/B Test information.

This endpoint may return the following faults:

*   404 - SiteNotFoundException - Indicates that site specified with the given id is unknown.
*   404 - ABTestNotFoundException - Thrown in case the A/B Test does not exist matching the given id

#### Parameters

*   `site_id` (path, string, required) ID of the site that the A/B tests are contained within.  
    Minimum length: 1. Maximum length: 256.
*   `id` (path, string, required) The id of the requested A/B Test.  
    Minimum length: 1.
*   `expand` (query, array of string) The expand parameter. A comma separated list with the allowed values (stats, promotions, sorting\_rules, slot\_configs)

#### Responses

*   **404** `SiteNotFoundException` - Indicates that site specified with the given id is unknown. or `ABTestNotFoundException` - Thrown in case the A/B Test does not exist matching the given id
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **default**
    
    Media type: `application/json, text/xml`. Schema: `ab_test`.
    

### PUT Creates an A/B Test

`PUT /sites/{site_id}/ab_tests/{id}`

Operation ID: `Creates an A/B Test`. Tags: sites. Security: oauth2\_application.

Creates an A/B Test using the information provided. If an A/B Test with the same unique identifier exists, it will be deleted and a new one will be created unless the header x-dw-validate-existing=true is passed in with the request.

This endpoint may return the following faults:

*   400 - ABTestInvalidEmailException - Thrown if an invalid email is specified.
*   400 - ABTestInvalidPipelineException - Thrown if an invalid pipeline is specified.
*   400 - ABTestInvalidTriggerException - Thrown if there is missing pipline\_call or categories in the specified trigger of type pipeline\_call or category\_view\_page respectively.
*   404 - SiteNotFoundException - Indicates that site specified with the given id is unknown.
*   404 - ABTestNotFoundException - Thrown in case the A/B Test does not exist matching the given id
*   409 - ABTestDuplicateException - If an A/B Test exists already in the site with the given identifier and the header x-dw-validate-existing=true is passed in with the request.

#### Parameters

*   `site_id` (path, string, required) ID of the site that the A/B tests are contained within.  
    Minimum length: 1. Maximum length: 256.
*   `id` (path, string, required) The id of the requested A/B Test.  
    Minimum length: 1. Maximum length: 40.

#### Request body

Media type: `application/json, text/xml`. Schema: `ab_test`.

#### Responses

*   **400** `ABTestInvalidEmailException` - Thrown if an invalid email is specified. or `ABTestInvalidPipelineException` - Thrown if an invalid pipeline is specified. or `ABTestInvalidTriggerException` - Thrown if there is missing pipline\_call or categories in the specified trigger of type pipeline\_call or category\_view\_page respectively.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **404** `SiteNotFoundException` - Indicates that site specified with the given id is unknown. or `ABTestNotFoundException` - Thrown in case the A/B Test does not exist matching the given id
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **409** `ABTestDuplicateException` - If an A/B Test exists already in the site with the given identifier and the header x-dw-validate-existing=true is passed in with the request.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **default**
    
    Media type: `application/json, text/xml`. Schema: `ab_test`.
    

### DELETE Delete A/B Test

`DELETE /sites/{site_id}/ab_tests/{id}`

Operation ID: `Delete A/B Test`. Tags: sites. Security: oauth2\_application.

Deletes the A/B Test by ID

This endpoint may return the following faults:

*   404 - SiteNotFoundException - Indicates that site specified with the given id is unknown.
*   404 - ABTestNotFoundException - Thrown in case the A/B Test does not exist matching the given id

#### Parameters

*   `site_id` (path, string, required) ID of the site that the A/B tests are contained within.  
    Minimum length: 1. Maximum length: 256.
*   `id` (path, string, required) The id of the requested A/B Test.  
    Minimum length: 1.

#### Responses

*   **204**
*   **404** `SiteNotFoundException` - Indicates that site specified with the given id is unknown. or `ABTestNotFoundException` - Thrown in case the A/B Test does not exist matching the given id
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    

### PATCH Update an A/B Test

`PATCH /sites/{site_id}/ab_tests/{id}`

Operation ID: `Update an A/B Test`. Tags: sites. Security: oauth2\_application.

Updates the A/B Test with the specified information.

This endpoint may return the following faults:

*   400 - ABTestInvalidEmailException - Thrown if an invalid email is specified.
*   400 - ABTestInvalidPipelineException - Thrown if an invalid pipeline is specified.
*   400 - ABTestInvalidTriggerException - Thrown if there is missing pipline\_call or categories in the specified trigger of type pipeline\_call or category\_view\_page respectively.
*   404 - SiteNotFoundException - Indicates that site specified with the given id is unknown.
*   404 - ABTestNotFoundException - Thrown in case the A/B Test does not exist matching the given id
*   409 - ABTestDuplicateException - Thrown if an A/B Test exists already in the site with the given identifier specified in the body that is different from the identifier in the path.

#### Parameters

*   `site_id` (path, string, required) ID of the site that the A/B tests are contained within.  
    Minimum length: 1. Maximum length: 256.
*   `id` (path, string, required) The id of the requested A/B Test.  
    Minimum length: 1.

#### Request body

Media type: `application/json, text/xml`. Schema: `ab_test`.

#### Responses

*   **400** `ABTestInvalidEmailException` - Thrown if an invalid email is specified. or `ABTestInvalidPipelineException` - Thrown if an invalid pipeline is specified. or `ABTestInvalidTriggerException` - Thrown if there is missing pipline\_call or categories in the specified trigger of type pipeline\_call or category\_view\_page respectively.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **404** `SiteNotFoundException` - Indicates that site specified with the given id is unknown. or `ABTestNotFoundException` - Thrown in case the A/B Test does not exist matching the given id
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **409** `ABTestDuplicateException` - Thrown if an A/B Test exists already in the site with the given identifier specified in the body that is different from the identifier in the path.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **default**
    
    Media type: `application/json, text/xml`. Schema: `ab_test`.
    

### GET Get A/B Test Segment

`GET /sites/{site_id}/ab_tests/{id}/segments/{segment_id}`

Operation ID: `Get A/B Test Segment`. Tags: sites. Security: oauth2\_application.

Gets an A/B Test segment using the information provided.

This endpoint may return the following faults:

*   404 - SiteNotFoundException - Indicates that site specified with the given id is unknown.
*   404 - ABTestNotFoundException - Thrown in case the A/B Test does not exist matching the given id
*   404 - ABTestSegmentNotFoundException - Thrown if the segment cannot be found in the A/B Test provided

#### Parameters

*   `site_id` (path, string, required) ID of the site that the A/B tests are contained within.  
    Minimum length: 1. Maximum length: 256.
*   `id` (path, string, required) The id of the requested A/B Test.  
    Minimum length: 1.
*   `segment_id` (path, string, required) The id of the segment in the test.  
    Minimum length: 1.
*   `expand` (query, array of string) The expand parameter. A comma separated list with the allowed values (stats, promotions, sorting\_rules, slot\_configs)

#### Responses

*   **404** `SiteNotFoundException` - Indicates that site specified with the given id is unknown. or `ABTestNotFoundException` - Thrown in case the A/B Test does not exist matching the given id or `ABTestSegmentNotFoundException` - Thrown if the segment cannot be found in the A/B Test provided
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **default**
    
    Media type: `application/json, text/xml`. Schema: `ab_test_segment`.
    

### PUT Creates an A/B Test Segment

`PUT /sites/{site_id}/ab_tests/{id}/segments/{segment_id}`

Operation ID: `Creates an A/B Test Segment`. Tags: sites. Security: oauth2\_application.

Creates an A/B Test segment using the information provided.

This endpoint may return the following faults:

*   404 - SiteNotFoundException - Indicates that site specified with the given id is unknown.
*   404 - ABTestNotFoundException - Thrown in case the A/B Test does not exist matching the given id
*   404 - ABTestSegmentNotFoundException - Thrown if the segment cannot be found in the A/B Test provided

#### Parameters

*   `site_id` (path, string, required) ID of the site that the A/B tests are contained within.  
    Minimum length: 1. Maximum length: 256.
*   `id` (path, string, required) The id of the requested A/B Test.  
    Minimum length: 1.
*   `segment_id` (path, string, required) The id of the segment in the test.  
    Minimum length: 1.

#### Request body

Media type: `application/json, text/xml`. Schema: `ab_test_segment`.

#### Responses

*   **404** `SiteNotFoundException` - Indicates that site specified with the given id is unknown. or `ABTestNotFoundException` - Thrown in case the A/B Test does not exist matching the given id or `ABTestSegmentNotFoundException` - Thrown if the segment cannot be found in the A/B Test provided
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **default**
    
    Media type: `application/json, text/xml`. Schema: `ab_test_segment`.
    

### DELETE Delete A/B Test Segment

`DELETE /sites/{site_id}/ab_tests/{id}/segments/{segment_id}`

Operation ID: `Delete A/B Test Segment`. Tags: sites. Security: oauth2\_application.

Deletes the A/B Test Segment by ID

This endpoint may return the following faults:

*   404 - SiteNotFoundException - Indicates that site specified with the given id is unknown.
*   404 - ABTestNotFoundException - Thrown in case the A/B Test does not exist matching the given id
*   404 - ABTestSegmentNotFoundException - Thrown if the segment cannot be found in the A/B Test provided

#### Parameters

*   `site_id` (path, string, required) ID of the site that the A/B tests are contained within.  
    Minimum length: 1. Maximum length: 256.
*   `id` (path, string, required) The id of the requested A/B Test.  
    Minimum length: 1.
*   `segment_id` (path, string, required) The id of the segment in the test.  
    Minimum length: 1.

#### Responses

*   **204**
*   **404** `SiteNotFoundException` - Indicates that site specified with the given id is unknown. or `ABTestNotFoundException` - Thrown in case the A/B Test does not exist matching the given id or `ABTestSegmentNotFoundException` - Thrown if the segment cannot be found in the A/B Test provided
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    

### PATCH Update A/B Test Segment

`PATCH /sites/{site_id}/ab_tests/{id}/segments/{segment_id}`

Operation ID: `Update A/B Test Segment`. Tags: sites. Security: oauth2\_application.

Updates the A/B Test segment with the specified information.

This endpoint may return the following faults:

*   404 - SiteNotFoundException - Indicates that site specified with the given id is unknown.
*   404 - ABTestNotFoundException - Thrown in case the A/B Test does not exist matching the given id
*   404 - ABTestSegmentNotFoundException - Thrown if the segment cannot be found in the A/B Test provided

#### Parameters

*   `site_id` (path, string, required) ID of the site that the A/B tests are contained within.  
    Minimum length: 1. Maximum length: 256.
*   `id` (path, string, required) The id of the requested A/B Test.  
    Minimum length: 1.
*   `segment_id` (path, string, required) The id of the segment in the test.  
    Minimum length: 1.

#### Request body

Media type: `application/json, text/xml`. Schema: `ab_test_segment`.

#### Responses

*   **404** `SiteNotFoundException` - Indicates that site specified with the given id is unknown. or `ABTestNotFoundException` - Thrown in case the A/B Test does not exist matching the given id or `ABTestSegmentNotFoundException` - Thrown if the segment cannot be found in the A/B Test provided
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **default**
    
    Media type: `application/json, text/xml`. Schema: `ab_test_segment`.
    

## Schemas

### ab\_tests

Request document containing a set of ABTests

*   `count` (_integer (int32)_)
*   `data` (_array of ab\_test_)
*   `expand` (_array of string_)
*   `next` (_string_)
*   `previous` (_string_)
*   `select` (_string_)
*   `start` (_integer (int32)_)  
    Minimum: 0.
*   `total` (_integer (int32)_)

_Example_

```
{
  "customer_groups": [
    "abtest_customer_group"
  ],
  "description": "my abtest1 description",
  "email_addresses": [
    "abtest1@salesforce.com"
  ],
  "enabled": true,
  "end_date": "2015-07-31T23:09:08.000Z",
  "expiration_type": "session",
  "id": "my-abtest1",
  "key_metric_id": "abtest_key_metric_id",
  "link": "https://example.com/s/-/dw/data/{version}/sites/SiteGenesis/ab_tests/my-abtest1",
  "paused": true,
  "start_date": "2015-04-01T11:30:15.000Z",
  "tags": [
    "abtest_tag"
  ],
  "test_groups": [
    {
      "allocation": 20,
      "custom_experience": false,
      "id": "Control"
    },
    {
      "allocation": 40,
      "custom_experience": false,
      "description": "A description",
      "id": "Test Segment A"
    },
    {
      "allocation": 40,
      "custom_experience": false,
      "id": "Test Segment B"
    }
  ],
  "trigger": {
    "is_pipeline_based": false,
    "trigger_type": "immediately"
  }
}
```

### fault

Document representing a fault message that is returned whenever the HTTP status code is greater than or equal to 400 (which indicates an error).

*   `arguments` (_object_)
    
    A map that provides fault arguments.
    
    Data can be used to provide error messages on the client side.
    
    Additional properties: `object`.
    
*   `cause` (_cause_)
*   `display_message_pattern` (_string_) The localized display message pattern, if the request parameter display\_locale was given
*   `message` (_string_) The message text of the java exception.
*   `stack_trace` (_string_)
*   `type` (_string_) The name of the java exception.

### ab\_test

The id of the A/B Test

*   `customer_groups` (_array of string_) The list of customer group ids assigned to the A/B Test. Defaults to 'Everyone' if not specified on create
*   `description` (_string_) The optional description of the A/B Test  
    Maximum length: 4000.
*   `email_addresses` (_array of string_) The optional list of email addresses to send A/B Test results
*   `enabled` (_boolean_) The flag representing the enabled state of the A/B Test. Defaults to false if not specified on create
*   `end_date` (_string (date-time)_) The date that the A/B Test ends. Defaults to two weeks from creation date if both start and end dates are not specified on create
*   `expiration_type` (_string_) The participant expiration type of the A/B Test. Defaults to 'never' if not specified on create  
    Allowed values: `session`, `never`.
*   `id` (_string_) The id of the A/B Test  
    Minimum length: 1. Maximum length: 40.
*   `key_metric_id` (_string_) The key metric that is most important to the A/B Test, among the metrics collected. Defaults to 'Revenue' if not specified from test participant activity  
    Maximum length: 256.
*   `link` (_string_) The URL to get the A/B test. This is a computed attribute and cannot be modified
*   `paused` (_boolean_) The flag representing the paused state of the A/B Test. Defaults to false if not specified on create
*   `segment_count` (_integer (int32)_) Segment count of A/B test. This is a computed attribute and cannot be modified
*   `start_date` (_string (date-time)_) The date that the A/B Test begins. Defaults to a week from creation date if both start and end dates are not specified on create
*   `status` (_string_) Status of A/B test. This is a computed attribute and cannot be modified  
    Allowed values: `ended`, `planned`, `running`.
*   `tags` (_array of string_) The optional list of tags to group similar A/B Tests so that they can be searched easily.
*   `test_groups` (_array of ab\_test\_group_) Test Groups created for an A/B Test. This is a read only attribute for now.
*   `test_segments` (_array of ab\_test\_segment_) Test Segments created for an A/B Test. This is a read only attribute for now
*   `trigger` (_ab\_test\_trigger_) The trigger that allows the test participant to be considered for an A/B Test

_Example_

```
{
  "customer_groups": [
    "abtest_customer_group"
  ],
  "description": "abtest description",
  "email_addresses": [
    "abtest1@salesforce.com"
  ],
  "enabled": true,
  "end_date": "2015-07-31T23:09:08.000Z",
  "expiration_type": "session",
  "id": "my-abtest",
  "key_metric_id": "abtest_key_metric_id",
  "link": "https://example.com/s/-/dw/data/{version}/sites/SiteGenesis/ab_tests/my-abtest",
  "paused": true,
  "start_date": "2015-04-01T11:30:15.000Z",
  "tags": [
    "abtest_tag"
  ],
  "test_groups": [
    {
      "allocation": 20,
      "custom_experience": false,
      "id": "Control"
    },
    {
      "allocation": 40,
      "custom_experience": false,
      "description": "A description",
      "id": "Test Segment A"
    },
    {
      "allocation": 40,
      "custom_experience": false,
      "id": "Test Segment B"
    }
  ],
  "trigger": {
    "is_pipeline_based": false,
    "trigger_type": "immediately"
  }
}
```

### ab\_test\_segment

Document representing an A/B Test Segment

*   `allocation` (_integer (int32)_) Test Group percentage allocation
*   `custom_experience` (_boolean_) Flag to determine if this Test Group is a customer experience
*   `description` (_string_) Test Group description  
    Maximum length: 4000.
*   `id` (_string_) Test group id  
    Minimum length: 1. Maximum length: 40.
*   `link` (_string_)
*   `preferences` (_array of object_) Preferences which this segment has as experiences
*   `promotions` (_array of object_) Promotions which this segment has as experiences
*   `slot_configs` (_array of object_) Slot configurations which this segment has as experiences
*   `sorting_rules` (_array of object_) Sorting rules which this segment has as experiences
*   `stats` (_ab\_test\_segment\_stats_) Statistics about the segment

_Example_

```
{
  "allocation": 10,
  "description": "modified description",
  "id": "my-segment",
  "link": "https://example.com/s/-/dw/data/{version}/sites/SiteGenesis/ab_tests/my-abtest/segments/my-segment"
}
```

### cause

*   `cause` (_cause_)
*   `message` (_string_)
*   `type` (_string_)

### ab\_test\_group

Document representing an A/B Test Group

*   `allocation` (_integer (int32)_) Test Group percentage allocation
*   `custom_experience` (_boolean_) Flag to determine if this Test Group is a customer experience
*   `description` (_string_) Test Group description
*   `id` (_string_) Test group id

_Example_

```
{
  "allocation": 20,
  "custom_experience": false,
  "id": "Control"
}
```

### ab\_test\_trigger

Document representing an A/B Test trigger.

*   `categories` (_array of string_) The list of categories. This is a modifiable attribute when trigger type is 'category\_page\_view' only
*   `is_pipeline_based` (_boolean_) The flag indicating if the trigger is based on pipelines. This is a computed attribute and cannot be modified
*   `pipeline_calls` (_array of string_) The list of pipeline name and start node combinations (for example, Account-Show). This is a modifiable attribute when trigger type is 'pipeline\_calls' only
*   `trigger_type` (_string_) The type of the trigger. Defaults to 'immediately' if not specified on create  
    Allowed values: `immediately`, `category_page_view`, `home_page_view`, `pipeline_call`.

_Example_

```
{
  "is_pipeline_based": false,
  "trigger_type": "immediately"
}
```

### ab\_test\_segment\_stats

*   `adds_to_baskets` (_integer (int32)_)
*   `average_adds_per_basket` (_number (double)_)
*   `average_adds_per_basket_std_error` (_number (double)_)
*   `average_discount_amount` (_number (double)_)
*   `average_discount_amount_std_error` (_number (double)_)
*   `average_discount_amount_with_coupon` (_number (double)_)
*   `average_discount_amount_with_coupon_std_error` (_number (double)_)
*   `average_discount_amount_without_coupon` (_number (double)_) The standard error for the average amount discounted for orders without using a coupon
*   `average_discount_amount_without_coupon_std_error` (_number (double)_) Units sold per hour
*   `average_order_value` (_number (double)_)
*   `average_order_value_std_error` (_number (double)_)
*   `average_revenue_per_visit` (_number (double)_)
*   `average_revenue_per_visit_std_error` (_number (double)_)
*   `average_units_added_per_basket` (_number (double)_)
*   `average_units_adder_per_basket_std_error` (_number (double)_)
*   `average_units_per_order_std_error` (_number (double)_)
*   `average_units_per_visit` (_number (double)_)
*   `average_units_per_visit_std_error` (_number (double)_)
*   `basket_rate` (_number (double)_)
*   `baskets` (_number (double)_)
*   `checkout_rate` (_number (double)_)
*   `checkouts` (_integer (int32)_)
*   `conversion_rate` (_number (double)_)
*   `discount_amount_with_coupon` (_number (double)_)
*   `discount_amount_without_coupon` (_number (double)_)
*   `orders` (_integer (int32)_)
*   `revenue` (_number (double)_)
*   `total_discount_amount` (_number (double)_)
*   `units` (_number (double)_)
*   `units_added_to_baskets` (_number (double)_)
*   `visitors` (_integer (int32)_)
*   `visits` (_integer (int32)_)