This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Customers in Vend


Overview

The following operations allow you to work with customers. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with customers, see Sample configuration

OperationDescription

createCustomer

Creates a customer.

updateCustomer

Updates customer details.

listCustomersRetrieves all customers.

Operation details

This section provides further details on the operations related to customers.

Creating a new customer

The createCustomer operation creates a new customer. 

createCustomer
<vend.createCustomer>
    <customerCode>{$ctx:customerCode}</customerCode>
    <companyName>{$ctx:companyName}</companyName>
    <firstName>{$ctx:firstName}</firstName>
    <lastName>{$ctx:lastName}</lastName>
    <phone>{$ctx:phone}</phone>
    <mobile>{$ctx:mobile}</mobile>
    <fax>{$ctx:fax}</fax>
    <email>{$ctx:email}</email>
    <website>{$ctx:website}</website>
    <physicalAddress1>{$ctx:physicalAddress1}</physicalAddress1>
    <physicalAddress2>{$ctx:physicalAddress2}</physicalAddress2>
    <physicalSuburb>{$ctx:physicalSuburb}</physicalSuburb>
    <physicalCity>{$ctx:physicalCity}</physicalCity>
    <physicalPostcode>{$ctx:physicalPostcode}</physicalPostcode>
    <physicalState>{$ctx:physicalState}</physicalState>
    <physicalCountryId>{$ctx:physicalCountryId}</physicalCountryId>
    <postalAddress1>{$ctx:postalAddress1}</postalAddress1>
    <postalAddress2>{$ctx:postalAddress2}</postalAddress2>
    <postalSuburb>{$ctx:postalSuburb}</postalSuburb>
    <postalCity>{$ctx:postalCity}</postalCity>
    <postalPostcode>{$ctx:postalPostcode}</postalPostcode>
    <postalState>{$ctx:postalState}</postalState>
    <postalCountryId>{$ctx:postalCountryId}</postalCountryId>
    <customerGroupId>{$ctx:customerGroupId}</customerGroupId>
    <customerGroupName>{$ctx:customerGroupName}</customerGroupName>
    <twitter>{$ctx:twitter}</twitter>
    <enableLoyalty>{$ctx:enableLoyalty}</enableLoyalty>
    <dateOfBirth>{$ctx:dateOfBirth}</dateOfBirth>
    <sex>{$ctx:sex}</sex>
    <customField1>{$ctx:customField1}</customField1>
    <customField2>{$ctx:customField2}</customField2>
    <customField3>{$ctx:customField3}</customField3>
    <customField4>{$ctx:customField4}</customField4>
	<note>{$ctx:note}</note>
</vend.createCustomer>
Properties
  • customerCode: The unique identifier for the customer.
  • companyName: Name of the company the customer belongs to.
  • firstName: First name of the customer.
  • lastName: Last name of the customer.
  • phone: Fixed number of the customer.
  • mobile: Mobile number of the customer.
  • fax: Fax of the customer
  • email: E-mail of the customer.
  • website: Website of the customer.
  • physicalAddress1: Address line 1 of the customer.
  • physicalAddress2: Address line 2 of the customer.
  • physicalSuburb: Suburb of the customer.
  • physicalCity: City of the customer.
  • physicalPostcode: Post code of the customer.
  • physicalState: State of the customer.
  • physicalCountryId: The ID of the country of the customer.
  • postalAddress1: Postal Address line 1 of the customer.
  • postalAddress2: Postal Address line 2 of the customer.
  • postalSuburb: Postal suburb of the customer.
  • postalCity: Postal city of the customer.
  • postalPostcode: Postal post code of the customer.
  • postalState: Postal state of the customer.
  • postalCountryId: Postal country ID of the customer.
  • customerGroupId: The ID of the group to which the customer will be put.
  • customerGroupName: Name of the group to which the customer will be put.
  • twitter: Twitter ID of the customer.
  • enableLoyalty: Indicates whether or not to enable loyalty for the customer.
  • dateOfBirth: Date of birth of the customer.
  • sex: Gender of the customer.
  • customField1: Custom Field 1 of the customer.
  • customField2: Custom Field 2 of the customer.
  • customField3: Custom Field 3 of the customer.
  • customField4: Custom Field 4 of the customer.
  • note: Note of the customer.
   Sample request

Following is a sample REST/JSON request that can be handled by the createCustomer operation.

