Management of recipients in the group

Creating a recipient in a group

Exammple of json data for HTTP request:

{
  "email":"alice@example.org",
  "unconfirmed": true,
  "values":[
    {
      "parameter_id":"1",
      "value":"Alice"
    },
    {
      "parameter_id":"2",
      "value":"22"
    }
  ]
}


 

Example of an HTTP request:

curl -X POST https://api.msndr.net/v1/email/lists/1/recipients \
     -H 'Content-Type: application/json'                       \
     -H 'Authorization: Bearer $API_TOKEN'                     \
     -d '...JSON...'


 

It uses the POST method and a link /email/lists/:id/recipients

where id is the recipient group identifier

Example response for a successful HTTP request:

{
  "id":1,
  "email":"alice@example.org",
  "confirmed":false,
  "list_id":1,
  "status": "active",
  "values":[
    {
      "value":"Alice",
      "kind":"string",
      "parameter_id":1
    },
    {
      "value":22.0,
      "kind":"numeric",
      "parameter_id":2
    }
  ]
}


 

The request parameters:

Parameter

Description

Mandatory

email

Recipient email address

yes

unconfirmed

Creates an unconfirmed recipient. Any value such as true, t or 1 must be specified. The default is to create a confirmed recipient.

no

values

Array of values for parameters

no

The parameters of the elements of the values and their description:

Parameter

Description

Mandatory

parameter_id

recipient group parameter id

yes

value

 

yes

The description of the attributes of the json response from the server:

Attribute

Description

id

identifier

email

Email adress of the recipient

confirmed

Recipient confirmed or not

status

Recipient status. Possible values: active, incorrect, unconfirmed, unsubscribed

values

Array of values

Explanation of the attributes of the elements of the values array in the json response of the server:

Parameter

Description

parameter_id

Recipient group parameter ID

kind

type of parameter

value

parameter value

Getting information about a recipient in a group

HTTP request example:

curl -X GET https://api.msndr.net/v1/email/lists/1/recipients/2 \
     -H 'Content-Type: application/json'                   \
     -H 'Authorization: Bearer $API_TOKEN'


 

Here the GET method is used and the link /email/lists/:list_id/recipients/:id

where list_id is the recipient group identifier, and id is the recipient's id

An example of a response in case of a successful request:

{
  "id":2,
  "email":"alice@example.org",
  "confirmed":false,
  "list_id":1,
  "status": "active",
  "values":[
    {
      "value":"Alice",
      "kind":"string",
      "parameter_id":1
    },
    {
      "value":22.0,
      "kind":"numeric",
      "parameter_id":2
    }
  ]
}
 

The table below explains the HTTP request parameters:

Parameter    

Description           

Mandatory

list_id

group ID

yes

id

recipient ID

yes

server response json attributes:

Attribute         

Description           

id

Recipient ID

email

Email address of the recipient

confirmed

Recipient confirmed or not

status

Recipient status. Possible values: active, incorrect, unconfirmed, unsubscribed

values

Array of values

 

Explanation of the attributes of the elements of the values array in the json response of the server:

Parameter

Description

parameter_id

Recipient group parameter ID

kind

Parameter type

value

Value

 

Editing recipient parameters in a group:

Example of json data for HTTP request:

{
  "email":"alice@example.org",
  "values":[
    {
      "parameter_id":"1",
      "value":"Alice"
    },
    {
      "parameter_id":"2",
      "destroy":"true"
    }
  ]
}


 

Example of an HTTP request:

curl -X PATCH https://api.msndr.net/v1/email/lists/1/recipients/1 \
     -H 'Content-Type: application/json'                     \
     -H 'Authorization: Bearer $API_TOKEN'                   \
     -d '...JSON...'


 

The PATCH method is used and the link /email/lists/:list_id/recipients/:id

where list_id is the recipient group identifier, id is the recipient identifier

An example of a response in case of a successful request:

{
  "id":1,
  "email":"alice@example.org",
  "confirmed":true,
  "status": "active",
  "list_id":1,
  "values":[
    {
      "value":"Alice",
      "kind":"string",
      "parameter_id":1
    }
  ]
}


 

An explanation of the request parameters:

Parameter     

Description

Mandatory   

email

Email address of the recipient

no

values

Array of values for parameters       

 

Parameters of an element of the values array in an HTTP request

Parameter

Description

Обязательный

parameter_id

Recipient group parameter ID

Да

value

Cannot be used simultaneously with the destroy parameter

Нет

destroy

Used to delete a value. Any value such as true, t or 1 must be specified to delete a value.
Cannot be used at the same time with the value parameter

 

attributes in the json response from the server:

Attribute           

Description

id

identifier

email

adress

confirmed

Recipient confirmed or not

status

Recipient status. Possible values: active, incorrect, unconfirmed, unsubscribed

values

Array of values

parameters of elements of the values array in the json response of the server:

Parameter

Description

parameter_id

Recipient group parameter ID

kind

Parameter type

value

Parameter value

Getting the list of recipients in a group

HTTP request example:

curl -X GET https://api.msndr.net/v1/email/lists/1/recipients \
     -H 'Content-Type: application/json'                 \
     -H 'Authorization: Bearer $API_TOKEN'


 

