Google Fusion Table - creating new table using Google API client for PHP -
the following code results in 400 bad request... can see obvious problems?
$column = new google_column(); $column->setname('foo'); $column->settype('text'); $table = new google_table(); $table->setname('bar'); $table->setcolumns(array($column)); // $client below authenticated google_client instance $service = new google_fusiontablesservice($client); $result = $service->table->insert($table); // 400 bad request exception thrown
google_client authenticated "service account" , i'm able run other requests, e.g. $service->query->sql()
successfully.
google api client version 0.6.2 (up-to-date).
thanks.
update: request object dump:
google_httprequest object ( [batchheaders:google_httprequest:private] => array ( [content-type] => application/http [content-transfer-encoding] => binary [mime-version] => 1.0 [content-length] => ) [url:protected] => https://www.googleapis.com/fusiontables/v1/tables [requestmethod:protected] => post [requestheaders:protected] => array ( [content-type] => application/json; charset=utf-8 [content-length] => 162 [authorization] => bearer somehashhere ) [postbody:protected] => {"columns":[{"name":"project","type":"text"}],"description":"created on 2013-05-14 10:41:44","isexportable":"true","name":"foobar"} [useragent:protected] => app name google-api-php-client/0.6.0 [responsehttpcode:protected] => [responseheaders:protected] => [responsebody:protected] => [accesskey] => )
it's simple after see it, "text" not valid column type. need use "string" instead.
Comments
Post a Comment