Sample Request for createCustomer
{
    "apiUrl": "https://hormondri.vendhq.com",
    "accessToken": "Rd29HhdkxQq0b5pA1Litw8G05KFF3A3JZK0pQfQL",
    "customerCode": "michael-beven-0001",
    "companyName": "ZipBase Solutions",
    "firstName": "Michael",
    "lastName": "Beven",
    "phone": "0116854425",
    "mobile": "011921456",
    "fax": "0119460019",
    "email": "sample.customer.email001@gmail.com",
    "website": "www.customer001.com",
    "physicalAddress1": "123 Marine Drive",
    "physicalAddress2": "Colombo 06",
    "physicalSuburb": "Wellawatte",
    "physicalCity": "Colombo",
    "physicalPostcode": "00600",
    "physicalState": "Western",
    "physicalCountryId": "US",
    "postalAddress1": "123 Marine Drive",
    "postalAddress2": "Colombo 06",
    "postalSuburb": "Wellawatte",
    "postalCity": "Colombo",
    "postalPostcode": "00600",
    "postalState": "Western",
    "postalCountryId": "US",
    "customerGroupId": "dc85058a-a6e7-11e5-e112-55e29f89e655",
    "customerGroupName": "Millennials",
    "twitter": "spalamayuran@twitter.com",
    "enableLoyalty": "1",
    "dateOfBirth": "1989-04-18",
    "sex": "Male",
    "customField1": "custom_field_1",
    "customField2": "custom_field_2",
    "customField3": "custom_field_3",
    "customField4": "custom_field_4",
    "note": "Sample note"
}
Related Vend documentation

 https://developers.vendhq.com/documentation/api/0.x/customers.html#post-api-customers 

Updating customer details

The updateCustomer operation updates customer details.

updateCustomer
<vend.updateCustomer>
	<customerCode>{$ctx:customerCode}</customerCode>
    <companyName>{$ctx:companyName}</companyName>
    <firstName>{$ctx:firstName}</firstName>
    <lastName>{$ctx:lastName}</lastName>
    <phone>{$ctx:phone}</phone>
    <mobile>{$ctx:mobile}</mobile>
    <fax>{$ctx:fax}</fax>
    <email>{$ctx:email}</email>
    <website>{$ctx:website}</website>
    <physicalAddress1>{$ctx:physicalAddress1}</physicalAddress1>
    <physicalAddress2>{$ctx:physicalAddress2}</physicalAddress2>
    <physicalSuburb>{$ctx:physicalSuburb}</physicalSuburb>
    <physicalCity>{$ctx:physicalCity}</physicalCity>
    <physicalPostcode>{$ctx:physicalPostcode}</physicalPostcode>
    <physicalState>{$ctx:physicalState}</physicalState>
    <physicalCountryId>{$ctx:physicalCountryId}</physicalCountryId>
    <postalAddress1>{$ctx:postalAddress1}</postalAddress1>
    <postalAddress2>{$ctx:postalAddress2}</postalAddress2>
    <postalSuburb>{$ctx:postalSuburb}</postalSuburb>
    <postalCity>{$ctx:postalCity}</postalCity>
    <postalPostcode>{$ctx:postalPostcode}</postalPostcode>
    <postalState>{$ctx:postalState}</postalState>
    <postalCountryId>{$ctx:postalCountryId}</postalCountryId>
    <customerGroupId>{$ctx:customerGroupId}</customerGroupId>
    <customerGroupName>{$ctx:customerGroupName}</customerGroupName>
    <twitter>{$ctx:twitter}</twitter>
    <enableLoyalty>{$ctx:enableLoyalty}</enableLoyalty>
    <dateOfBirth>{$ctx:dateOfBirth}</dateOfBirth>
    <sex>{$ctx:sex}</sex>
    <customField1>{$ctx:customField1}</customField1>
    <customField2>{$ctx:customField2}</customField2>
    <customField3>{$ctx:customField3}</customField3>
    <customField4>{$ctx:customField4}</customField4>
    <note>{$ctx:note}</note>
	<customerId>{$ctx:customerId}</customerId>
</vend.updateCustomer>
Properties
  • customerCode: The unique identifier for the customer.
  • companyName: Name of the company the customer belongs to.
  • firstName: First name of the customer.
  • lastName: Last name of the customer.
  • phone: Fixed number of the customer.
  • mobile: Mobile number of the customer.
  • fax: Fax of the customer
  • email: E-mail of the customer.
  • website: Website of the customer.
  • physicalAddress1: Address line 1 of the customer.
  • physicalAddress2: Address line 2 of the customer.
  • physicalSuburb: Suburb of the customer.
  • physicalCity: City of the customer.
  • physicalPostcode: Post code of the customer.
  • physicalState: State of the customer.
  • physicalCountryId: The ID of the country of the customer.
  • postalAddress1: Postal Address line 1 of the customer.
  • postalAddress2: Postal Address line 2 of the customer.
  • postalSuburb: Postal suburb of the customer.
  • postalCity: Postal city of the customer.
  • postalPostcode: Postal post code of the customer.
  • postalState: Postal state of the customer.
  • postalCountryId: Postal country ID of the customer.
  • customerGroupId: The ID of the group to which the customer will be put.
  • customerGroupName: Name of the group to which the customer will be put.
  • twitter: Twitter ID of the customer.
  • enableLoyalty: Indicates whether or not to enable loyalty for the customer.
  • dateOfBirth: Date of birth of the customer.
  • sex: Gender of the customer.
  • customField1: Custom Field 1 of the customer.
  • customField2: Custom Field 2 of the customer.
  • customField3: Custom Field 3 of the customer.
  • customField4: Custom Field 4 of the customer.
  • note: Note of the customer.
  • customerId: The ID of the customer to update.
   Sample request