Here we use the GET method and the link /email/lists/:id/recipients

Where id is the id of the recipient group

This method supports paginated output. The maximum page size is 1000

 

Example json response in case of successful request:

{
  "total_count":2,
  "total_pages":1,
  "page_number":1,
  "page_size":25,
  "collection":[
    {
      "id":1,
      "email":"alice@example.org",
      "confirmed":true,
      "status": "active",
      "list_id":1,
      "values":[
        {
          "value":"Alice",
          "kind":"string",
          "parameter_id":9
        },
        {
          "value":22.0,
          "kind":"numeric",
          "parameter_id":10
        }
      ]
    },
    {
      "id":2,
      "email":"bob@example.org",
      "confirmed":true,
      "status": "active",
      "list_id":1,
      "values":[
      ]
    }
  ]
}


 

Parameters of elements of recipient array (collection) of json response from server :

Attribute          

Description

id

Recipient identifier

email

Email address of the recipient

confirmed

Recipient confirmed or not

status

Recipient status. Possible values: active, incorrect, unconfirmed, unsubscribed

values

Array of values

parameters of the elements of the values array for each recipient:

Parameter

Description

parameter_id

Recipient group parameter ID

kind

Parameter type

value

Parameter value

Deleting a recipient in a group

 

HTTP request example:

curl -X DELETE https://api.msndr.net/v1/email/lists/1/recipients/1 \
     -H 'Content-Type: application/json'                      \
     -H 'Authorization: Bearer $API_TOKEN'
 

 

DELETE method and the /email/lists/:list_id/recipients/:id link are used

Where list_id is the recipient group id, id is the recipient id.

Importing a large number of recipients into a recipient group

Example of json data for HTTP request:

{
  "recipients":[
    {
      "email":"alice@example.org",
      "values":[
        {
          "parameter_id":"1",
          "value":"Alice"
        },
        {
          "parameter_id":"2",
          "value":"22"
        }
      ]
    },
    {
      "email":"bob@example.org",
      "values":[
        {
          "parameter_id":"1",
          "value":"Bob"
        },
        {
          "parameter_id":"2",
          "value":"11"
        }
      ]
    }
  ]
}


 

HTTP request example:

curl -X POST https://api.msndr.net/v1/email/lists/1/recipients/imports \
     -H 'Content-Type: application/json'                       \
     -H 'Authorization: Bearer $API_TOKEN'                     \
     -d '...JSON...'

 

POST method and link /email/lists/:id/recipients/imports is used

Where id is the id of the recipient group

Example of json response in case of successful request:

{
  "id":7,
  "status":"queued"
}


The parameters in the HTTP request json data

Parameter                 

Description

Mandatory    

recipients

Array of recipients. Maximum size 10000

yes

run_triggers

Run the linked triggers. Any value such as true, t or 1 must be set.

no

Description of the parameters of the recipient array elements (recipients) to be imported:

Parameter       

Description

Mandatory         

email

Email address of the recipient

yes

values

Array of values for parameters           

 

Description of the parameters of the elements of the values array for each recipient:

Parameter       

Description

Mandatory         

parameter_id

Recipient group parameter ID             

yes

value

 

yes

Server response json parameters:

Parameter       

Description

id

Import identifier. Can be used later to get information about the import progress

status

Import status of the recipients

Recipient search by email address

HTTP request example:

curl -X GET https://api.msndr.net/v1/email/recipients/search?email=foo@bar.com \
     -H 'Content-Type: application/json'                                  \
     -H 'Authorization: Bearer $API_TOKEN'

The GET method and the link /email/recipients/search is used here

An example of a response in case of a successful HTTP request:

{
  "total_count": 2,
  "total_pages": 1,
  "page_number": 1,
  "page_size": 25,
  "collection": [
    {
      "email": "foo@bar.com",
      "recipients": [
        {
          "list_id": 1,
          "list_title": "List #1",
          "recipient_id": 1
        },
        {
          "list_id": 2,
          "list_title": "List #2",
          "recipient_id": 2
        }
      ]
    }
  ],
  "query": "test"
}


 

HTTP request parameters

Parameter

Description

Mandatory

email

Email address of the recipient

yes

Parameters of the items in the recipients array in the server's json response:

Attribute Description
email     Email address of the recipient
recipients           An array containing information about the lists that contain the searched recipient

 

 

Have you tried Cloud4U cloud services? Not yet?

Go to the Main Website

Try for free

  • 57 Users Found This Useful
Was this answer helpful?

Related Articles

Получение текущего баланса

Чтобы получить информацию по вашему балансу нужно выполнить следующий HTTP запрос: curl -X GET...

Управление организациями

Создание организации Пример json данных для HTTP запроса: { "name":"My Organization",...

Управление рассылками

Создание рассылки  Пример json данных для HTTP запроса: { "from_email":"hello@world.com",...

Механизм Webhooks

Механизм Webhooks позволяет получать POST запросы на указанный вами URL в случае возникновения...

Отправка сообщений по SMTP

Базовый URL smtp.msndr.net Порт 25 или 587 Использование шифрования SSL\TLS не является...