Quickstart Guide

Generate code with Temboo

I'm programming with
Select a Language
Arduino
Texas Instruments
Samsung
C#
Java
JavaScript
Node.js
PHP
Processing
Python
REST API
Ruby
iOS
Android
Arduino Yún
+ Yún Shield
Other Arduinos
Learn how to generate Temboo code to connect your devices and applications to web services and APIs. This tutorial will get you familiar with the basics in minutes.

Get Set Up

  1. If you don't already have it, install the latest version of the Arduino IDE. You should also make sure that you have the newest version of the Temboo Library by checking the Arduino Library Manager.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Set up your Yún’s Internet connection. Arduino has a helpful guide if you need assistance.
  4. Generate Your Code

  5. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  6. Select from the drop down menu at the top of the page.

  7. Select either Yún or an Arduino board paired with the Yún shield as your device configuration.
  8. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  9. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  10. Try it Out

  11. Scroll down to find the code box on the Choreo page. Copy the code, and paste it into a new sketch in the IDE.
  12. In order to run this sketch, it needs to be configured with an appropriate TembooAccount.h header file containing your Temboo account information. Header files for certain boards will also include the device’s internet connection details.

    To create the header file, make a new tab in the IDE, and name it TembooAccount.h.

  13. Beneath the code box you previously copied from the Choreo page, you’ll find a header file. Copy the contents of the header into the TembooAccount.h tab in your IDE.
  14. The final step before running any sketch is to confirm that you've selected the appropriate board and serial port in the Arduino IDE. Go to the Tools > Board menu and select the board you're working with. Then go to Tools > Serial Port and select the port your board is connected to.
  15. Save and upload your sketch to the Arduino, and open the serial monitor. After running the sketch, you'll see the response from printed to the monitor.
  16. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Graph incoming data from a sensor

    Begin
    Receive email alerts based on sensor values

    Begin
  1. If you don't already have it, install the latest version of the Arduino IDE. You should also make sure that you have the newest version of the Temboo Library by checking the Arduino Library Manager.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Generate Your Code

  4. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  5. Select from the drop down menu at the top of the page.

  6. Select your board and add details about its internet connection.
  7. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  8. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  9. Try it Out

  10. Scroll down to find the code box on the Choreo page. Copy the code, and paste it into a new sketch in the IDE.
  11. In order to run this sketch, it needs to be configured with an appropriate TembooAccount.h header file containing your Temboo account information. Header files for certain boards will also include the device’s internet connection details.

    To create the header file, make a new tab in the IDE, and name it TembooAccount.h.

  12. Beneath the code box you previously copied from the Choreo page, you’ll find a header file. Copy the contents of the header into the TembooAccount.h tab in your IDE.
  13. The final step before running any sketch is to confirm that you've selected the appropriate board and serial port in the Arduino IDE. Go to the Tools > Board menu and select the board you're working with. Then go to Tools > Serial Port and select the port your board is connected to.
  14. Save and upload your sketch to the Arduino, and open the serial monitor. After running the sketch, you'll see the response from printed to the monitor.
  15. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Graph incoming data from a sensor

    Begin
    Receive email alerts based on sensor values

    Begin
  1. Download and install the latest version of the Energia IDE if you don't already have it.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Generate Your Code

  4. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  5. Select from the drop down menu at the top of the page.

  6. Select your board and add details about its internet connection.
  7. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  8. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  9. Try it Out

  10. Scroll down to find the code box on the Choreo page. Copy the code, and paste it into a new sketch in the IDE.
  11. In order to run this sketch, it needs to be configured with an appropriate TembooAccount.h header file containing your Temboo account information. Header files for certain boards will also include the device’s internet connection details.

    To create the header file, make a new tab in the IDE, and name it TembooAccount.h.

  12. Beneath the code box you previously copied from the Choreo page, you’ll find a header file. Copy the contents of the header into the TembooAccount.h tab in your IDE.
  13. The final step before running any sketch is to confirm that you've selected the appropriate board and serial port in Energia. Go to the Tools > Board menu and select the LaunchPad you're working with. Then go to Tools > Serial Port and select the port your board is connected to.

    selecting your board in Energia
  14. With both files in place you are ready to upload the sketch to the LaunchPad. After running the sketch, open the Serial Monitor and you'll see the response from .

    Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Graph incoming data from a sensor

    Begin
    Receive email alerts based on sensor values

    Begin
  1. You'll need a free Texas Instruments account to use their online IDE, CCS Cloud. You can sign up here.
  2. If you haven't already done so, prepare your board for making secure connections by following our Setting up CC3220 for SSL tutorial.
  3. Sign in to your Temboo account. If you don't already have one, you can register for free.
  4. Generate Your Code

  5. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  6. Select from the drop down menu at the top of the page.

  7. Select your board and add details about its internet connection.
  8. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  9. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  10. Try it Out

  11. Scroll down to the code box of the Choreo page. Click Send to CCS Cloud to the right of your generated code. Name your application and click Send. Click the link that appears to visit the CCS Cloud IDE in your browser.

    Sending your code to CCS Cloud
  12. Plug your CC3220 board into your computer via USB. Select its USB connection in CCS Cloud via the Target > Connect COM port... menu.
  13. Run the code on your CC3220 from CCS Cloud. After running the code, open the Serial Monitor and you'll see the response from the Choreo.

    Running your code on CCS Cloud

  14. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Graph incoming data from a sensor

    Begin
    Receive email alerts based on sensor values

    Begin
  1. Sign in to your Temboo account. If you don't already have one, you can register for free.
  2. If this is your first time using Temboo, you'll need to set up your ARTIK board to find the Temboo libraries. To do so, you'll need to create the file temboo.conf in /etc/ld.so.conf.d. Inside of temboo.conf, you'll want to copy the line below and paste it into the file:

    /opt/iothub/artik/temboo/temboo_artik_library/lib
    
  3. After saving temboo.conf, run ldconfig from the command line to add the Temboo library directory to the system library search path.
  4. You’ll also need to get the IP address of your ARTIK board using ifconfig. The example below shows the results when the ARTIK board is connected to the internet through an ethernet cable. The IP address you'll want to use is listed next to inet.

    [root@localhost ~]$ ifconfig
    eth0: flags=4163  mtu 1500
            inet 10.11.6.200  netmask 255.255.255.0  broadcast 10.11.6.255
    
  5. Generate Your Code

  6. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  7. Select from the drop down menu at the top of the page.

  8. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  9. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  10. Download the generated code to your computer by clicking Download source code to the right of the code.

    Getting generated ARTIK code
  11. Try it Out

  12. Copy the downloaded zip file to your ARTIK board using scp. From your computer, go to the directory where the zip file is located and type the command below. Make sure you use the IP address for your board you found using ifconfig.

    [root@localhost ~]$ scp .zip root@xxx.xxx.xxx.xxx:/home
    
  13. From the ARTIK command line (either through a serial terminal or ssh session), change your current directory to /home. Next, unzip the generated code you just copied over. You can unzip the file by using the command below:

    [root@localhost ~]$ unzip .zip
    
  14. Now go to the directory and compile and run your code using the commands below. Run the first command to compile your code. After compiling has finished and no errors have been reported, run your program using the second command. After running the program, you should see the response from in your console.

    [root@localhost ~]$ gcc -L/opt/iothub/artik/temboo/temboo_artik_library/lib -ltemboo -I/opt/iothub/artik/temboo/temboo_artik_library/include s.c -o 
    [root@localhost ~]$ ./
    

    Note: If you get an error about cdefs.h not being found, this could mean your ARTIK board was not shipped with glibc-headers. This can be solved by reinstalling glibc-headers using the command below. After reinstalling glibc-headers, run the two commands above to compile and run your code.

    [root@localhost ~]$ yum reinstall glibc-headers
    
  15. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Graph incoming data from a sensor

    Begin
    Receive email alerts based on sensor values

    Begin
  1. For this tutorial you will need Android 1.6 (or later) and an Android code editor. We've used Android Studio 0.4.6 for this tutorial, but they will work equally well in whatever IDE you are using.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Create a new project in Android Studio.
    1. In the New Project dialog, name the application "Temboo Test" (or whatever you like), uncheck Create custom launcher icon, and click Next.
    2. Select Blank Activity, click Next.
    3. Leave the Activity Name and other settings as-is and click Finish.
  4. Download and extract the Temboo Android SDK.
  5. Add the Temboo SDK to your project:
    1. Find the core SDK .jar file (e.g. temboo-android-sdk-core-2.19.0.jar) in the Temboo SDK folder you just downloaded and extracted.
    2. Right-click and copy the .jar file, return to Android Studio, and right-click/paste the .jar into the libs folder of your project
    3. Right-click on the .jar and select Add as Library. Click OK on the dialog that's displayed.

    You've now added the core Temboo SDK to your project. Repeat the above steps to add the application bundle (e.g. -2.19.0.jar) from the Temboo SDK folder you just extracted, which will allow us to use APIs.

    Prepare your Android application

    We'll now make some adjustments to the default application that Android Studio has generated for us.

  6. Open the Android manifest located at app/src/main/res/AndroidManifest.xml. In order to access the internet, you will need to add <uses-permission android:name="android.permission.INTERNET"/> below the <application> tag.
  7. The default layout of the application included a TextView that we'll make use of, but before we can do so we need to give it an identifier. Locate and double-click on the fileapp > src > main > res > layout > activity_main.xml. This file describes the layout of our MainActivity class.
  8. Click on the "Hello World" text in the device emulator to select the TextView.
  9. In the Properties panel on the bottom-right of the editor, find the id property. Click to the right of it and enter @+id/response
  10. Next, locate the text property and delete the default "Hello World" value (we'll fill this in programmatically later).
  11. Generate Your Code

  12. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  13. Select from the drop down menu at the top of the page.

  14. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  15. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  16. Scroll down to the code box on the Choreo page to find the generated code.
  17. Because network operations block the main thread execution, we'll need to make our calls to Temboo using AsyncTask. Create a new class that extends AsyncTask called GeocodingTask (or whatever you like), adding the @Override implementations for doInBackground and onProcessComplete:

    package com.temboo.android.gettingstarted.app;
    
    import android.os.AsyncTask;
    import android.util.Log;
    import android.widget.TextView;
    
    /**
     * An AsyncTask that will be used to interact with Temboo
     */
    class GeocodingTask extends AsyncTask<Void, Void, String> {
    
        private TextView textView;
    
        public GeocodingTask(TextView textView){
            this.textView = textView;
        }
    
        @Override
        protected String doInBackground(Void... arg0) {
            try {
                // Temboo code will go here
            } catch(Exception e) {
                // if an exception occurred, log it
                Log.e(this.getClass().toString(), e.getMessage());
            }
            return null;
        }
    
        protected void onPostExecute(String result) {
            try {
                // Will update UI here
            } catch(Exception e) {
                // if an exception occurred, show an error message
                Log.e(this.getClass().toString(), e.getMessage());
            }
        }
    }
    
  18. Notice that we've added a constructor that takes a TextView as an argument. This will reference the TextView we set up earlier.
  19. Now that our AsyncTask is set up, copy the generated code snippet from the Temboo website and paste it into the doInBackground method of your AsyncTask class. We'll also add the required imports to create a GeocodeByAddress Choreo, GeocodeByAddressInputSet, and GeocodeByAddressResultSet:

    import com.temboo.Library.Google.Geocoding.GeocodeByAddress;
    import com.temboo.Library.Google.Geocoding.GeocodeByAddress.GeocodeByAddressInputSet;
    import com.temboo.Library.Google.Geocoding.GeocodeByAddress.GeocodeByAddressResultSet;
    import com.temboo.core.TembooSession;
    
  20. Print Results

    Each Choreo in the Android SDK returns a ResultSet subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the ResultSet, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you.

    To update the UI with the latitude and longitude returned by the Choreo, do the following:

  21. Add the following code at the bottom of the try block of the doInBackground method in your class:

    return geocodeByAddressResults.get_Latitude() + "/" + geocodeByAddressResults.get_Longitude();
  22. The return value we've just added is passed by Android as an argument to the onPostExecute method, we'll update the UI there:

        protected void onPostExecute(String result) {
            try {
                // Update the UI
                textView.setText(result);
            } catch(Exception e) {
                // if an exception occurred, show an error message
                Log.e(this.getClass().toString(), e.getMessage());
            }
        }
    
  23. That's it! At this point, your AsyncTask implementation should look something like this:

    package com.temboo.android.gettingstarted.app;
    
    import android.os.AsyncTask;
    import android.util.Log;
    import android.widget.TextView;
    
    import com.temboo.Library.Google.Geocoding.GeocodeByAddress;
    import com.temboo.Library.Google.Geocoding.GeocodeByAddress.GeocodeByAddressInputSet;
    import com.temboo.Library.Google.Geocoding.GeocodeByAddress.GeocodeByAddressResultSet;
    import com.temboo.core.TembooSession;
    
    /**
     * An AsyncTask that will be used to interact with Temboo
     */
    class GeocodingTask extends AsyncTask<Void, Void, String> {
    
        private TextView textView;
    
        public GeocodingTask(TextView textView){
            this.textView = textView;
        }
    
        @Override
        protected String doInBackground(Void... arg0) {
            try {
                // Instantiate the Choreo, using a previously instantiated TembooSession object, eg:
                TembooSession session = new TembooSession("ACCOUNT_NAME", "APP_NAME", "APP_KEY");
                GeocodeByAddress geocodeByAddressChoreo = new GeocodeByAddress(session);
    
                // Get an InputSet object for the choreo
                GeocodeByAddressInputSet geocodeByAddressInputs = geocodeByAddressChoreo.newInputSet();
    
                // Set inputs
                geocodeByAddressInputs.set_Address("104 Franklin Street, New York City");
    
                // Execute Choreo
               GeocodeByAddressResultSet geocodeByAddressResults = geocodeByAddressChoreo.execute(geocodeByAddressInputs);
    
                return geocodeByAddressResults.get_Latitude() + "/" + geocodeByAddressResults.get_Longitude();
            } catch(Exception e) {
                // if an exception occurred, log it
                Log.e(this.getClass().toString(), e.getMessage());
            }
            return null;
        }
    
        protected void onPostExecute(String result) {
            try {
                // Update UI
                textView.setText(result);
            } catch(Exception e) {
                // if an exception occurred, show an error message
                Log.e(this.getClass().toString(), e.getMessage());
            }
        }
    }
    
    
  24. Try it Out

  25. In order to see your new task in action, you will need to invoke it from the MainActivity class created with your project. The simplest way to do this is to add a call to it in the onCreate method, which should end up looking like this:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView textView = (TextView) findViewById(R.id.response);
        new GeocodingTask(textView).execute();
    }
    
  26. Deploy and run the application. After a few moments the output from the Choreo call should be printed to your device's (or the emulator's) screen. Congrats! You just ran your first Choreo from our Android SDK.

    Results from the Choreo run printed to the Android screen
  27. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Try out some of our other tutorials.
  1. For this tutorial, you will need the .NET 4.5 framework and Microsoft Visual Studio 2013 (or later) installed.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. In Visual Studio, create a new C# Console Application project. For this example, name it TembooTest. The new project should automatically include a C# class file called Program.cs containing a Main method.
  4. Download the Temboo C# SDK and extract the ZIP file into the directory where you keep your Visual Studio projects.
  5. In Visual Studio, right-click the References folder under TembooTest and select Add Reference. In the dialogue box that appears, click Browse and select TembooSDK.dll located in the bin folder within the extracted Temboo SDK directory. Click OK.
  6. Generate Your Code

  7. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  8. Select from the drop down menu at the top of the page.

  9. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  10. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  11. Scroll down to the code box on the Choreo page to find the generated code.
  12. Copy the code snippet, and replace the contents of Program.cs with the copied code.
  13. Print Results

    At this point, the app is ready to run but by default it will exit the console session immediately. To make sure the output is visible, let's update the code to print the results returned from Google's Geocoding service and wait for input before terminating.

    Each Choreo in the C# SDK returns a ResultSet subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the ResultSet, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you.

  14. Update the the Main method in your class, so that the final lines look like:

    // Print results
    Console.WriteLine("Latitude: " + geocodeByAddressResults.Latitude);
    Console.WriteLine("Longitude: " + geocodeByAddressResults.Longitude);
    Console.WriteLine("Press any key to continue...");
    
    Console.ReadKey();
    
  15. Try it Out

  16. Run the code and you will see the results in the console. Congrats! You just ran your first Choreo from our C# SDK.

    Choreo results printed to the console
  17. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Try out some of our other tutorials.
  1. For this tutorial, you will need the iOS 7 SDK and Xcode 6.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. For simplicity's sake, we'll create a command line tool that will print its results to the Xcode console. For an example of using Temboo with a UI-based application (as you would on an iPhone or iPad) check out our Facebook OAuth example.
  4. Create a new Xcode project: OS X > Application > Command Line Tool.
  5. Name it TembooTest, select Objective-C as the Language, and click Next (the other fields are optional and may be left blank) to save your new project.
  6. Download and extract the Temboo iOS SDK, noting where it's been saved.
  7. Click on the folder that contains your project's code (it should be called TembooTest and contain a file called main.m), then select Add Files to TembooTest from the File menu. Browse to where you saved the Temboo SDK, locate and click on the core folder inside the SDK src folder. Make sure that Copy items if needed is unchecked and Create groups is selected, and then click Add.
  8. Repeat the above steps to add the TMB.h and TMB.m files located in the SDk's src/library folder.
  9. Generate Your Code

  10. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  11. Select from the drop down menu at the top of the page.

  12. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  13. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  14. Scroll down to find the Code section of the Library page.
  15. Copy the code snippet and paste it into your project's main.m file, below the import statement for <Foundation/Foundation.h> and above the main method.
  16. Finally, update the main method in main.m with the code below so that your file calls the Geocoding Choreo:

    int main(int argc, const char * argv[]) {
    
        @autoreleasepool {
    		// Create a new instance of our class
    		GeocodeByAddress *tutorial = [[GeocodeByAddress alloc] init];
            
    		// Run it
    		[tutorial runGeocodeByAddressChoreo];
            
    		// Only needed for command line tools, this simply keeps the program from exiting immediately
    		[[NSRunLoop currentRunLoop] run];
    	}
        return 0;
    }
    
  17. Try It Out

    Each Choreo in the iOS SDK returns a ResultSet subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the ResultSet, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you. Our snippets include code to print out the results returned by the Choreo in question.

  18. Run the code and you will see the latitude and longitude printed to the console along with the full Choreo response. Congrats! You just ran your first Choreo from our iOS SDK.
  19. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Try out some of our other tutorials.
  1. For this tutorial you will need Java 1.6 (or later) and a Java code editor. We've used Eclipse for these tutorials, but they will work equally well in whatever IDE you are using.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Create a new Java project in Eclipse and add a folder called /libs.
  4. Download the Temboo Java SDK.
  5. Copy the downloaded JAR into the /libs folder. Refresh the project, then right-click the JAR file and select: Build Path > Add to Build Path.
  6. Add a new Java class containing a main method to your project. You can call it whatever you like.
  7. Generate Your Code

  8. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  9. Select from the drop down menu at the top of the page.

  10. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  11. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  12. Scroll down to the code box on the Choreo page, then copy and paste the code into the main method of your Java class. Press Cmd+Shift+O (or Ctrl+Shift+O in Windows) to automatically import dependencies. Note: your main method should declare that it throws Exception.
  13. Import dependencies again, making sure to select the Temboo packages.
  14. Print results

    Before we try a test run of the app, let's update the code to print the results returned from Google's Geocoding service.

    Each Choreo in the Java SDK returns a ResultSet subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the ResultSet, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you.

    To print the latitude and longitude returned by the Choreo, simply do the following:

  15. Add the following code at the bottom of the main method in your class:

    // Print lat and lon
    System.out.println("Latitude: " + geocodeByAddressResults.get_Latitude());
    System.out.println("Longitude: " + geocodeByAddressResults.get_Longitude());
    
  16. Try It Out

  17. Run the code and you will see the results in the console. Congrats! You just ran your first Choreo from our Java SDK.

  18. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Try out some of our other tutorials.
  1. When using the Temboo JavaScript SDK, you’ll need a proxy in a server-side language and a web application server. A proxy communicates with a server, since JavaScript only runs on the client side. In this tutorial we'll be using PHP, but you can use any of these server-side languages with web application server.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Create a new .html file and save it as temboo-example.html into a folder where you'll save the rest of your project files.
  4. Create a new .php file and save it as proxy-server.php into the same project folder as your temboo-example.html file.
  5. Download the latest Temboo JavaScript SDK and unzip the file.
  6. Change the name of the resulting folder to js-sdk and move it into the same folder as your temboo-example.html file.
  7. Download the latest Temboo PHP SDK and unzip the file.
  8. Change the name of the resulting folder to php-sdk and move it into the same folder as your temboo-example.html file. Your project folder should look similar to the screenshot below:

  9. Generate Your Code

  10. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  11. Select from the drop down menu at the top of the page.

  12. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  13. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  14. Scroll down to the Code section of the Choreo page. Copy the JavaScript code snippet and paste it into your temboo-example.html file.
  15. In your temboo-example.html file, make sure that your script source points to the correct location of the temboo.js SDK file.

    <script src="js-sdk/js/temboo.js"></script>
    
  16. In the same file, we'll also want to confirm that the location of our proxy is correctly specified. Our server is proxy-server.php.

    // Instantiate the client proxy with the URI of your server proxy
    var temboo = new TembooProxy('proxy-server.php');
    
  17. Back on the Choreo page, scroll down to the Proxy Code snippet and select PHP or another server-side proxy language from the Proxy Code Language dropdown menu. Copy the proxy code snippet and paste it into your proxy-server.php file.

  18. In the same .php file, make sure that the line points to the correct location of the php-sdk SDK folder that you downloaded earlier.

    require 'php-sdk/src/temboo.php';
    
  19. Try It Out

  20. Run the PHP server. For instance, if you're running the code using a web host, you can upload your project folder to your site via FTP client. If you're using Apache for PHP to run a local server, you'd run the following command from Terminal:

    sudo apachectl start
    
  21. Go to temboo-example.html in the browser at the url where you're server is running. For instance, if you're running the PHP server locally:

    127.0.0.1/projectFolderName/temboo-example.html
    
  22. Congrats! You just ran your first Choreo from our JavaScript SDK. Take a look at the developer console and you'll see the full Output.

    Choreo Output printed to the developer console
  23. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Try out some of our other tutorials.
  1. Install Node.js v0.8.0 (or later) on your system if you don't already have it.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Create a new .js file wherever you would like to build this Node.js sample project. In this example, we'll call the file tembootest.js, though you can call it whatever you like.
  4. Download the Temboo Node.js SDK and extract it.
  5. The SDK is in a directory called node_modules in accordance with the convention established by the Node Package Manager. Move the node_modules folder to the same directory as your new .js project file.
  6. Generate Your Code

  7. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  8. Select from the drop down menu at the top of the page.

  9. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  10. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  11. Scroll down to find the Code section of the Choreo page.
  12. Copy the code snippet and paste it into your tembootest.js file.
  13. Make sure that all of your import statements are included. Both of the following lines should be present and uncommented in your code.

    var tsession = require("temboo/core/temboosession");
    var Google = require("temboo/Library/Google/Geocoding");
    
  14. Print results

    Before we try a test run of the app, let's update the code to print the results returned from Google's Geocoding service.

    Each Choreo in the SDK returns a ResultSet subclass that contains accessor methods tailored specifically to the outputs of that Choreo. Using the ResultSet, you can retrieve the raw data XML or JSON returned by a third-party API and, in most cases, relevant fields that we've parsed out of the response for you. Remember, sample code for every Choreo can be found in the Library.

    The example code already logs the longitude, you simply have to ask it to log the latitude as well:

  15. Edit the success callback (function(results){...}) so that it looks like this:

    function(results) {
        console.log("Latitude: %s", results.get_Latitude());
        console.log("Longitude: %s", results.get_Longitude());
    }
    

    Your finished version of the execute() method should look like this:

    // Run the choreo, specifying success and error callback handlers
    geocodeByAddressChoreo.execute(
        geocodeByAddressInputs,
        function(results) {
        	console.log("Latitude: %s", results.get_Latitude());
        	console.log("Longitude: %s", results.get_Longitude());
        },
        function(error){console.log(error.type); console.log(error.message);}
    );
    
  16. Try It Out

  17. Now you're ready to run the script and see the output. Here's the command you need to run if you're executing this from the command line. Otherwise just run it from your IDE.

    node tembootest.js
  18. Congrats! You just ran your first Choreo from our Node.js SDK! You should see the coordinates for the address you specified printed to the console.

    Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Try out some of our other tutorials.
  1. Be sure that you have PHP 5 (or later) and a PHP code editor. We've used Sublime Text for our tutorials but they will work equally well in whatever IDE you are using.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Create a new PHP file in your preferred editor.
  4. Download the Temboo PHP SDK.
  5. Unzip the downloaded SDK and move the resulting php-sdk folder into the same parent folder as your new, blank PHP file.

  6. Add the Temboo PHP SDK to your script:

    require 'php-sdk/src/temboo.php';
  7. Generate Your Code

  8. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  9. Select from the drop down menu at the top of the page.

  10. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  11. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  12. Scroll down to the code box on the Choreo page to find the generated code.
  13. Copy the code snippet and paste it into your PHP script.
  14. Print Results

    Before we try a test run of the script, let's update the code to print the results returned from Google's Geocoding service.

    Each Choreo in the PHP SDK returns a Temboo_Results subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the Temboo_Results, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you.

  15. To print the latitude and longitude returned by the Choreo, simply add the following code at the bottom of your script:

    // Print lat and lon
    echo "Latitude: " . $geocodeByAddressResults->getLatitude() . "\n";
    echo "Longitude: " . $geocodeByAddressResults->getLongitude() . "\n";
    
  16. Try it Out

  17. Run the code and you will see the results in the console. Congrats! You just ran your first Choreo from our PHP SDK.

    PHP Screen Console
  18. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Try out some of our other tutorials.
  1. If you don't already have it, download and install the latest version of Processing.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Download the Temboo Library for Processing. Unzip the file and put the temboo folder into your Documents/Processing/libraries/ folder (or My Documents/Processing/libraries/ on a PC). If Processing is currently open, restart it so that it will recognize the Temboo library that you just added.
  4. Generate Your Code

  5. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  6. Select from the drop down menu at the top of the page.

  7. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  8. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  9. Scroll down to the code box on the Choreo page to find the generated code. Copy the code, and paste it into a new sketch in the Processing editor.
  10. In order to run this sketch, your Temboo account name and application details must be included in the TembooSession, like so:

    Temboo account details in the Processing sketch
  11. When you're logged in, this information is automatically populated in your generated sketch. Remember to remove your account details if you share your sketch.

    Try it Out

  12. Run the sketch from Processing, and you will see the results in the Processing console. Congrats! You just ran your first Choreo in Processing.

    The Processing console with results returned by the Choreo
  13. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Try out some of our other tutorials.
  1. Make sure that Python 2.6 (or later) is installed on your system.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Create a new .py file the directory where you'd like to build this Python sample project. In this example, we'll call the file TembooTest.py, though you can call it whatever you like.
  4. Download the Temboo Python SDK and extract the ZIP file to the same directory as your new .py file.
  5. Generate Your Code

  6. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  7. Select from the drop down menu at the top of the page.

  8. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  9. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  10. Scroll down to the code box on the Choreo page to find the generated code.
  11. Copy the code snippet and paste it into your TembooTest.py file.
  12. Try it Out

  13. Now you're ready to run the script and see the output. Here's the command you need to run if you're executing this from the command line. Otherwise just run it from your IDE.

    python TembooTest.py
    
  14. Congratulations, you just ran your first Choreo! You should see the coordinates for the address you specified printed to the console.
  15. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Try out some of our other tutorials.
  1. To follow this tutorial, you will need Ruby 1.9 (or later) and a Ruby code editor installed on your system.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Create a new Ruby project somewhere in your filesystem.
  4. Add a new Ruby script to your project. You can call it whatever you like.
  5. Download the Temboo Ruby SDK.
  6. In a terminal window, navigate to the location of your downloaded SDK. Type gem install temboo-ruby-sdk-x.gem, where x is the version number. You will now be able to access Temboo's Ruby SDK in your code.
  7. Generate Your Code

  8. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  9. Select from the drop down menu at the top of the page.

  10. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  11. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  12. Try it Out

  13. Scroll down to the code box on the Choreo page to find the generated code.
  14. Copy the code snippet and paste it into your Ruby script.
  15. Make sure your imports are in place at the top of the file. They should look like the sample below.

    require "temboo"
    require "Library/Google"
    
  16. Print Results

    Before we try a test run of the app, let's update the code to print the results returned from Google's Geocoding service.

    Each Choreo in the SDK returns a ResultSet subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the ResultSet, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you.

  17. To print the latitude and longitude returned by the Choreo, simply add the following code at the bottom of your script:

        # Print lat/lon
        printf("Latitude: %s\n", geocodeByAddressResults.get_Latitude())
        printf("Longitude: %s\n", geocodeByAddressResults.get_Longitude())
    
  18. Run the code and you will see the results in the console. Congrats! You just ran your first Choreo from our Ruby SDK.
  19. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Try out some of our other tutorials.
  1. To follow this tutorial, you will need to have cURL installed on your system.
  2. Sign in to your Temboo account. If you don't already have one, you can register for free.
  3. Generate Your Code

  4. Navigate to Google > Geocoding > GeocodeByAddress in the Temboo library.
  5. Select from the drop down menu at the top of the page.

  6. Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.

    Input for the Geocoding Choreo
  7. Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.

    Output returned by the Google Geocoding API
  8. Try it Out

  9. Scroll down to the code box on the Choreo page to find the generated code.
  10. Now you're ready to run the script and see the output. Copy the cURL script and paste it into your terminal or console. If all goes according to plan, you should see an API response from Google.
  11. Need help?

    We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.

    What's Next?

    Try out some of our other tutorials.