Monday, October 24, 2016

Introducing WSO2 ESB Connector for Pardot

Pardot is one of the leading marketing automation tools. It provides a full suite of tools that help marketers create meaningful connections, generate more pipeline, and empower sales to close more deals.

Now WSO2 ESB supports connecting Pardot via its Pardot connector. Pardot connector allows you to access the Pardot through its REST API. Let’s see how to configure the Pardot connector.


Requirements 
  • WSO2 ESB
  • Pardot connector
  • Pardot account

Get the credentials from Pardot account
  • Obtain the email, password, and user_key from your Pardot account.
  • For user_key, click {your email address} > Settings > API User Key.

Setup the WSO2 ESB with Pardot Connector
  • Download the ESB from here and start the server.
  • Download the Pardot connector from WSO2 Store.
  • Add and enable the connector via ESB Management Console.
  • Create Proxy service to retrieve prospects details from Pardot and invoke the proxy with the following request.

Proxy Service

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="getProspects"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <property expression="//apiUrl" name="apiUrl"/>
         <property expression="//email" name="email"/>
         <property expression="//password" name="password"/>
         <property expression="//userKey" name="userKey"/>
         <property expression="//apiVersion" name="apiVersion"/>
         <property expression="//createdAfter" name="createdAfter"/>
         <property expression="//limit" name="limit"/>
         <property expression="//sortBy" name="sortBy"/>
         <property expression="//sortOrder" name="sortOrder"/>
         <pardot.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <email>{$ctx:email}</email>
            <password>{$ctx:password}</password>
            <userKey>{$ctx:userKey}</userKey>
            <apiVersion>{$ctx:apiVersion}</apiVersion>
         </pardot.init>
         <pardot.getProspects>
            <createdAfter>{$ctx:createdAfter}</createdAfter>
            <limit>{$ctx:limit}</limit>
            <sortBy>{$ctx:sortBy}</sortBy>
            <sortOrder>{$ctx:sortOrder}</sortOrder>
         </pardot.getProspects>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>

Request

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<request>
   <apiUrl>https://pi.pardot.com/api</apiUrl>
   <email>johndoe@gmail.com</email>
   <password>johnpass</password>
   <userKey>1oic7694habc85lkgng965ut85</userKey>
   <apiVersion>3</apiVersion>
   <createdAfter>yesterday</createdAfter>
   <sortBy>created_at</sortBy>
   <sortOrder>descending</sortOrder>
   <limit>2</limit>
</request>


References
  1. http://www.pardot.com/
  2. https://docs.wso2.com/display/ESBCONNECTORS/Pardot+Connector

Saturday, October 22, 2016

Search with WSO2 NetSuite Connector- Advanced Search

This is the final post in the series, 'Search operation with WSO2 NetSuite Connector'. In this post, I am discussing how we can use search method in WSO2 NetSuite connector to perform the advanced search in NetSuite.

Advanced search


An advanced search allows you to search for a record type in which you specify search filter fields and/or search return columns or joined search columns. Using advanced search, you can also return an existing saved search.

What is saved search?


A Saved Search is a reusable search definition that can have many advanced search filters and results display options.

To create a saved search
  • Go to Reports > Saved Searches > All Saved Searches > New and select the record type for the saved search.


  • On a saved search definition page, enter a title for the saved search.
  • If you want the search to be available to all users, check the Public box. 
  • On the Criteria subtab, define criteria to filter saved search records. These criteria can include dynamically calculated field values, including join fields; formulas containing SQL functions, as well as AND/OR expressions.


  • On the Results subtab, define display options for saved search results.
  • After you have completed saved search definitions, you can click preview to review search results without saving the search definitions.



  • Then click Return to Criteria button to go back to the saved search page and click Save to save search definitions and make the search available to be run by yourself and other members.

How to reference an existing saved search via NetSuite Connector?


First, you must obtain the saved search ID to reference an existing saved search. You can do so through the UI by going to Lists > Search > Saved Searches. The saved search ID appears in the ID column.



