AbTests resource (Data API 19.1)

Summary

Http Method Resource Description
PUT /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/promotions/{promotion_id} Action to bind a single promotion to a given abTest.
DELETE /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/promotions/{promotion_id} Action to unbind one promotions from a given abTest.
PUT /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/slot_configurations/{slot_id}/{slot_config_id} Action to bind a slot configuration to a given abTest.
DELETE /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/slot_configurations/{slot_id}/{slot_config_id} Action to unbind a slot configuration from a given abTest.
PUT /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/sorting_rules/{sorting_rule_id}/{category_id} Action to bind a single sorting rule to a given abTest.
DELETE /sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/sorting_rules/{sorting_rule_id}/{category_id} Action to unbind a single sorting rule from a given abTest.

Bind Promotion

Action to bind a single promotion to a given abTest.

Url

PUT https://hostname:port/dw/data/v19_1/sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/promotions/{promotion_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Path Parameters

Parameter Type Description Constraints
ab_test_id String The ID of the abTest which contains the segment. minLength=1
promotion_id String The ID of the promotion that is to be assigned to the abTest. minLength=1
segment_id String The ID of the segment to to which the promotion is to be assigned. minLength=1
site_id String The ID of the site that contains the abTest and promotion. minLength=1

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 ABTestNotFoundException

abtestId (String)

siteId (String)

Indicates that the abTest with the given abTest ID is not found.
404 ABTestSegmentNotFoundException

abtestId (String)

abTestSegmentId (String)

siteId (String)

thrown when the segment with the given id is not found.
404 PromotionNotFoundException

promotionId (String)

siteId (String)

Indicates that the promotion with the given promotion ID is not found.
404 SiteNotFoundException

siteId (String)

thrown when the site with the given id is not found.

Sample

REQUEST:
PUT /s/-/dw/data/v19_1/sites/SiteGenesis/abtests/my-abtest/segments/my-segment/promotions/my-promo HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367

# in case of success:

RESPONSE:
HTTP/1.1 204 No Content

# in case of failure:

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTestNotFoundException",
    "message":"No ab_test with ID 'my-abtest' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTesSegmentNotFoundException",
    "message":"No segment with ID 'my-segment' in A/B test 'my-abtest' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"PromotionNotFoundException",
    "message":"No promotion with ID 'my-promo' for site 'SiteGenesis' was found."
  }
}

Unbind Promotions

Action to unbind one promotions from a given abTest.

Url

DELETE https://hostname:port/dw/data/v19_1/sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/promotions/{promotion_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Path Parameters

Parameter Type Description Constraints
ab_test_id String The abTest ID that promotions are to be unbound from minLength=1
promotion_id String The ID of the promotion that is to be assigned to the abTest. minLength=1
segment_id String the segment to bind to minLength=1
site_id String   minLength=1

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 ABTestNotFoundException

abtestId (String)

siteId (String)

Indicates that the abTest with the given abTest ID is not found.
404 ABTestSegmentNotFoundException

abtestId (String)

abTestSegmentId (String)

siteId (String)

thrown when the segment with the given id is not found.
404 PromotionNotFoundException

promotionId (String)

siteId (String)

thrown when promotion is not found for one of the specified promotion ids.
404 SiteNotFoundException

siteId (String)

thrown when the site with the given id is not found.

Sample

REQUEST:
DELETE /s/-/dw/data/v19_1/sites/SiteGenesis/abtests/my-abtest/segments/my-segment/promotions/my-promo HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367

# in case of success:

RESPONSE:
HTTP/1.1 204 No Content

# in case of failure:

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTestNotFoundException",
    "message":"No ab_test with ID 'my-abtest' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTesSegmentNotFoundException",
    "message":"No segment with ID 'my-segment' in A/B test 'my-abtest' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"PromotionNotFoundException",
    "message":"No promotion with ID 'my-promo' for site 'SiteGenesis' was found."
  }
}

Bind Slot Configuration

Action to bind a slot configuration to a given abTest.

Url

PUT https://hostname:port/dw/data/v19_1/sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/slot_configurations/{slot_id}/{slot_config_id}?context={String}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Path Parameters

Parameter Type Description Constraints
ab_test_id String The id of the abTest minLength=1
segment_id String   minLength=1
site_id String The id of the site minLength=1
slot_config_id String The id of the slot configuration minLength=1
slot_id String The of the slot minLength=1

Query Parameters

