Google Fusion Tables API

Migration Guide

This Migration Guide documents how to convert existing code using the SQL API to code using the Fusion Tables API 1.0. This information is discussed in more detail in the Getting Started and Using the API developer guides.

Contents

Quick Comparison

API feature SQL API New API V1.0
URL Endpoint https://www.google.com/fusiontables/api/query https://www.googleapis.com/fusiontables/v1/query
URL Parameters sql sql, key, alt, callback. See URL query parameters.
HTTP methods GET for SELECT, SHOW TABLES, DESCRIBE TABLE
POST for CREATE, INSERT, UPDATE, DELETE, DROP
GET for SELECT, SHOW TABLES1, DESCRIBE TABLE2
POST for CREATE, INSERT, UPDATE, DELETE, DROP3

1 The preferred way to list tables is to use the Table: list method.
2 The preferred way to describe a table is to use the Table: get method.
3 The preferred way to drop a table is to use the Table: delete method.
Authorization

Authorization required for the following requests:

  • Private tables
  • Non-exportable tables
  • Any write request
  • SHOW TABLES

Authorization mechanisms:

  • ClientLogin
  • OAuth versions: 1.0 and 2.0

Authorization required for the following requests:

  • Private tables
  • Non-exportable tables
  • Any write request
  • SHOW TABLES

Authorization mechanisms:

  • API key
  • OAuth version: 2.0
OAuth scope https://www.googleapis.com/auth/fusiontables https://www.googleapis.com/auth/fusiontables
https://www.googleapis.com/auth/fusiontables.readonly
Client libraries PHP and Python client libraries Client libraries for many languages
Response format csv json (default)
csv
Sample code SQL API sample code API V1.0 sample code

How to migrate

The steps you need to take to migrate are:

  1. Turn on Fusion Tables in the APIs Console.
  2. Remove numeric table IDs from your code.
  3. Update to the new Google client libraries (for users of client libraries such as the PHP or Python libraries).
  4. Update the URL endpoint in your application. This step may not be necessary if you are using the new client libraries.
  5. Update the OAuth scope.
  6. Update requests to use additional query parameters as needed.

1. Turn on Fusion Tables API

You need to turn on the Fusion Tables API in the Google APIs Console. The APIs Console provides an API key and helps you track API usage. If you don't use OAuth, you'll need an API key to authorize requests.

When you're in the APIs Console, select Services in the left-hand navigation. Find Fusion Tables API in the list and click the Status toggle to change it to green "ON."

2. Remove numeric Table IDs

Fusion Tables API V1.0 supports only encrypted Table IDs. It does not handle numeric table IDs. Make sure your code can handle string table ids.

3. Update client libraries if necessary

If you have been using client libraries such as the Fusion Tables PHP or Python client libraries, you need to update your code to use the new Google client libraries.

Google has a set of client libraries in various languages. These client libraries make development using Google's APIs easy. Update your application to use these libraries.

4. Update the URL endpoint

The URL end point for Fusion Tables has changed. You need to update your application to point to the new endpoint.

https://www.google.com/fusiontables/api/query  -> https://www.googleapis.com/fusiontables/v1/query
If you are using client libraries, you may not need to perform this step.

5. Update OAuth scope

If you're using OAuth, update to the new scope:

https://www.googleapis.com/auth/fusiontables

Your users will have to reauthenticate to your app because you are using a new scope. Make sure your application can handle any failures and will reinitiate the authorization flow.

6. Update URL parameters

Depending on your requirements, you may need to use additional query parameters. The two most commonly used ones are alt and key.

The new SQL API defaults to JSON-formatted response data. If your application is set up to expect CSV data in response, you have two options:

  • Update your application to handle JSON instead.
  • Use the alt parameter to ensure data is returned in CSV format (alt=csv).

The value of the key can be found in the Google API Console . Select API Access in the left-hand column and scroll down to the Simple API Access section.

Parameter Description
alt

The new SQL API defaults to JSON-formatted response data. If your application expects CSV-formatted data, you have two options:

  • Update your application to handle JSON instead.
  • Use the alt parameter to ensure data is returned in CSV format (alt=csv).
callback If you're using a callback, you need to use the callback parameter.
key If you aren't using OAuth to authorize requests, you need to include an API key. The key parameter provides this API key.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.