This request sample shows how to execute a saved search on customers via NetSuite connector, and you can use the proxy service mentioned in the first post to perform this.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="wso2.connector.netsuite">
  <soapenv:Header/>
   <soapenv:Body>
      <urn:apiUrl>https://webservices.na1.netsuite.com/services/NetSuitePort_2016_1</urn:apiUrl>
      <urn:applicationId>32XXX75-CXXE-47X7-BX7-A3EXXXX9D</urn:applicationId>
      <urn:email>johndoe@abc.com</urn:email>
      <urn:password>john4doe</urn:password>
      <urn:account>TSTXXXXXX12</urn:account>
      <urn:searchRecord>
         <q1:searchRecord xmlns:q1="urn:relationships_2016_1.lists.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="q1:CustomerSearchAdvanced" savedSearchId="748" />
      </urn:searchRecord>
   </soapenv:Body>
</soapenv:Envelope>

Friday, October 14, 2016

Search with WSO2 NetSuite Connector - Joined Search

This is the second post in the series, 'Search operation with WSO2 NetSuite Connector'. In this post, I am discussing how we can use search method in WSO2 NetSuite connector to perform the joined search in NetSuite.

Joined search


A joined search allows you to search for a specific record type using the fields on an associated record as search filters. 

In SuiteTalk, all search joins are listed in the < Record > Search object. For example, to find available search joins for the Contact or Customer record, see the relationships XSD.

You can use the proxy service mentioned in the first post to perform the joined search via WSO2 NetSuite connector.

This request sample shows how to execute a customer search in which the contact email address is specified as the search criteria.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="wso2.connector.netsuite">
   <soapenv:Header />
   <soapenv:Body>
      <urn:apiUrl>https://webservices.na1.netsuite.com/services/NetSuitePort_2015_2</urn:apiUrl>
      <urn:applicationId>32XXX75-CXXE-47X7-BX7-A3EXXXX9D</urn:applicationId>
      <urn:email>johndoe@abc.com</urn:email>
      <urn:password>john4doe</urn:password>
      <urn:account>TSTXXXXXX12</urn:account>
      <urn:searchRecord>
         <searchRecord xmlns:ns4="urn:relationships_2015_1.lists.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:ContactSearch">
            <ns4:basic xmlns:ns5="urn:common_2015_1.platform.webservices.netsuite.com" xsi:type="ns5:ContactSearchBasic">
               <ns5:email xmlns:ns6="urn:core_2015_1.platform.webservices.netsuite.com" operator="is" xsi:type="ns6:SearchStringField">
                  <ns6:searchValue xsi:type="xsd:string">dave@cleanenergy.com</ns6:searchValue>
               </ns5:email>
            </ns4:basic>
            <ns4:customerJoin xmlns:ns7="urn:common_2015_1.platform.webservices.netsuite.com" xsi:type="ns7:CustomerSearchBasic">
               <ns7:entityId xmlns:ns8="urn:core_2015_1.platform.webservices.netsuite.com" operator="is" xsi:type="ns8:SearchStringField">
                  <ns8:searchValue xsi:type="xsd:string">Clean Energy</ns8:searchValue>
               </ns7:entityId>
            </ns4:customerJoin>
         </searchRecord>
      </urn:searchRecord>
   </soapenv:Body>
</soapenv:Envelope>

Monday, October 3, 2016

Search with WSO2 NetSuite Connector - Basic Search

This is the first post in the series, 'Search operation with WSO2 NetSuite Connector'. The search operation in SuiteTalk is used to execute a search on a specific record type based on a set of criteria. The search operation can be used to perform the following types of searches.
  • Basic search
  • Joined search
  • Advanced search 
In this post, I am discussing how we can use search method in WSO2 NetSuite connector to perform the basic search in NetSuite.

Basic search

A basic search lets you to search records of a specific type using the fields on that record as search filters.

To perform a basic search in which you specify search filter criteria only, use:
  •  < Record > Search
  •  < Record > SearchBasic
