Confirmations

Certain procedures initialized by your clients in the B2Core UI require confirmation with verification codes, which can be delivered to the clients via SMS.

Use these methods to configure SMS providers and manage templates used for delivering SMS to your clients.

GET[host]/api/v2/confirmations/providers

Get a list of SMS providers

GET[host]/api/v2/confirmations/providers/{providerId}

Get SMS provider details

GET[host]/api/v2/confirmations/providers/types

Get a list of SMS provider names

GET[host]/api/v2/confirmations/providers/types/{type}/settings

Get the configuration settings of an SMS provider

POST[host]/api/v2/confirmations/providers

Add an SMS provider

PATCH[host]/api/v2/confirmations/providers/{providerId}

Update an SMS provider

DELETE[host]/api/v2/confirmations/providers/{providerId}

Delete an SMS provider

GET[host]/api/v2/confirmations/templates

Get a list of confirmation templates

GET[host]/api/v2/confirmations/templates/{templateId}

Get confirmation template details

POST[host]/api/v2/confirmations/templates

Create a confirmation template

PATCH[host]/api/v2/confirmations/templates/{templateId}

Update a confirmation template

DELETE[host]/api/v2/confirmations/templates/{templateId}

Delete a confirmation template

Get a list of SMS providers

Use this method to obtain a list of SMS providers configured in the Back Office.

Request

Header parameters:

  • Authorization: Bearer <token>

Query parameters:

The following filter parameters are available for this method:

provider

The name of an SMS provider.

isEnabled

If true, a provider is enabled and used to deliver SMS to your clients; otherwise, false.

name

The name assigned to an SMS provider configuration.

caption

The name of an SMS provider configuration, used in the Back Office.

The following sorting parameter is available for this method:

createTime

The date and time when an SMS provider was configured.

Refer to the Query parameters section in the API Overview for details on applying filter and sorting parameters.

GET[host]/api/v2/confirmations/providers

curl --location -g 'https://host.name/api/v2/confirmations/providers?limit=10&offset=0&sort_order=desc&sort_by=createTime&filter[provider]=Fake&filter[isEnabled]=true&filter[name]=Fake&filter[caption]=Fake' \
--header 'Authorization: Bearer <token>' \
--header 'accept-language: ja'

Response

A response contains an array of SMS Provider objects including information about the providers matching the request parameters.


Get SMS provider details

Use this method to obtain detailed information about a specified SMS provider.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

providerId required

The identifier of an SMS provider.

GET[host]/api/v2/confirmations/providers/{providerId}

curl --location 'https://host.name/api/v2/confirmations/providers/1' \
--header 'Authorization: Bearer <token>'

Response

A response contains an SMS Provider object including information about the specified SMS provider.


Get a list of SMS provider names

Use this method to obtain a name list of SMS providers configured in the Back Office.

Request

Header parameters:

  • Authorization: Bearer <token>

GET[host]/api/v2/confirmations/providers/types

curl --location 'https://host.name/api/v2/confirmations/providers/types' \
--header 'Authorization: Bearer <token>'

Response

A response contains an array of string values specifying the names of SMS providers that can be used to deliver SMS to your clients.

RESPONSE EXAMPLE
[
    "Twilio",
    "Vonage",
    "SMSAero"
  ]

Get the configuration settings of an SMS provider

Use this method to obtain the configuration settings of a specific SMS provider.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

type required

The identifier of an SMS provider.

GET[host]/api/v2/confirmations/providers/types/{type}/settings

curl --location 'https://host.name/api/v2/confirmations/providers/types/Twilio/settings' \
--header 'Authorization: Bearer <token>'

Response

A response contains an array of objects providing data about the configuration settings of the specified SMS provider.

RESPONSE EXAMPLE
{
    "api_sid": {
        "label": "API sid",
        "rule": [
            "required"
        ],
        "class": "RabbitCMS\\Forms\\Controls\\Input",
        "name": "api_sid",
        "classes": [],
        "value": null,
        "messages": []
    },
    "api_secret": {
        "label": "API secret",
        "class": "RabbitCMS\\Forms\\Controls\\Password",
        "name": "api_secret",
        "rule": null,
        "classes": [],
        "value": null,
        "messages": []
    },
    "from": {
        "label": "Sender phone number",
        "rule": [
            "phone:AUTO",
            "required"
        ],
        "class": "RabbitCMS\\Forms\\Controls\\Input",
        "name": "from",
        "classes": [],
        "value": null,
        "messages": []
    }
}

Add an SMS provider

Use this method to configure a new SMS provider in the Back Office.

Request

Header parameters:

  • Authorization: Bearer <token>

Body:

Specify the following parameters for an SMS provider:

name string

The name that you want to assign to an SMS provider configuration.

caption string

The name of an SMS provider configuration, used in the Back Office.

provider string

The name of an SMS provider.

isEnabled boolean

If true, a provider is enabled and used for delivering SMS to your clients; otherwise, false.

options object

An array of objects indicating details specific to an SMS provider.

resources object

An array of resource objects specifying localized strings for user interface pages displayed to a client.

POST[host]/api/v2/confirmations/providers

curl --location --request POST 'https://host.name/api/v2/confirmations/providers' \
--header 'Authorization: Bearer <token>' \
--data '{
  "name": "Twilio",
  "caption": "Twilio SMS",
  "provider": "Twilio",
  "isEnabled": true,
  "options": {
    "api_sid": "API Sid",
    "api_secret": "API secret",
    "from": "+995595854561"
  },
  "resources": [
    {
      "key": "caption",
      "locale": "ru_RU",
      "value": "value"
    },
    {
      "key": "caption",
      "locale": "en_US",
      "value": "value"
    }
  ]
}'

Response

