A/B tests endpoints

GET /analytics/v1/ab-tests

Resource information

URL https://api.insight.sitefinity.com/analytics/v1/ab-tests
HTTP method GET
Description Get all A/B tests in a data center
Authentication Required

Parameters

Name Location Required Data type Description
Authorization Header Yes String The access token of the user.
x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.
x-dataintelligence-skip Header No Integer Number of items to skip. Default value is 0.
x-dataintelligence-take Header No Integer Number of items to take. Default value is 20.
x-dataintelligence-filter Header No {
"PropertyName": "PropertyValue"
}
You can filter the A/B tests by some of their properties. The allowed properties are “Id”, “Name”, “StartDate” and “BusinessStatus”.
x-dataintelligence-sort Header No {
"PropertyName":
1/-1
}

You can sort the A/B tests by some of their properties. The allowed properties are “Id”, “Name”, “StartDate” and “BusinessStatus”.

Use 1 as the value of the property to sort them ascending, and -1 to sort them descending.
x-dataintelligence-count Header No Boolean A flag for whether a “count” property with the number of A/B tests in the data center is returned.

Responses

Name Returned data Description
200 OK {
"items": AbTest[],
"count": Integer
}

For details, see A/B test API data type.

Returns a collection containing A/B tests. The count property is returned only if the x-dataintelligence-count parameter is set to true.
400 Bad Request GeneralErrorResponse Returned when a valid JSON is provided in the sort or filter parameters but the property you are trying to sort/filter by is not supported.
401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.
412 Precondition Failed GeneralErrorResponse Returned when some of the provided parameters is not valid. Usually the message states which parameter needs to be fixed.

Sample request and response

The following request:

  • Filters only A/B tests, which are active
  • Sorts by ascending name
  • Skips the first one and take the next two
  • Returns the total number of A/B tests in the data center

HTTP:

GET https://api.insight.sitefinity.com/analytics/v1/ab-tests

Headers:

  • Authorization: bearer token
  • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9
  • x-dataintelligence-skip: 1
  • x-dataintelligence-take: 2
  • x-dataintelligence-filter: {“BusinessStatus”: “Active”}
  • x-dataintelligence-sort: {“Name”: 1}
  • x-dataintelligence-count: true

JSON sample response:

GET /analytics/v1/ab-tests/{ab-test-id}

Resource information

URL https://api.insight.sitefinity.com/analytics/v1/ab-tests/{ab-test-id}
HTTP method GET
Description Get a single A/B test by ID
Authentication Required

Parameters

Name Location Required Data type Description
ab-test-id URI path Yes Guid The ID of the test you want to get.
Authorization Header Yes String The access token of the user.
x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.

Responses

Name Returned data Description
200 OK AbTest Returns the A/B test matching the provided ID.
400 Bad Request GeneralErrorResponse Returned when the provided ab-test-id parameter Is not a valid GUID.
401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.
412 Precondition Failed GeneralErrorResponse Returned when the provided GUID in the ab-test-id parameter does not match the ID of any of the A/B tests in the provided data center.

Sample request and response

HTTP:

GET https://api.insight.sitefinity.com/analytics/v1/ab-tests/1D0F8CFF-ED02-463B-A34A-F34579E52A50

Headers:

  • Authorization: bearer token
  • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

JSON sample response:

GET /analytics/v1/ab-tests/{ab-test-id}/goals/{ab-test-goal-id}/statistics

Resource information

URL https://api.insight.sitefinity.com/analytics/v1/ab-tests/{ab-test-id }/goals/{ab-test-goal-id}/statistics
HTTP method GET
Description Get the daily statistics of an A/B test goal
Authentication Required

Parameters

Name Location Required Data type Description
ab-test-id URI path Yes Guid The ID of the A/B test that contains the goal.
ab-test-goal-id URI path Yes Guid The ID of the A/B test goal.
Authorization Header Yes String The access token of the user.
x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.
x-dataintelligence-filter Header No {
"PropertyName":
"PropertyValue"
}
You can filter the A/B tests by some of their properties. You can filter by all properties of the A/B test goal statistics. For details, see A/B test goal statistics API data type.

Responses

Name Returned data Description
200 OK {
“items”: AbTestGoalStatistic[]
}

For details, see A/B test goal statistics API data type.

Returns the statistics for the A/B test goal.
400 Bad Request GeneralErrorResponse Returned when the provided ab-test-id or ab-test-goal-id parameters are not valid GUIDs or when the property provided in the x-dataintelligence-filter is not supported.
401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.
404 Not Found GeneralErrorResponse Returned when the provided GUID in the ab-test-id parameter does not match the ID of any of the A/B tests in the provided data center.
412 Precondition Failed GeneralErrorResponse Returned when some of the provided parameters is not valid. Usually the message states which parameter needs to be fixed.

Sample request and response

HTTP:

GET https://api.insight.sitefinity.com/analytics/v1/ab-tests/4D0F8CFF-ED02-463B-A34A-F34579E52A50/goals/78F40E40-BA2D-42D7-BE91-B29C5296D22D/statistics

Headers:

  • Authorization: bearer token
  • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9
  • x-dataintelligence-filter: {"CreatedOn": "2018-02-06T00:01:00.000Z"}

JSON sample response:

GET /analytics/v1/ab-tests/dec-conversions

Resource information

