Search code examples
bashubuntucurlgoogle-fusion-tables

Import Rows via CURL, success response but no change in Fusion Table


Using the code here http://fusion-tables-api-samples.googlecode.com/svn/trunk/ftapi/ [1] I can produce a successful response by running [2] cat PATHTOMYDATA.csv | ./ftupload.sh MYTABLEID . But I see no change in the Fusion Table specified by MYTABLEID

Some things I've tried: -upload to new, blank table with correct number of columns ... same result -upload to other table with incorrect number of columns ... receive error about columns -various modifications of the curl command in ftupload.sh [3] --remove -s -S (so can get full output) ... same result --giving file as parameter rather than streaming standard input [4] ... same result --sending without --data-binary flag.. produces HTTP/1.1 405 Method Not Allowed
--sending with -v flag, produces the following log of HTTP request [5]

[1] Which is functionally identical to http://fusion-tables-api-samples.googlecode.com/svn/trunk/ftapi, since that code doesn't change from rev56 to rev57

[2] On bash/Ubuntu

[3] originally:

curl -s -S --data-binary @- -H "Authorization: Bearer $access_token" \
  -H "Content-Type: application/octet-stream" \
  "https://www.googleapis.com/upload/fusiontables/v1/tables/$1/import"

[4]

curl -s -S --data-binary @PATHTOMYDATA.csv -H "Authorization: Bearer $access_token" \
  -H "Content-Type: application/octet-stream" \
  "https://www.googleapis.com/upload/fusiontables/v1/tables/$1/import"

[5]

* About to connect() to www.googleapis.com port 443 (#0)
*   Trying 74.125.29.95... connected
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-RC4-SHA
* Server certificate:
*        subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=*.googl                           eapis.com
*        start date: 2013-06-19 12:43:04 GMT
*        expire date: 2013-10-31 23:59:59 GMT
*        subjectAltName: www.googleapis.com matched
*        issuer: C=US; O=Google Inc; CN=Google Internet Authority
*        SSL certificate verify ok.
> POST /upload/fusiontables/v1/tables/MYTABLEID/import HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zli                           b/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: www.googleapis.com
> Accept: */*
> Authorization: Bearer ya29.AHES6ZTZG_aqdYJYg-JgeAMOHOQIJOYFWAaGzzDWDlP2OKzpof8                           MIkuPUA
> Content-Type: application/octet-stream
> Content-Length: 50
>
* upload completely sent off: 50out of 50 bytes
< HTTP/1.1 200 OK
< ETag: "TMh8SguO4XpkjXICbs8TpuVjR5I/BKKfZXT4y10ldV7sI6nrMgeYYNw"
< Content-Type: application/json
< Content-Length: 60
< Date: Fri, 28 Jun 2013 15:09:00 GMT
< Server: HTTP Upload Server Built on Jun 25 2013 11:32:14 (1372185134)
<
{
 "kind": "fusiontables#import",
 "numRowsReceived": "1"
}
* Connection #0 to host www.googleapis.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):

Solution

  • There was a bug that swallowed the first row for uploads from the API. It was introduced around April 2013 and is fixed as of 8/1/2013.