How to connect to any API with Temboo


We have over 100 web-based resources and services in our Library, but there may be times when you need to get connected to an API that isn't currently supported. Here we'll show you how to use Temboo to make HTTP requests to any API using our Utilities > HTTP Choreos.

API Authentication

Not all APIs require require authentication, but many of them do. Understanding the authentication mechanism that an API uses is often the first step when getting started. The most common authentication schemes are:

Basic Authentication

When an API uses Basic Authentication, you can simply authenticate using your username and password. The Utilities > HTTP Choreos expose inputs for Username and Password, and generate a Basic Authentication token for you. In the HTTP request that is performed when running these Choreos, your username and password are concatenated, Base64 encoded, and passed into the Authorization header like this:

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

The above token is the Base64 encoded string representing the username/password combination: Aladdin:open sesame.

API Key Authentication

Another common authentication scheme is key-based authentication. This is when an API issues a key that identifies your application and authenticates you with the service. An API Key can be specified in a query parameter, header parameter, or even in the base URL.

API Key sent as a query parameter name/value pair:

https://www.googleapis.com/youtube/v3/search?key=your_api_key

API Key sent as a header parameter name/value pair, along with the Accept header:

X-M2X-KEY: your_api_key
Accept: application/json

API Key sent as part of the base URL for a request:

http://api.wunderground.com/api/your_api_key/conditions/q/CA/San_Francisco.json

OAuth 2.0

OAuth 2.0 is the most preferred method for API authentication when applications need to access data on behalf of a user. The protocol allows a user to authorize third-party access to their resources without sharing their credentials. It is used by Google, GitHub, Facebook, Microsoft, and countless other web services.

If you are working with an API that uses OAuth 2.0, you can use the Utilities > Authentication > OAuth2 Choreos to authenticate a user and retrieve access tokens.

HTTP Methods

In the HTTP bundle, you'll find Choreos for the most common HTTP methods used in API requests:

Specifying Request Data

When using the HTTP Choreos, request data is specified in one or more of the following inputs:

Test It Out

A good way to test these Choreos is to use RequestBin - a service that makes it easy to inspect HTTP requests. Follow the steps below to make a POST request to RequestBin and inspect the request data.

  1. Create your own RequestBin.
  2. Go to the Utilities > HTTP > Post Choreo in the Temboo Library.
  3. Specify your unique Bin URL for the URL input.
  4. Specify test values for Username and Password.
  5. Specify a valid JSON object for the RequestParameters and RequestHeaders inputs.
  6. Specify some raw test data for the RequestBody input.
  7. Click Generate Code to test the Choreo from our website, then refresh your RequestBin to inspect the POST request sent from Temboo.

Example inputs for the HTTP POST Choreo

With an input set like this, you will see the name/value pair sent in the RequestParameters listed as the query string received. You will also see the Content-Type and Authorization headers received since the RequestHeaders, Username, and Password were specified. Finally, the data specified in the RequestBody input should be listed as the Raw Body in RequestBin.

Example of POST request data in RequestBin

What next?

Now you're ready to run any of our HTTP Utilities and start connecting to any API. You're just a few steps away from making something extraordinary!

Once you've got your code up and running, you're ready to move on and do more. From monitoring your running applications, to moving your generated Temboo code to your preferred development environment and sharing it with colleagues, collaborators and friends - we've got you covered.

Need help?

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


Back