VerticalResponse API Java Sample Code
SimpleTest is a sample application that demonstrates how to build basic functionality using the VerticalResponse API and Java.
You can email API Support at api-support@verticalresponse.com if you have any questions.
This sample application goes through the basic workflow of sending an email through the API using Java. It implements the following functionalities:
- Logging into the VerticalResponse system and obtaining a Session ID
- Creating a list
- Adding a record to that list
- Creating an email campaign
- Attaching your list to that email campaign
- Launching your email campaign
There is an option to pause between steps on line 62 — feel free to toggle this to your preference.
Prerequisites & Notes
- Create a Vertical Response account (http://www.verticalresponse.com/)
- Fill out the API Access Request Form to have API enabled for your account.
- If you are a VerticalResponse partner, you were provided SSL certificates and a passphrase. You will need to install and configure these before making any administrative calls or calls on behalf of subaccounts.
- NOTE: This sample code does not include any Partner-specific methods, so you can run this code independent from setting up your certificates.
- Apache's Ant is used to build the sample code.
Files Included in the Java Sample Code download
- lib: contains various standard JAR files needed for XML parsing, SOAP, etc. Note: Your system likely already contains many or all of these files.
- src: source for SimpleTest.java and Base64.java, in \src\com\verticalresponse\vrapi_java_examples
- docs: Axis, Ant, and various documentation for technologies we're using.
- VR_Java_Documentation_README: this very readme!
- vrapiwsdl: The very important wsdl2java script (either .sh or .bat) that you will run to generate the VRAPI.jar file.
Running The Sample
- Open up the SimpleTest.java file (in src/com/verticalresponse/vrapi_java_examples) and provide your username and password.
- We also recommend changing the email address on the list you're creating so that you can receive the test email you'll launch.
- In the vrapiwsdl directory, run the wsdl2java.sh or wsdl2java.bat file appropriate to your operating system.
- This builds the WSDL with the VerticalResponse API methods and types.
- Within the same directory, run ant.
- This will compile the WSDL data into the VRAPI.jar file.
- Move up to the main directory and run ant SimpleTest.
- This will compile and run the sample code.
Installing the Partner Client Certificates
As a partner, you received a P12 certificate from your account manager. Place that file in a directory accessible to the sample code, and then add the path to the certificate and the passphrase to the sample code, around lines 46 and 47.
If you are readying your code for production, you'll want to consult our more in-depth Java certificate guide.