CustomerAdd

CustomerAdd(
    object Customer
)

Add a Customer along with aliases, contacts, locations and fields.

Request

Request Data:
The customer object can contain the following properties:

  • (string) Name (required) the Customer’s name
  • (string) Website (optional) the Customer’s website
  • (array) Aliases (optional) a list of aliases for the Customer.
    If any of the provided aliases is already used the alias will be ignored.
    Each entry will have the following properties:
    • (string) Alias (required) the alias. It will be ignored if the alias is already used on an existant Customer.
  • (array) Locations (optional) a list of locations for the Customer.
    If none are provided, an empty primary location will be created for the customer.
    Each entry will have the following properties:
    • (bool) IsPrimary (optional) if this is the primary location.
      If multiple are marked primary, the last one will be the primary location.
      If none are marked as primary the first one will be the primary.
    • (string) Name (optional) the name for the location.
      If IsPrimary is true and a name is not provided the name will be “Primary”
    • (string) Address (optional) the address line
    • (string) City (optional) the city for this location’s address
    • (string) StateProvince (optional) the state/province for this location’s address
    • (string) ZipPostalCode (optional) the zip or postal code for this location’s address
  • (array) Contacts (optional) a list of contacts for the Customer.
    If none are provided, an empty primary contact will be created for the customer.
    Each entry will have the following properties:
    • (bool) IsPrimary (optional) if this is the primary contact.
      If multiple are marked primary, the last one will be the primary location.
      If none are marked as primary the first one will be the primary.
    • (object) Contact (optional) the contact information.
      • (string) FirstName (optional) – the contact first name.
      • (string) LastName (optional) – the contact last name.
      • (string) Email (optional) – the contact email.
      • (string) Salutation (optional) – the contact’s salutation.
      • (string) Title (optional) – the contact’s title.
      • (array) PhoneNumbers (optional) – a list of up to 4 phone numbers.
        Each entry will have the following properties:
        • (string) Number (optional) – the phone number.
        • (int) Type (required) – the phone number type. The valid types are: Business=1, Home=2, Fax=3, Other=6
  • (array) Fields (optional) a list of basic fields for the Customer.
    Each entry will have the following properties:
    • (string) Field (required) the field name
    • (string) Value (required) the field value
{
    "Customer": {
        "Name": <string>,
        "Website": <string>,
    	"Locations":[
			{
                "IsPrimary": <bool>,
                "Name": <string>,
                "Address": <string>,
                "City": <string>,
                "Country": <string>,
                "StateProvince": <string>,
                "ZipPostalCode": <string>
            }, 
            <... more Locations>
		],
        "Aliases":[
            {
                "Alias": <string>
            },
            <... more Aliases>
        ],
         "Contacts": [
            {
                "IsPrimary": <bool>,
                "Contact": {
                    "FirstName": <string>,
                    "LastName": <string>,
                    "Email": <string>,
                    "Salutation": <string>,
                    "Title": <string>,
                    "PhoneNumbers": [
                        {
                            "Number": <string>,
                            "Type": <enum: Business=1, Home=2, Fax=3, Other=6>
                        },
                        <... more Phone Numbers>
                   ],
                }
            },
            <...more Customer contacts>
        ],
        "Fields": [
            {
                "Field": <string>,
                "Value": <string>
            },
            <...more fields>
        ]
    }
}

Response

Same structure as api/Customer

Errors

  • “A customer name is required”
  • “A unique customer name is required”
  • “Unrecognized type for phone number: <int>” – if any of the phone numbers has a type that’s not one of the expected values, the passed value will be displayed.