Parameter Type Description Constraints
context 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. minLength=1

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 InvalidContextTypeException

contextType (String)

Indicates the slot context type is not one of "global", "category", or "folder"
404 ABTestNotFoundException

abtestId (String)

siteId (String)

Indicates that the abTest with the given abTest ID is not found.
404 SlotWithContextTypeNotFoundException

slotId (String)

contextType (String)

siteId (String)

Indicates that the slot with the given slot ID and context type is not found.
404 SlotConfigurationIdentifierNotFoundException

siteId (String)

slotId (String)

slotConfigurationId (String)

contextType (Enum {global, category, folder})

contextId (String)

Indicates that the slot with the given slot ID, slot configuration ID and context type is not found.
404 ABTestSegmentNotFoundException

abtestId (String)

abTestSegmentId (String)

siteId (String)

thrown when the segment with the given id is not found.
404 SiteNotFoundException

siteId (String)

thrown when the site with the given id is not found.

Sample

REQUEST:
PUT /s/-/dw/data/v19_1/sites/SiteGenesis/abtests/my-abtest/segments/my-segment/slot_configurations/my-slot1/my-slot-config2?context=category=my-category1 HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367

# in case of success:

RESPONSE:
HTTP/1.1 204 No Content

# in case of failure:

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTestNotFoundException",
    "message":"No ab_test with ID 'my-abtest' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTesSegmentNotFoundException",
    "message":"No segment with ID 'my-segment' in A/B test 'my-abtest' for site 'SiteGenesis' was found."
  }
}

HTTP/1.1 404 Not Found
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"SlotWithContextTypeNotFoundException",
    "message":"No slot with ID 'my-slot' and context type 'CATEGORY' for site 'SiteGenesis' was found."
  }

HTTP/1.1 404 Not Found
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"SlotConfigurationIdentifierNotFoundException",
    "message":"No slot configuration with ID 'my-slot-config2', slot id 'my-slot', context type 'CATEGORY', and context id '' for site 'SiteGenesis' was found."
  }
}

HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"InvalidContextTypeException",
    "message":"'invalid' is not a valid context."
  }
}

Unbind Slot Configuration

Action to unbind a slot configuration from a given abTest.

Url

DELETE https://hostname:port/dw/data/v19_1/sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/slot_configurations/{slot_id}/{slot_config_id}?context={String}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Path Parameters

Parameter Type Description Constraints
ab_test_id String The id of the abTest minLength=1
segment_id String   minLength=1
site_id String The id of the site minLength=1
slot_config_id String The id of the slot configuration minLength=1
slot_id String The of the slot minLength=1

Query Parameters

Parameter Type Description Constraints
context 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). minLength=1

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 InvalidContextTypeException

contextType (String)

Indicates the slot context type is not one of "global", "category", or "folder"
404 ABTestNotFoundException

abtestId (String)

siteId (String)

Indicates that the abTest with the given abTest ID is not found.
404 SlotWithContextTypeNotFoundException

slotId (String)

contextType (String)

siteId (String)

Indicates that the slot with the given slot ID and context type is not found.
404 SlotConfigurationIdentifierNotFoundException

siteId (String)

slotId (String)

slotConfigurationId (String)

contextType (Enum {global, category, folder})

contextId (String)

Indicates that the slot with the given slot ID, slot configuration ID and context type is not found.
404 ABTestSegmentNotFoundException

abtestId (String)

abTestSegmentId (String)

siteId (String)

thrown when the segment with the given id is not found.
404 SiteNotFoundException

siteId (String)

thrown when the site with the given id is not found.

Sample

REQUEST:
DELETE /s/-/dw/data/v19_1/sites/SiteGenesis/abtests/my-abtest/segments/my-segment/slot_configurations/my-slot1/my-slot-config2?context=category=my-category1 HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367

# in case of success:

RESPONSE:
HTTP/1.1 204 No Content

# in case of failure:

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTestNotFoundException",
    "message":"No ab_test with ID 'my-abtest' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTesSegmentNotFoundException",
    "message":"No segment with ID 'my-segment' in A/B test 'my-abtest' for site 'SiteGenesis' was found."
  }
}

HTTP/1.1 404 Not Found
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"SlotWithContextTypeNotFoundException",
    "message":"No slot with ID 'my-slot' and context type 'CATEGORY' for site 'SiteGenesis' was found."
  }

