This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Customers

Customers endpoints of the MailWizz API.

    Customers endpoint

    // CREATE THE ENDPOINT
    $endpoint = new EmsApi\Endpoint\Customers();
    # CREATE THE ENDPOINT
    endpoint = Customers.new
    from mailwizz.endpoint.customers import Customers
    
    """
    CREATE THE ENDPOINT
    """
    endpoint = Customers()

    Create a customer

    // CREATE CUSTOMER
    $response = $endpoint->create([
        'customer' => [
            'first_name' => 'John',
            'last_name'  => 'Doe',
            'email'      => 'john.doe@doe.com',
            'password'   => 'superDuperPassword',
            'timezone'   => 'UTC',
            'birthDate'  => 'Y-m-d'
        ],
        // company is optional, unless required from app settings
        'company'  => [
            'name'     => 'John Doe LLC',
            'country'  => 'United States', // see the countries endpoint for available countries and their zones
            'zone'     => 'New York', // see the countries endpoint for available countries and their zones
            'city'     => 'Brooklyn',
            'zip_code' => 11222,
            'address_1'=> 'Some Address',
            'address_2'=> 'Some Other Address',
        ],
    ]);
    
    // DISPLAY RESPONSE
    echo '<hr /><pre>';
    print_r($response->body);
    echo '</pre>';
    # CREATE CUSTOMER
    response = endpoint.create(data = {
        'customer': {
            'first_name': 'John',
            'last_name': 'Doe',
            'email': 'john.doe@doe.com',
            'password': 'superDuperPassword',
            'timezone': 'UTC',
            'birthDate': '1979-07-30'
        },
        # company is optional, unless required from app settings
        'company': {
            'name': 'John Doe LLC',
            'country': 'United States', # see the countries endpoint for available countries and their zones
            'zone': 'New York', # see the countries endpoint for available countries and their zones
            'city': 'Brooklyn',
            'zip_code': 11222,
            'address_1': 'Some Address',
            'address_2': 'Some Other Address',
        },
    })
    
    # DISPLAY RESPONSE
    puts response.body
    """
    CREATE CUSTOMER
    """
    response = endpoint.create({
        'customer': {
            'first_name': 'John',
            'last_name': 'Doe',
            'email': 'john.doe@doe.com',
            'password': 'superDuperPassword',
            'timezone': 'UTC',
            'birthDate': '1979-07-30'
        },
        # company is optional, unless required from app settings
        'company': {
            'name': 'John Doe LLC',
            'country': 'United States',  # see the countries endpoint for available countries and their zones
            'zone': 'New York',  # see the countries endpoint for available countries and their zones
            'city': 'Brooklyn',
            'zip_code': 11222,
            'address_1': 'Some Address',
            'address_2': 'Some Other Address',
        },
    })
    
    """
    DISPLAY RESPONSE
    """
    print(response.content)

    The above command returns an object structured like this JSON:

    {
      "status": "success",
      "customer_uid": "wc149l7wdm9be"
    }
    

    This endpoint creates a customer

    HTTP Request

    POST API-URL/customers

    POST Parameters

    ParameterTypeRequiredDescription
    customerarrayyesThe array with the customer details.
    companyarraynoThe array with the company details if required by the MailWizz settings.

    Customer block

    ParameterTypeRequiredDescription
    first_namestringyesCustomer first name
    last_namestringyesCustomer last name
    emailstringyesCustomer email
    passwordstringyesCustomer password
    timezonestringyesCustomer timezone(i.e. UTC)
    birthDatestringyesCustomer birth date (YYYY-MM-DD)

    Company block

    ParameterTypeRequiredDescription
    namestringyesCompany name
    countrystringyesCompany country (See the Countries endpoint for available countries and zones)
    zonestringyesCompany zone
    citystringyesCompany city
    zip_codestringyesCompany zipcode
    address_1stringyesCompany address
    address_2stringyesCompany another address