Google FusionTable - Google API for .Net -


we trying access/update google fusion table using google api .net. downloaded .net api , below code. able table information, not execute sql queries. of them returning error “forbidden [403]”. please review , point out our error:

this error message:

{ "error": {   "errors": [    {     "domain": "global",     "reason": "forbidden",     "message": "forbidden"    }   ],   "code": 403,   "message": "forbidden" } } 

below code:

    using google.apis.auth;     using google.apis.fusiontables;     using google.apis.auth.oauth2;     using google.apis.fusiontables.v2;     using google.apis.services;     using google.apis.fusiontables.v2.data;      var tableid = "table id";     var serviceaccountemail = "id@developer.gserviceaccount.com";     var certificate = new x509certificate2(@"..\app_data\api project-d000b00dd0b0.p12", "notasecret", x509keystorageflags.exportable);      serviceaccountcredential credential = new serviceaccountcredential(        new serviceaccountcredential.initializer(serviceaccountemail)        {            scopes = new[] { fusiontablesservice.scope.fusiontables }        }.fromcertificate(certificate));      fusiontablesservice fusiontablesservice = new fusiontablesservice(new baseclientservice.initializer()     {         httpclientinitializer = credential,         applicationname="test"     });      table tabledata = fusiontablesservice.table.get(tableid).execute();  **//this code executes fine , table info(all column names).**      try  **//the execute query throws error ‘403 – forbidden’**      {         string query = "delete " + tableid + " rowid = '407';";                         var response = fusiontablesservice.query.sql(query).execute();     }     catch (exception ex)     {         logmessagetofile(ex.tostring());     }      try **//the execute query throws error ‘403 – forbidden’**     {         string query = "update " + tableid + " set name = 'ou pharmacy', address = '1200 n phillips suite 2100 oklahoma city ok 73104', coordinates = '35.4792635,-97.4976772', lat = '35.4792635', lng = '-97.4976772', phone = '405-271-2156', sflg = '1', marker = 'red_blank', type = 'iias' rowid = '422';";         var response = fusiontablesservice.query.sql(query).execute();     }     catch (exception ex)     {         logmessagetofile(ex.tostring());     }      try **//the execute query throws error ‘403 – forbidden’**     {         string query = "insert " + tableid + " (lid, name, address, coordinates, lat, lng, phone, sflg, type, marker) values ('10','bell pharmacy','113 boyer ave. p.o. box 888 lincoln ar 72744','35.9493900,-94.4242120','35.9493900','-94.4242120','','1','nty','grn_blank');";         var response = fusiontablesservice.query.sql(query).execute();     }     catch (exception ex)     {         logmessagetofile(ex.tostring());     } 

thanks, arun

i never use fusion-tables in general, access google data using service account need enable required permission service account.

in order enable permission need logon using administrative account, using administrator console can add desired permission using security->(show more)advanced->manage api client access (see here). here can find permission need grand.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -