Guides & Tutorials

List A/B tests

GET /api/split.php

This endpoint can be used to list A/B tests of an organization. Status and tag-based filters can be applied to return specific A/B tests.

Request parameters

Parameter Value
status Filter records by status.

Possible values are - DRAFT, PENDING, COMPLETED, CANCELLED. In order to apply multiple status filters, include the parameter in query arguments as status[]=DRAFT&status[]=PENDING.
tags Filter records by tags.

In order to apply multiple tag filters, include the parameter in query arguments as tags[]=Tag1&tags[]=Tag2.
sort_by Sort records by field. Only value created_at is supported.

Default: created_at
sort_order Sort direction.

Possible values are ASC and DESC.

Default: ASC
limit Number of records to return per request.

If this parameter is not provided or has a value of 0, then limit is not applied and all records are returned.

Default: 10000
offset Page number. Value of 0 returns records from 0 to 10 000, 1 returns records from 10 001 to 20 000, etc.

Default: 0

Response parameters

Response is a JSON object.

Parameter Value
id A/B test ID. Numeric.
name A/B test name.
sections List of sections in the A/B test. Read the "Section object parameters'' section for more information.
tags List of A/B test tags.
created_at A/B test creation date.

Formatted as YYYY-MM-DD HH:MM:SS, and presented in Europe/Tallinn timezone.
completed_at A/B test completion date. Parameter has value only when the A/B test’s status is COMPLETED.

Formatted as YYYY-MM-DD HH:MM:SS, and presented in Europe/Tallinn timezone.
status A/B test status. Possible values: DRAFT, PENDING - sending still in progress, COMPLETED, CANCELLED.

Section object parameters

Parameter Value
id A/B test section ID. Numeric.
subject Section subject.
template Object of template used in the section.

Note! For deleted templates the value of “DELETED” is returned.

Read the "Template object parameters" section for more information.

Template object parameters

Note! For deleted templates the value of “DELETED” is returned.

Parameter Value
id Template ID. Numeric.
name Template name.
preview_url URL to template preview.

Example

$ curl -X GET -u "${USERNAME}:${PASSWORD}" \
  "https://${SUBDOMAIN}.sendsmaily.net/api/split.php"

(JavaScript/JSON)

[
  {
    "id": 1,
    "name": "My first A/B test",
    "sections": [
      {
        "id": 0,
        "subject": "My first A/B test",
        "template": {
          "id": 25,
          "name": "Testing new Call to Action",
          "preview_url": "https://<subdomain>.sendsmaily.net/template/preview/id/25"
        }
      },
      {
        "id": 1,
        "subject": "Old Call to Action test",
        "template": {
          "id": 19,
          "name": "Old template",
          "preview_url": "https://<subdomain>.sendsmaily.net/template/preview/id/19"
        }
      }
    ],
    "tags": ["Men"],
    "created_at": "2021-01-21 10:00:00",
    "completed_at": "2021-01-21 10:05:00",
    "status": "COMPLETED"
  },
  {
    "id": 3,
    "name": "A/B test name",
    "sections": [
      {
        "id": 0,
        "subject": "Name of the first section",
        "template": {
          "id": 25,
          "name": "Testing new Call to Action",
          "preview_url": "https://<subdomain>.sendsmaily.net/template/preview/id/25"
        }
      },
      {
        "id": 1,
        "subject": "Name of the second section",
        "template": "DELETED"
      }
    ],
    "tags": ["Women"],
    "created_at": "2021-01-21 10:00:00",
    "completed_at": null,
    "status": "PENDING"
  }
]