A response contains an SMS Provider object including information about the SMS provider that was configured.


Update an SMS provider

Use this method to update the configuration settings of a specified SMS provider.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

providerId required

The identifier of an SMS provider.

Body:

name string

The name assigned to an SMS provider configuration.

caption string

The name of an SMS provider configuration used in the Back Office.

provider string

The name of an SMS provider.

isEnabled boolean

If true, a provider is enabled and used for delivering SMS to your clients; otherwise, false.

priority integer

The priority index assigned to a confirmation provider.

options object

An array of objects indicating details specific to an SMS provider.

resources object

An array of resource objects specifying localized strings for user interface pages displayed to a client.

PATCH[host]/api/v2/confirmations/providers/{providerId}

curl --location --request PATCH 'https://host.name/api/v2/confirmations/providers/1' \
--header 'Authorization: Bearer <token>' \
--data '{
  "name": "Twilio",
  "caption": "Twilio SMS",
  "provider": "Twilio",
  "isEnabled": true,
  "priority": 1,
  "options": {
    "api_sid": "API Sid",
    "api_secret": "API secret",
    "from": "+995595854561"
  },
  "resources": [
    {
      "key": "caption",
      "locale": "ru_RU",
      "value": "value"
    },
    {
      "key": "caption",
      "locale": "en_US",
      "value": "value"
    }
  ]
}'

Response

A response contains an SMS Provider object including information about the configuration settings that were updated for the specified provider.


Delete an SMS provider

Use this method to delete a specified SMS provider.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

providerId required

The identifier of an SMS provider.

DELETE[host]/api/v2/confirmations/providers/{providerId}

curl --location --request DELETE 'https://host.name/api/v2/confirmations/providers/1' \
--header 'Authorization: Bearer <token>'

Response

In case of success, no response body is returned.


Get a list of confirmation templates

Use this method to obtain a list of templates used to deliver verification codes to clients via SMS. The codes are required to confirm certain procedures initiated by the clients in the B2Core UI.

Request

Header parameters:

  • Authorization: Bearer <token>

Query parameters:

The following filter parameters are available for this method:

isEnabled

If true, a template is enabled; otherwise, false.

name

The name of a confirmation template.

caption

The description of a confirmation template.

The following sorting parameter is available for this method:

createTime

The date and time when a template was created.

Refer to the Query parameters section in the API Overview for details on applying filter and sorting parameters.

GET[host]/api/v2/confirmations/templates

curl --location -g 'https://host.name/api/v2/confirmations/templates?limit=10&offset=0&sort_order=desc&sort_by=createTime&filter[isEnabled]=true&filter[name]=name&filter[caption]=caption' \
--header 'Authorization: Bearer <token>' \
--header 'accept-language: ja'

Response

A response contains an array of Confirmation Template objects providing information about the templates matching the request parameters.


Get confirmation template details

Use this method to obtain detailed information about a specified confirmation template.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

templateId required

The identifier of a confirmation template.

GET[host]/api/v2/confirmations/templates/{templateId}

curl --location 'https://host.name/api/v2/confirmations/templates/1' \
--header 'Authorization: Bearer <token>'

Response

A response contains a Confirmation Template object providing information about the specified template.


Create a confirmation template

Use this method to create a confirmation template.

Request

Header parameters:

  • Authorization: Bearer <token>

Body:

Specify the following parameters for a new confirmation template:

name string

The name of a confirmation template.

caption string

The description of a confirmation template.

template string

The text included in a template.

isEnabled boolean

If true, a template is enabled; otherwise, false.

resources object

An array of resource objects specifying localized strings for user interface pages displayed to a client.

POST[host]/api/v2/confirmations/templates

curl --location --request POST 'https://host.name/api/v2/confirmations/templates' \
--header 'Authorization: Bearer <token>' \
--data '{
  "name": "default",
  "caption": "Twilio Template",
  "template": "The verification code is %CODE%",
  "isEnabled": true,
  "resources": [
    {
      "key": "caption",
      "locale": "ru_RU",
      "value": "value"
    },
    {
      "key": "caption",
      "locale": "en_US",
      "value": "value"
    }
  ]
}'

Response

A response contains a Confirmation Template object providing information about the created template.


Update a confirmation template

Use this method to update a specified confirmation template.

Request

Header parameters:

  • Authorization: Bearer <token>

  • Content-Type: application/json

Path parameters:

templateId required

The identifier of a confirmation template.

Body:

The following field values can be updated for a confirmation template:

name string

The name of a confirmation template.

caption string

The description of a confirmation template.

template string

The text included in a template.

isEnabled boolean

If true, a template is enabled; otherwise, false.

priority string

The priority index assigned to a confirmation template.

resources object

An array of resource objects, specifying localized strings for user interface pages displayed to a client.

PATCH[host]/api/v2/confirmations/templates/{templateId}

curl --location --request PATCH 'https://host.name/api/v2/confirmations/templates/1' \
--header 'Authorization: Bearer <token>' \
--data '{
  "name": "default",
  "caption": "Twilio template",
  "template": "The verification code is %CODE%",
  "isEnabled": true,
  "priority": 1,
  "resources": [
    {
      "key": "caption",
      "locale": "ru_RU",
      "value": "value"
    },
    {
      "key": "caption",
      "locale": "en_US",
      "value": "value"
    }
  ]
}'

Response

A response contains a Confirmation Template object providing information about the confirmation template that was updated.


Delete a confirmation template

Use this method to delete a specified confirmation template.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

templateId required

The identifier of a confirmation template.

DELETE[host]/api/v2/confirmations/templates/{templateId}

curl --location --request DELETE 'https://host.name/api/v2/confirmations/templates/1' \
--header 'Authorization: Bearer <token>'

Response

In case of success, no response body is returned.