# Test Requests

# Request a test

## Intro

When requesting a test, Texter will check the test node available.\
Texter responds with test details if there is a test node available for testing.

If Texter doesn’t have a test node available, or doesn't support the operator you want to test, the test details will be empty.

The test details will contain a message key that remains valid for only **one test message** via just **one supplier** for the given <<glossary:MSISDN>> .

> ❗️ Warning
>
> If you send multiple test messages with that same key (also via multiple suppliers), you will not get the result details of those messages

The <<glossary:MSISDN>> will be given in the international <<glossary:E.164>> notation with leading zeroes as number prefix by default.

The number prefix can be changed in the Texter app to one of the following options:

| Formatting Style         | Example         |
| ------------------------ | --------------- |
| Leading zeroes (default) | `0031601234567` |
| Plus                     | `+31601234567`  |
| No leading zeroes        | `31601234567`   |

## Single test request

Request a single test at Texter.

If you want to perform multiple tests right after each other, use the multi test requests call.

### Request

`POST https://api.cmtelecom.com/texter/v1/testrequest/{texterProductAccount}`

### Request body

| Field             | Required | Type    | Description                                                                                                                                          |
| ----------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| mccMnc            | yes      | string  | Operator you want to test.                                                                                                                           |
| testDuration      | no       | integer | Test duration in minutes until Texter expires the test with no delivered result (min = 1, max = 60, default = 5).                                    |
| portabilityStatus | no       | integer | Portability status that the test node must have (0 = Ignore, 1 = Non ported, 2 = Ported, default = 0).                                               |
| resultApiUrl      | no       | string  | Callback URL which receives the result reports. If this is not given, then Texter will use the general callback URL if configured in the Texter app. |

```json
{
  "mccMnc": "20416",
  "testDuration": 5,
  "portabilityStatus": 0,
  "resultApiUrl": "https://cm.com/callback"
}
```

### Response

| Field                      | Type    | Description                                                                                                          |
| -------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
| details                    | string  | Status message of the requested test (Operator not supported, No candidate available, Found an available candidate). |
| mccMnc                     | string  | Requested operator.                                                                                                  |
| requestedPortabilityStatus | integer | Requested portability status.                                                                                        |
| test                       | object  | Test information, is null if no online test node could be found. (See below)                                         |

### Test

| Field                       | Type   | Description                                                                       |
| --------------------------- | ------ | --------------------------------------------------------------------------------- |
| id                          | string | Code identifier of your test.                                                     |
| msisdn                      | string | Phone number of test node.                                                        |
| isMsisdnNetworkPorted       | bool   | Is the <<glossary:MSISDN>> a ported number, can be null if the status is unknown. |
| messageKey                  | string | Set of 16 characters that must be in your text message.                           |
| preferredAlphaNumericSender | string | Alphanumeric sender suggestion to use in your text message.                       |
| preferredNumericSender      | string | Numeric sender suggestion to use in your text message.                            |

```json
{
  "details": "Found an available candidate",
  "mccMnc": "20416",
  "requestedPortabilityStatus": 0,
  "test": {
    "id": "20a82d0c-60f7-4895-9eec-8438dcebcf38",
    "msisdn": "0031611223344",
    "isMsisdnNetworkPorted": false,
    "messageKey": "atchint umge din",
    "preferredAlphaNumericSender": "abisizoldel",
    "preferredNumericSender": "00778279878279"
  }
}
```

## Multi test requests

You can request multiple Texter tests for a batch of operators you want to test.\
Operators can be included multiple times in the batch if you want to send multiple tests for the same operator.

### Request

`POST https://api.cmtelecom.com/texter/v1/testrequest/multiple/{texterProductAccount}`

### Request body

| Field             | Required | Type    | Description                                                                                                                                          |
| ----------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| mccMnc            | yes      | string  | Operator you want to test.                                                                                                                           |
| testDuration      | no       | integer | Test duration in minutes until Texter expires the test with no delivered result (min = 1, max = 60, default = 5).                                    |
| portabilityStatus | no       | integer | Portability status that the test node must have (0 = Ignore, 1 = Non ported, 2 = Ported, default = 0).                                               |
| resultApiUrl      | no       | string  | Callback URL which receives the result reports. If this is not given, then Texter will use the general callback URL if configured in the Texter app. |

```json
[
  {
    "mccMnc": "20416",
    "testDuration": 5,
    "portabilityStatus": 0,
    "resultApiUrl": "https://cm.com/callback"
  },
  {
    "mccMnc": "20400",
    "testDuration": 3,
    "portabilityStatus": 1,
    "resultApiUrl": "https://cm.com/callback"
  },
  {
    "mccMnc": "20416",
    "testDuration": 5,
    "portabilityStatus": 2,
    "resultApiUrl": "https://cm.com/callback"
  }
]
```

### Response

| Field                      | Type    | Description                                                                                                          |
| -------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
| details                    | string  | Status message of the requested test (Operator not supported, No candidate available, Found an available candidate). |
| mccMnc                     | string  | Requested operator.                                                                                                  |
| requestedPortabilityStatus | integer | Requested portability status.                                                                                        |
| test                       | object  | Test information, is null if no online test node could be found. (See below)                                         |

### Test

| Field                       | Type   | Description                                                                       |
| --------------------------- | ------ | --------------------------------------------------------------------------------- |
| id                          | string | Code identifier of your test.                                                     |
| msisdn                      | string | Phone number of test node.                                                        |
| isMsisdnNetworkPorted       | bool   | Is the <<glossary:MSISDN>> a ported number, can be null if the status is unknown. |
| messageKey                  | string | Set of 16 characters that must be in your text message.                           |
| preferredAlphaNumericSender | string | Alphanumeric sender suggestion to use in your text message.                       |
| preferredNumericSender      | string | Numeric sender suggestion to use in your text message.                            |

```json
[
  {
    "details": "Found an available candidate",
    "mccMnc": "20416",
    "requestedPortabilityStatus": 0,
    "test": {
      "id": "20a82d0c-60f7-4895-9eec-8438dcebcf38",
      "msisdn": "0031611223344",
      "isMsisdnNetworkPorted": false,
      "messageKey": "atchint umge din",
      "preferredAlphaNumericSender": "abisizoldel",
      "preferredNumericSender": "00778279878279"
    }
  },
  {
    "details": "Operator not supported",
    "mccMnc": "20400",
    "requestedPortabilityStatus": 0,
    "test": null
  },
  {
    "details": "Found an available candidate",
    "mccMnc": "20416",
    "requestedPortabilityStatus": 2,
    "test": {
      "id": "388BA892-6C20-4977-9585-E58F9CD49DB8",
      "msisdn": "0031655667788",
      "isMsisdnNetworkPorted": true,
      "messageKey": "ste whomeblughte",
      "preferredAlphaNumericSender": "lindopeabip",
      "preferredNumericSender": "00105580205580"
    }
  }
]
```