shop.customer.add

Adds a new customer.

Parameters

  • data POST

    Customer properties array with the following keys:
    — firstname First name.
    — middlename Middle name.
    — lastname Last name.
    — name Full name.
    — is_company Flag (0 or 1) denoting whether the new contact must be a company rather than a person (default value is 0).
    — sex Gender ('m' — male, 'f' — female).
    — birthday: Birthday information as an array with a single key 'value' and its value as a sub-array with the following keys: 'day' (day number), 'month' (month number), 'year' (year number).
    — locale Locale ID.
    — email Single email address as a string or an array of email addresses whose sub-arrays must contain values with the following keys, 'value' (email address), 'ext' (email address type: 'work', 'personal').
    — phone Single phone number or an array of phone numbers whose sub-arrays must contain values with the following keys: 'value' (phone number), 'ext' (phone number type: 'work', 'personal').
    — address Postal addresses. The sub-array of each addresses must contain values with the following keys: 'data' (array of address field values with the following keys: 'country' (3-letter country code), 'zip' (ZIP code), 'region' (region code), 'city' (locality name), 'street' (street address)), 'ext' (address type, optional: 'shipping', 'billing').
    — …: values of other contact fields added in the Webasyst system settings.

  • skip_validation POST Optional

    Flag (0 or 1) denoting that the data validation must be skipped. If set then data are attempted to be saved as specified while unacceptable values are ignored. Default value is 0 meaning that data validation is executed.

  • format GET Optional

    Sets response format. Available options: json (default), xml.

Return value

Array of values with the following keys:

  • contact_id int ID of the created contact, or null in case of an error.
  • errors array Array of error messages. Array keys are names of contact fields with invalid values.