Following is a sample REST/JSON request that can be handled by the updateCustomer operation.

Sample Request for updateCustomer
{
    "apiUrl": "https://hormondri.vendhq.com",
    "accessToken": "Rd29HhdkxQq0b5pA1Litw8G05KFF3A3JZK0pQfQL",
    "customerId":"dc85058a-a6e7-11e5-e112-55e16e066dbf",
    "customerCode": "891091893v-updated",
    "companyName": "BeSafe Solutions-updated",
    "firstName": "Palamayuran-updated",
    "lastName": "Surenthiran-updated",
    "phone": "0116854420",
    "mobile": "011921450",
    "fax": "0119460010",
    "email": "sample.palamayuran.email001-updated@gmail.com",
    "website": "www.palamayuran001-updated.com",
    "physicalAddress1": "123 Marine Drive-updated",
    "physicalAddress2": "Colombo 06-updated",
    "physicalSuburb": "Wellawatte-updated",
    "physicalCity": "Colombo-updated",
    "physicalPostcode": "00700",
    "physicalState": "Western-updated",
    "physicalCountryId": "IN",
    "postalAddress1": "123 Marine Drive-updated",
    "postalAddress2": "Colombo 06-updated",
    "postalSuburb": "Wellawatte-updated",
    "postalCity": "Colombo-updated",
    "postalPostcode": "00700",
    "postalState": "Western-updated",
    "postalCountryId": "IN",
    "customerGroupId": "dc85058a-a6e7-11e5-e112-55e29f89e655",
    "customerGroupName": "Millennials",
    "twitter": "spalamayuran-updated@twitter.com",
    "enableLoyalty": "1",
    "dateOfBirth": "1989-04-19",
    "sex": "Female",
    "customField1": "custom_field_1-updated",
    "customField2": "custom_field_2-updated",
    "customField3": "custom_field_3-updated",
    "customField4": "custom_field_4-updated",
    "note": "Sample note-updated"
}
Related Vend documentation

 https://developers.vendhq.com/documentation/api/0.x/customers.html#update

Retrieving all customers

The listCustomers operation retrieves all customers.

listCustomers
<vend.listCustomers>
    <id>{$ctx:id}</id>
    <code>{$ctx:code}</code>
    <email>{$ctx:email}</email>
	<since>{$ctx:since}</since>
</vend.listCustomers>
Properties
  • id: If included, searches for customers with the given unique ID. The ID option cannot be used with the code or e-mail options.
  • code: If included, searches for customers with the given customer code. The code option cannot be used with ID or e-mail options.
  • email: If included, searches for customers with the given e-mail address. This is an exact match search. The e-mail option cannot be used with the ID or code options.
  • since: If included, searches for customers modified since the given time. The provided date and time should be in UTC and formatted according to ISO 8601.
   Sample request

Following is a sample REST/JSON request that can be handled by the listCustomers operation.

Sample Request for listCustomers
{
    "apiUrl": "https://hormondri.vendhq.com",
    "accessToken": "Rd29HhdkxQq0b5pA1Litw8G05KFF3A3JZK0pQfQL",
    "id": "dc85058a-a6e7-11e5-e112-52cb9cbb679a",
    "code": "UNNAMED-F269",
    "email": "sample.email@gmail.com",
    "since": "2015-09-04 06:10:16"
}
Related Vend documentation

 https://developers.vendhq.com/documentation/api/0.x/customers.html#get-api-customers

Sample configuration