URL https://api.insight.sitefinity.com/analytics/v1/ab-tests/dec-conversions
HTTP method GET
Description Obtain the A/B test-compatible Sitefinity Insight conversion reports, which can be used as global A/B test goals.
Authentication Required

Parameters

Name Location Required Data type Description
Authorization Header Yes String The access token of the user.
x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.

Responses

Name Returned data Description
200 OK {
"items": Array
}

Returns a collection of objects, containing the name and ID of the Sitefinity Insight-compatible goals, for example:

{

"items": [

{

"Id": 1,

"Name": "Purchase Product"

},

{

"Id": 52,

"Name": "Watch Webinar"

},

{

"Id": 53,

"Name": "Submit Contact Us Form"

}

]

}

401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.

Sample request and response

    HTTP:

    GET https://api.insight.sitefinity.com/analytics/v1/ab-tests/dec-conversions

    Headers:

    • Authorization: bearer token
    • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

    JSON sample response:

    POST /analytics/v1/ab-tests

    Resource information

    URL https://api.insight.sitefinity.com/analytics/v1/ab-tests
    HTTP method POST
    Description Create A/B test.
    Authentication Required

    Parameters

    Name Location Required Data type Description
    Authorization Header Yes String The access token of the user.
    x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.

    Request body

    Name Required Data type Description
    JSON root Yes AbTest The A/B test you want to create.

    Responses

    Name Returned data Description
    200 OK

    AbTest

    The created A/B test.

    400 Bad Request GeneralErrorResponse Returned when the provided A/B test id is not a valid Guid or when you have provided an empty Variants property.
    401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
    403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.
    412 Precondition failed GeneralErrorResponse Returned when you provided an empty JSON.

    Sample request and response

      HTTP:

      POST https://api.insight.sitefinity.com/analytics/v1/ab-tests

      Headers:

      • Authorization: bearer token
      • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

      Body JSON:

      JSON sample response:

      PUT /analytics/v1/ab-tests/{ab-test-id}

      Resource information

      URL https://api.insight.sitefinity.com/analytics/v1/ab-tests/{ab-test-id}
      HTTP method PUT
      Description Updates an A/B test
      Authentication Required

      Parameters

      Name Location Required Data type Description
      Authorization Header Yes String The access token of the user.
      x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.
      ab-test-id URI path Yes Guid The ID of the A/B test you want to update.

      Request body

      Name Required Data type Description
      JSON root Yes AbTest The properties of the A/B test you wish to update. Note that you do not need to provide all of the properties (even the ones that are required upon creation). For example, you do not need to provide the id of the A/B Test here.

      Responses

      Name Returned data Description
      200 OK

      AbTest

      The updated A/B test.
      400 Bad Request GeneralErrorResponse Returned when the provided A/B test ID is not a valid GUID or when you have provided an empty Variants property.
      401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
      403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.
      412 Precondition Failed GeneralErrorResponse Returned when you provided an empty JSON.

      Sample request and response

      HTTP:

      PUT https://api.insight.sitefinity.com/analytics/v1/ab-tests/1d0f8cff-ed02-463b-a34a-f34579e52a50

      Headers:

      • Authorization: bearer token
      • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

      Body JSON:

      JSON sample response:

      PUT/analytics/v1/ab-tests/{ab-test-id}/status

      Resource information

      URL https://api.insight.sitefinity.com/analytics/v1/ab-tests/{ab-test-id}/status
      HTTP method PUT
      Description Updates the status if the A/B test
      Authentication Required

      Parameters

      Name Location Required Data type Description
      Authorization Header Yes String The access token of the user.
      x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.
      ab-test-id URI path Yes Guid The ID of the A/B test you want to update the status of.

      Request body

      Name Required Data type
      JSON root Yes AbTestStatusUpdate

      Responses

      Name Returned data Description
      200 OK AbTest The updated A/B test.
      400 Bad Request GeneralErrorResponse Returned when the provided A/B test ID is not a valid GUID or when you have provided an empty Variants property.
      401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
      403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.
      412 Precondition Failed GeneralErrorResponse Returned when you provided an empty JSON.

      Sample request and response

      HTTP:

      PUT https://api.insight.sitefinity.com/analytics/v1/ab-tests/1d0f8cff-ed02-463b-a34a-f34579e52a50/status

      Headers:

      • Authorization: bearer token
      • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

      Body JSON:

      JSON sample response:

      DELETE /analytics/v1/ab-tests/{ab-test-id}

      Resource information

      URL https://api.insight.sitefinity.com/analytics/v1/ab-tests/{ab-test-id}
      HTTP method DELETE
      Description Delete and A/B test by ID
      Authentication Required

      Parameters

      Name Location Required Data type Description
      ab-test-id URI path Yes Guid The ID of the A/B test you want to delete.
      Authorization Header Yes String The access token of the user.
      x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.

      Responses

      Name Returned data Description
      200 OK Empty JSON
      400 Bad Request GeneralErrorResponse Returned when the provided ab-test-id is not a valid GUID.
      401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
      403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.
      404 Not Found GeneralErrorResponse Returned when the provided GUID in the ab-test-id parameter does not match the ID of any of the A/B tests in the provided data center.

      Sample request and response

      HTTP:

      DELETE https://api.insight.sitefinity.com/analytics/v1/ab-tests/1D0F8CFF-ED02-463B-A34A-F34579E52A50

      Headers:

      • Authorization: bearer token
      • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

      JSON sample response:

      {}

      Was this article helpful?