HTTP/1.1 404 Not Found
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"SlotConfigurationIdentifierNotFoundException",
    "message":"No slot configuration with ID 'my-slot-config2', slot id 'my-slot', context type 'CATEGORY', and context id '' for site 'SiteGenesis' was found."
  }
}

HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"InvalidContextTypeException",
    "message":"'invalid' is not a valid context."
  }
}

Bind SortingRule

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

Url

PUT https://hostname:port/dw/data/v19_1/sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/sorting_rules/{sorting_rule_id}/{category_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Path Parameters

Parameter Type Description Constraints
ab_test_id String The ID of the abTest to which the sorting rule is to be assigned. minLength=1
category_id String The ID of the category that is associated with the sorting rule. minLength=1
segment_id String   minLength=1
site_id String The ID of the site that contains the abTest, sorting rule and category. minLength=1
sorting_rule_id String The ID of sorting rule that is to be assigned to the abTest. minLength=1

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 InvalidCategoryException

categoryId (String)

Indicates that the category with the given category ID is not found.
404 ABTestNotFoundException

abtestId (String)

siteId (String)

Indicates that the abTest with the given abTest ID is not found.
404 SortingRuleNotFoundException

sortingRuleId (String)

siteId (String)

Indicates that the sorting rule with the given sorting rule ID is not found.
404 ABTestSegmentNotFoundException

abtestId (String)

abTestSegmentId (String)

siteId (String)

thrown when the segment with the given id is not found.
404 SiteNotFoundException

siteId (String)

thrown when the site with the given id is not found.
409 SortingRuleCampaignAssignConflictException

sortingRuleId (String)

campaignId (String)

categoryId (String)

existingSortingRuleId (String)

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.

Sample

REQUEST:
PUT /s/-/dw/data/v19_1/sites/SiteGenesis/abtests/my-abtest/groups/my-group/sorting_rules/my-rule/category1.1 HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367

# in case of success:

RESPONSE:
HTTP/1.1 204 No Content

# in case of failure:

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTestNotFoundException",
    "message":"No ab_test with ID 'my-abtest' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTesGroupNotFoundException",
    "message":"No group with ID 'my-group' in A/B test 'my-abtest' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"SortingRuleNotFoundException",
    "message":"No sorting rule with ID 'my-rule' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 400 Bad Request
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"InvalidCategoryException",
    "message":"The specified category with ID 'category1.1' is invalid."
  }
}

Unbind SortingRule

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

Url

DELETE https://hostname:port/dw/data/v19_1/sites/{site_id}/ab_tests/{ab_test_id}/segments/{segment_id}/sorting_rules/{sorting_rule_id}/{category_id}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Path Parameters

Parameter Type Description Constraints
ab_test_id String The ID of the abTest to which the sorting rule is to be assigned. minLength=1
category_id String The ID of the category that is associated with the sorting rule. minLength=1
segment_id String   minLength=1
site_id String The ID of the site that contains the abTest, sorting rule and category. minLength=1
sorting_rule_id String The ID of sorting rule that is to be assigned to the abTest. minLength=1

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 InvalidCategoryException

categoryId (String)

Indicates that the category with the given category ID is not found.
404 ABTestNotFoundException

abtestId (String)

siteId (String)

Indicates that the abTest with the given abTest ID is not found.
404 SortingRuleNotFoundException

sortingRuleId (String)

siteId (String)

Indicates that the sorting rule with the given sorting rule ID is not found.
404 ABTestSegmentNotFoundException

abtestId (String)

abTestSegmentId (String)

siteId (String)

thrown when the segment with the given id is not found.
404 SiteNotFoundException

siteId (String)

thrown when the site with the given id is not found.

Sample

REQUEST:
DELETE /s/-/dw/data/v19_1/sites/SiteGenesis/abtests/my-abtest/groups/my-group/sorting_rules/my-rule/category1.1 HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367

# in case of success:

RESPONSE:
HTTP/1.1 204 No Content

# in case of failure:

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTestNotFoundException",
    "message":"No ab_test with ID 'my-abtest' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"ABTesGroupNotFoundException",
    "message":"No group with ID 'my-group' in A/B test 'my-abtest' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"SortingRuleNotFoundException",
    "message":"No sorting rule with ID 'my-rule' for site 'SiteGenesis' was found."
  }
}

RESPONSE:
HTTP/1.1 400 Bad Request
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"19.1",
  "fault":{
    "type":"InvalidCategoryException",
    "message":"The specified category with ID 'category1.1' is invalid."
  }
}

X OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.