In SuiteTalk, any record that supports search operation has a corresponding < Record > Search object, which contains a basic element. The basic element references a < Record > SearchBasic object, which defines all available search criteria (filter fields) specific to that record type.

You can find the search types which are used throughout web services to populate the system defined lists in the schema browser.

The enumerations (the available values that should be used to populate these fields in your web services requests. ) are defined in the platformCoreTyp XSD.

SuiteTalk provides a collection of operators, and they differ depending on the field type you are searching. For example, the following are the collection of operators supported by the SearchStringFieldOperator.
  • contains
  • doesNotContain
  • doesNotStartWith
  • empty
  • hasKeywords
  • is
  • isNot
  • notEmpty
  • startsWith
Let see how to perform basic customer search via WSO2 NetSuite Connector.

Create Proxy service to search customer with given email Id from NetSuite and invoke the proxy with the following request.

Proxy Service 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="netsuiteSearch"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <property xmlns:ns="wso2.connector.netsuite"
                   expression="//ns:apiUrl/text()"
                   name="apiUrl"/>
         <property xmlns:ns="wso2.connector.netsuite"
                   expression="//ns:applicationId/text()"
                   name="applicationId"/>
         <property xmlns:ns="wso2.connector.netsuite"
                   expression="//ns:email/text()"
                   name="email"/>
         <property xmlns:ns="wso2.connector.netsuite"
                   expression="//ns:password/text()"
                   name="password"/>
         <property xmlns:ns="wso2.connector.netsuite"
                   expression="//ns:account/text()"
                   name="account"/>
         <property xmlns:ns="wso2.connector.netsuite"
                   expression="//ns:bodyFieldsOnly/text()"
                   name="bodyFieldsOnly"/>
         <property xmlns:ns="wso2.connector.netsuite"
                   expression="//ns:returnSearchColumns/text()"
                   name="returnSearchColumns"/>
         <property xmlns:ns="wso2.connector.netsuite"
                   expression="//ns:pageSize/text()"
                   name="pageSize"/>
         <property xmlns:ns="wso2.connector.netsuite"
                   expression="//ns:searchRecord/*"
                   name="searchRecord"/>
         <netsuite.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <applicationId>{$ctx:applicationId}</applicationId>
            <password>{$ctx:password}</password>
            <email>{$ctx:email}</email>
            <account>{$ctx:account}</account>
         </netsuite.init>
         <netsuite.search>
            <bodyFieldsOnly>{$ctx:bodyFieldsOnly}</bodyFieldsOnly>
            <returnSearchColumns>{$ctx:returnSearchColumns}</returnSearchColumns>
            <pageSize>{$ctx:pageSize}</pageSize>
            <searchRecord>{$ctx:searchRecord}</searchRecord>
         </netsuite.search>
         <respond/>
      </inSequence>
      <outSequence>
         <log/>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>

Request

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="wso2.connector.netsuite">
   <soapenv:Header />
   <soapenv:Body>
      <urn:apiUrl>https://webservices.na1.netsuite.com/services/NetSuitePort_2015_2</urn:apiUrl>
      <urn:applicationId>32XXX75-CXXE-47X7-BX7-A3EXXXX9D</urn:applicationId>
      <urn:email>johndoe@abc.com</urn:email>
      <urn:password>john4doe</urn:password>
      <urn:account>TSTXXXXXX12</urn:account>
      <urn:searchRecord>
         <platformMsgs:searchRecord xmlns:platformMsgs="urn:messages_2015_2.platform.webservices.netsuite.com" xmlns:ns1="urn:relationships_2015_2.lists.webservices.netsuite.com" xmlns:platformCore="urn:core_2015_2.platform.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:CustomerSearch">
            <basic>
               <email operator="is" xsi:type="platformCore:SearchStringField">
                  <searchValue>dave@cleanenergy.com</searchValue>
               </email>
            </basic>
         </platformMsgs:searchRecord>
      </urn:searchRecord>
   </soapenv:Body>
</soapenv:Envelope>