Temboo and the PayPal API
About the author: Vaughn Shinall does business development for Temboo, working to connect developers, web services, and more for the next generation of applications.
Want to to use the PayPal and several other APIs without spending hours reading documentation? Then you should know about Temboo. Temboo provides normalized access to over 100 APIs, saving you the effort of learning how to use each one. And that means more time to experiment with new APIs and to focus on the creative side of development instead of reinventing the API wheel. The Temboo
Library contains over 1800 special methods called Choreos (as in choreography) for a wide range of APIs, and in this post I’ll walk you through how to use Temboo to check an account balance with the PayPal API. Once you’ve learned how to use this Choreo, you’re ready to use all our other Choreos for PayPal and every API in our Library — that’s the power of Temboo.
Step 1 — Get A Temboo Account
Go to Temboo.com and enter your email address on the home page. After confirming your email address and setting up an account name and password, you’ll have a free Temboo account with access to everything in our Library.
Step 2 — Find the Choreo in Our Library
Be sure you are logged into your account, and go to our Library page. On the left hand side you’ll see a list of all our APIs. Find PayPal, open the Merchants bundle, and select the Get Balance Choreo.
Step 3 — Test Run A Choreo From Your Browser
On the Choreo page you’ll see all the required inputs for this action. Scroll down the page to see information on the output the API returns for the Choreo, sample code (more on this later), and a description of the Choreo. Back at the top of the page, you can enter the inputs and any optional inputs you choose. In this instance, I’m entering the password, signature, and username from my PayPal developer test account and setting the optional input to 1, indicating that I’m testing this Choreo against the PayPal sandbox. Now I’m ready to run this Choreo from my browser by clicking the Try It Out button.
After the Choreo has run, you’ll see that the Output box now shows what the PayPal API’s output. My account balance is zero in US dollars.
And immediately below that, you’ll see that the Sample Code has now been updated with all the inputs you entered for this Choreo run. This is code that you can copy and paste into your IDE to incorporate a Choreo directly into your application. (Rather than passing my PayPal password, signature, and username through the code, I’ve used Temboo Credentials to wrap them into one credential called ‘PayPalTest’.) Note that you can also select the programming language that you want the sample code in.
Step 4 — Run the Choreo from your IDE
Download the Temboo SDK in the language of your choice, and add it to your IDE. (Our tutorials provide detailed instructions.) Then paste the sample code into your project. For this example I am using our Java SDK and an eclipse, so my code looks like this:
Note that the first line of code starts my Temboo session by supplying the following Temboo credentials: my account name, the name of the Temboo Application Key I’m using, and the Application Key itself. (Your Application Keys can be found and managed here.) Then I add the following line to have the API output appear in my console:
System.out.println(getBalanceResults.get_Response());
Now I’m ready to run the project, and I get the following output in my console:
L_AMT0=0.00&L_CURRENCYCODE0=USD&TIMESTAMP=2013-07-01T20:05:11Z
&CORRELATIONID=a2b15b35cf174&ACK=Success&VERSION=56.0&BUILD=6561328
And that’s it! Now you know how to use Temboo to run any of the 21 PayPal Choreos — or the hundreds of other Choreos in our Library. Check out Temboo today to see what you can build with the PayPal API.