我正在通过REST api更新Fusiontable样式。
但是我得到了错误与(500)后端错误消息。在同一时间,我得到了成功的消息在fusiontable插入/更新行通过REST api。
我如何调试/解决这个问题。
下面是我的代码:$columnName = self::getStyleColumnPrefix($style_id);
$strokeOpacity = '1';
$fillOpacity = '1';
$kind = 'fusiontables#fromColumn';
$tableId = $this->table;
$styleId = $style_id;
$fillColorStyler = new Google_Service_Fusiontables_StyleFunction();
$fillColorStyler->setColumnName($columnName);
$fillColorStyler->setKind($kind);
$polygonOptions = new Google_Service_Fusiontables_PolygonStyle();
$polygonOptions->setFillColorStyler($fillColorStyler);
$polygonOptions->setStrokeOpacity($strokeOpacity);
$polygonOptions->setFillOpacity($fillOpacity);
$postBody = new Google_Service_Fusiontables_StyleSetting();
$postBody->setPolygonOptions($polygonOptions);
// $this->service = new Google_Service_Fusiontables_Style_Resource();
$results = $this->service->style->update($tableId, $styleId, $postBody);
最后一行出现错误
$results = $this->service->style->update($tableId, $styleId, $postBody);
堆栈跟踪
File: D:xampp2htdocsitp-benchmarkingbranchesdevelopmentvendorgoogleapiclientsrcGoogleHttpREST.php:110 Message: Error calling PUT https://www.googleapis.com/fusiontables/v2/tables/1ycoFAd3BrVZ248zXausz4kKe66Jj3fZDeKvxlBMy/styles/1: (500) Backend Error Stack trace: @0 D:xampp2htdocsitp-benchmarkingbranchesdevelopmentvendorgoogleapiclientsrcGoogleHttpREST.php(62): Google_Http_REST::decodeHttpResponse(Object(Google_Http_Request), Object(Google_Client)) @1 [internal function]: Google_Http_REST::doExecute(Object(Google_Client), Object(Google_Http_Request)) @2 D:xampp2htdocsitp-benchmarkingbranchesdevelopmentvendorgoogleapiclientsrcGoogleTaskRunner.php(174): call_user_func_array(Array, Array) @3 D:xampp2htdocsitp-benchmarkingbranchesdevelopmentvendorgoogleapiclientsrcGoogleHttpREST.php(46): Google_Task_Runner->run() @4 D:xampp2htdocsitp-benchmarkingbranchesdevelopmentvendorgoogleapiclientsrcGoogleClient.php(590): Google_Http_REST::execute(Object(Google_Client), Object(Google_Http_Request)) @5 D:xampp2htdocsitp-benchmarkingbranchesdevelopmentvendorgoogleapiclientsrcGoogleServiceResource.php(237): Google_Client->execute(Object(Google_Http_Request)) @6 D:xampp2htdocsitp-benchmarkingbranchesdevelopmentvendorgoogleapiclientsrcGoogleServiceFusiontables.php(904): Google_Service_Resource->call('update', Array, 'Google_Service_...') @7 D:xampp2htdocsitp-benchmarkingbranchesdevelopmentmoduleBenchMarkingsrcBenchMarkingModelFusionTableModel.php(494): Google_Service_Fusiontables_Style_Resource->update('1ycoFAd3BrVZ248...', 1, Object(Google_Service_Fusiontables_StyleSetting)) @8 D:xampp2htdocsitp-benchmarkingbranchesdevelopmentmoduleBenchMarkingsrcBenchMarkingControllerFusionTableController.php(268): BenchMarkingModelFusionTableModel->setStyleIdOfMeasure(1)
我使用google-api-php-client (v1.1)
看起来你不能同时设置colorStyler
和其他属性,如strokeOpacity
。当我删除后者时,我不再收到错误。
目前没有文档记录,API错误响应肯定应该更清楚地说明这个问题…