1. Tworzenie subskrybenta za pomocą API

Metoda przeznaczona jest do tworzenia nowego subskrybenta w projekcie. Dane przekazywane są w formacie application/json.

Żądanie HTTP
  • URL: https://sender-solutions.com/api/subscribers/create-subscriber/
  • Metoda HTTP: POST
  • Content-Type: application/json
Treść żądania (JSON)
{
    "Subscriber": {
        "Base": {
            "Id": 0,
            "Name": "Test Users"
        },
        "IsActive": true,
        "Email": "username@example.com",
        "FirstName": "Cat",
        "LastName": "Catstone",
        "Gender": "male",
        "Phone": "+380111222333",
        "Tags": ["api", "test-user"],
        "ClientUserId": "ClientUserId3",
        "CustomField1": "CustomValue1",
        "CustomField2": "CustomValue2",
        "CustomField3": "CustomValue3",
        "Address": {
            "Country": "UA",
            "City": "Odesa",
            "State": null,
            "Zip": 65000,
            "Line1": "Very Long street",
            "Line2": "building 42",
            "Line3": null
        },
        "Birthday": "2002-04-15"
    }
}
Przykład żądania z użyciem cURL

curl --location 'https://sender-solutions.com/api/subscribers/create-subscriber/' \
--header 'Content-Type: application/json' \
--header 'Authorization: {{api-token}}' \
--data-raw '{
    "Subscriber": {
        "Base": {
            "Id": 0,
            "Name": "Test Users"
        },
        "IsActive": true,
        "Email": "username@example.com",
        "FirstName": "Cat",
        "LastName": "Catstone",
        "Gender": "male",
        "Phone": "+380111222333",
        "Tags": ["api", "test-user"],
        "ClientUserId": "ClientUserId12345",
        "CustomField1": "CustomValue1",
        "CustomField2": "CustomValue2",
        "CustomField3": "CustomValue3",
        "Address": {
            "Country": "UA",
            "City": "Odesa",
            "State": null,
            "Zip": 65000,
            "Line1": "Very Long street",
            "Line2": "building 42",
            "Line3": null
        },
        "Birthday": "2002-04-15"
    }
}'
Opis pól
Pole Typ Obowiązkowe Opis
Subscriber.Base.Id number Identyfikator bazy subskrybentów. Obowiązkowo musi być podane to pole albo Subscriber.Base.Name. Jeśli przekazać niepuste wartości w obu polach, priorytet ma Subscriber.Base.Id.
Subscriber.Base.Name string Nazwa bazy subskrybentów. Obowiązkowo musi być podane to pole albo Subscriber.Base.Id. Jeśli przekazać niepuste wartości w obu polach, priorytet ma Subscriber.Base.Id.
Subscriber.IsActive boolean Flaga aktywności subskrybenta. Domyślnie false.
Subscriber.Email string Email subskrybenta
Subscriber.FirstName string Imię
Subscriber.LastName string Nazwisko
Subscriber.Gender string Płeć subskrybenta. Możliwe wartości: "male" — męska, "female" — żeńska, "" (pusty ciąg znaków) — «Nie podano». Domyślnie — «Nie podano».
Subscriber.Phone string Numer telefonu
Subscriber.Tags array[string] Tagi subskrybenta, tablica ciągów znaków
Subscriber.ClientUserId string ID subskrybenta w systemie klienta
Subscriber.CustomField1 string Pole użytkownika 1. Wypełniaj dowolną informacją według własnego uznania.
Subscriber.CustomField2 string Pole użytkownika 2. Wypełniaj dowolną informacją według własnego uznania.
Subscriber.CustomField3 string Pole użytkownika 3. Wypełniaj dowolną informacją według własnego uznania.
Subscriber.Address.Country string Dwuznakowy kod kraju (ISO 3166-1 alpha-2)
Subscriber.Address.City string Miasto
Subscriber.Address.State string | null Region / stan / obwód
Subscriber.Address.Zip number Kod pocztowy
Subscriber.Address.Line1 string Główny wiersz adresu
Subscriber.Address.Line2 string Dodatkowy wiersz adresu
Subscriber.Address.Line3 string | null Dodatkowy wiersz adresu
Subscriber.Birthday string (YYYY-MM-DD) Data urodzenia w formacie YYYY-MM-DD
Przykład pomyślnej odpowiedzi. Zawiera dane utworzonego subskrybenta w tej samej strukturze co żądanie API. Zawiera również dodatkowe pole Subscriber.Id — identyfikator utworzonego subskrybenta.
{
    "success": true,
    "Subscriber": {
        "Id": 24,
        "Base": {
            "Id": 13,
            "Name": "Test Users"
        },
        "IsActive": true,
        "Email": "username@example.com",
        "FirstName": "Cat",
        "LastName": "Catstone",
        "Gender": "male",
        "Phone": "+380111222333",
        "Tags": [
            "api",
            "test-user"
        ],
        "ClientUserId": "ClientUserId12345",
        "CustomField1": "CustomValue1",
        "CustomField2": "CustomValue2",
        "CustomField3": "CustomValue3",
        "Address": {
            "Country": "UA",
            "City": "Odesa",
            "State": "",
            "Zip": "65000",
            "Line1": "Very Long street",
            "Line2": "building 42",
            "Line3": ""
        },
        "Birthday": "2002-04-15"
    }
}