Question

I'm using fusion tables with an android app that I'm developing in AppInventor, and I had a question about the SQL Query for updating a row.

Now, before I ask the question, I will let you know that I would have included some screenshots of my blocks-editor code, but my boss told me I had to keep the app 100% closed source, so I can't provide any. Hopefully I'm not being too vague.

Anyways, I set a FusionTablesControl query using the "make text" block and the Google API UPDATE query, but when I send the query on my test device (Samsung Galaxy Player 5), the overlaying "Fusion Tables" load screen pops up for only a split second (it normally shows for 2 or 3 seconds). When I check the tables, there has been no change.

I think syntax is still a potential problem because when I typed the encoded URL into google chrome's address bar, it still didn't update the table. Here is the basic syntax of what I typed into the address bar.

https://www.googleapis.com/fusiontables/v1/query?sql=UPDATE%20tableID%20SET%20(Column1%3Ddata1%2C%20Column2%3Ddata2%2C%20Column3%3Ddata3%2C%20Column4%3Ddata4)%20WHERE%20ROWID%20%3D%20%27rowID%27

The decoded URL after the "sql=" part is:

UPDATE tableID SET (Column1=data1, Column2=data2, Column3=data3, Column4=data4) WHERE ROWID = 'rowID'

Any help would be appreciated.

Also, is it possible to set Google's API response to CSV instead of JSON?

Thanks, ~T16626

Was it helpful?

Solution

This does not work like that, because you did not use authentication. More about that see here:

Identifying your application and authorizing requests

Every request your application sends to the Fusion Tables API needs to identify your application to Google. There are two ways to identify your application: using an OAuth 2.0 token (which also authorizes the request) and/or using the application's API key. Here's how to determine which of those options to use:

If the request requires authorization (such as a request for an individual's private data), then the application must provide an OAuth 2.0 token with the request. The application may also provide the API key, but it doesn't have to. If the request doesn't require authorization (such as a request for public data), then the application must provide either the API key or an OAuth 2.0 token, or both—whatever option is most convenient for you.

To access a fusion table with App Inventor, you have 2 possibilities:

  1. use the built-in fusiontable control blocks, how to set up everything for App Inventor please see the Pizza Party tutorial
  2. use the web component with authentication, for details see here
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top