Following is a sample proxy service that illustrates how to connect to Vend with the init operation and use the createCustomer operation. The sample request for this proxy can be found in the createCustomer sample request.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="vend_createCustomer" startOnLoad="true" statistics="disable" trace="disable" transports="https,http" xmlns="http://ws.apache.org/ns/synapse">
   <target>
      <inSequence onError="faultHandlerSeq">
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="accessToken" expression="json-eval($.accessToken)"/>
         <property name="customerCode" expression="json-eval($.customerCode)"/>
         <property name="companyName" expression="json-eval($.companyName)"/>
         <property name="firstName" expression="json-eval($.firstName)"/>
         <property name="lastName" expression="json-eval($.lastName)"/>
         <property name="phone" expression="json-eval($.phone)"/>
         <property name="mobile" expression="json-eval($.mobile)"/>
         <property name="fax" expression="json-eval($.fax)"/>
         <property name="email" expression="json-eval($.email)"/>
         <property name="website" expression="json-eval($.website)"/>
         <property name="physicalAddress1" expression="json-eval($.physicalAddress1)"/>
         <property name="physicalAddress2" expression="json-eval($.physicalAddress2)"/>
         <property name="physicalSuburb" expression="json-eval($.physicalSuburb)"/>
         <property name="physicalCity" expression="json-eval($.physicalCity)"/>
         <property name="physicalPostcode" expression="json-eval($.physicalPostcode)"/>
         <property name="physicalState" expression="json-eval($.physicalState)"/>
         <property name="physicalCountryId" expression="json-eval($.physicalCountryId)"/>
         <property name="postalAddress1" expression="json-eval($.postalAddress1)"/>
         <property name="postalAddress2" expression="json-eval($.postalAddress2)"/>
         <property name="postalSuburb" expression="json-eval($.postalSuburb)"/>
         <property name="postalCity" expression="json-eval($.postalCity)"/>
         <property name="postalPostcode" expression="json-eval($.postalPostcode)"/>
         <property name="postalState" expression="json-eval($.postalState)"/>
         <property name="postalCountryId" expression="json-eval($.postalCountryId)"/>
         <property name="customerGroupId" expression="json-eval($.customerGroupId)"/>
         <property name="customerGroupName" expression="json-eval($.customerGroupName)"/>
         <property name="twitter" expression="json-eval($.twitter)"/>
         <property name="enableLoyalty" expression="json-eval($.enableLoyalty)"/>
         <property name="dateOfBirth" expression="json-eval($.dateOfBirth)"/>
         <property name="sex" expression="json-eval($.sex)"/>
         <property name="customField1" expression="json-eval($.customField1)"/>
         <property name="customField2" expression="json-eval($.customField2)"/>
         <property name="customField3" expression="json-eval($.customField3)"/>
         <property name="customField4" expression="json-eval($.customField4)"/>
         <property name="note" expression="json-eval($.note)"/>
         <vend.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <accessToken>{$ctx:accessToken}</accessToken>
         </vend.init>
         <vend.createCustomer>
            <customerCode>{$ctx:customerCode}</customerCode>
            <companyName>{$ctx:companyName}</companyName>
            <firstName>{$ctx:firstName}</firstName>
            <lastName>{$ctx:lastName}</lastName>
            <phone>{$ctx:phone}</phone>
            <mobile>{$ctx:mobile}</mobile>
            <fax>{$ctx:fax}</fax>
            <email>{$ctx:email}</email>
            <website>{$ctx:website}</website>
            <physicalAddress1>{$ctx:physicalAddress1}</physicalAddress1>
            <physicalAddress2>{$ctx:physicalAddress2}</physicalAddress2>
            <physicalSuburb>{$ctx:physicalSuburb}</physicalSuburb>
            <physicalCity>{$ctx:physicalCity}</physicalCity>
            <physicalPostcode>{$ctx:physicalPostcode}</physicalPostcode>
            <physicalState>{$ctx:physicalState}</physicalState>
            <physicalCountryId>{$ctx:physicalCountryId}</physicalCountryId>
            <postalAddress1>{$ctx:postalAddress1}</postalAddress1>
            <postalAddress2>{$ctx:postalAddress2}</postalAddress2>
            <postalSuburb>{$ctx:postalSuburb}</postalSuburb>
            <postalCity>{$ctx:postalCity}</postalCity>
            <postalPostcode>{$ctx:postalPostcode}</postalPostcode>
            <postalState>{$ctx:postalState}</postalState>
            <postalCountryId>{$ctx:postalCountryId}</postalCountryId>
            <customerGroupId>{$ctx:customerGroupId}</customerGroupId>
            <customerGroupName>{$ctx:customerGroupName}</customerGroupName>
            <twitter>{$ctx:twitter}</twitter>
            <enableLoyalty>{$ctx:enableLoyalty}</enableLoyalty>
            <dateOfBirth>{$ctx:dateOfBirth}</dateOfBirth>
            <sex>{$ctx:sex}</sex>
            <customField1>{$ctx:customField1}</customField1>
            <customField2>{$ctx:customField2}</customField2>
            <customField3>{$ctx:customField3}</customField3>
            <customField4>{$ctx:customField4}</customField4>
            <note>{$ctx:note}</note>
         </vend.createCustomer>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>