2017년 7월 29일 토요일

Error 403 Daily limit of unauthenticated use exceeded while updating Fusion Table


I am working on an app that is like an extension to the Pizza party app. Here first the user enters user ID and amount spent and that gets subtracted from his balance.
Now while doing SELECT, I face no problem, but while running UPDATE query on the table, it gives the Error 403 Daily limit of unauthenticated use exceeded error.
I am logged on in my phone and have edit permissions for the same login.
Attaching the UPDATE query and the results. Here I have verified that the variables global updated_amt_full and global row_no (contains the ROWID) are correct.
Attaching the codes. Pls help
 --
 Your block calling UPDATE looks suspicious    is it actually   spaceUPDATEspace    or spaceUPDATEnospace ?   I can not tell from the image.

--
Thnks for your prompt reply. 
The UPDATE block is spaceUPDATEspace. Similarly the other blocks also have proper spaces. 
Any other suggestions, pls ??

--
I assume your blocks posted do not show all your code.  Do you use your API code?  The API is necessary to access your table.

Keep in mind, f you do not include an API Key, you will receive a "403: Daily Limit Exceeded" message. 

From the Pizza Party Fusion table:

which you are probably using as an example for your code shows some blocks that might be missing or that do not have the correct API Key.    Is that possible?     Please check and get back here to let us know if they are there or they were missing.

--
You were spot on. Since I was using multiple Fusion table control objects, I actually did forget to include the API key for the last one.
Doing it removes the error. Thnks.
But it gives a new error: 503 service Unavailable Internal error. Please report to ...

Any suggestions here??

--
you might want to provide a screenshot of your relevant blocks

--
Glad my suggestion worked.  So, you get a different error.  "it gives a new error: 503 service Unavailable Internal error. Please report to "
I have mixed results with Google's Fusion Tables; after all they are Experimental.  Google keeps changing how they work and what they look like AND they are not always available.

I have gotten that error, waited a few minutes and my access was OK, so try again.  Are you using an emulator or a device.  Sometimes the emulator has issues and it is possible you have not given users (and yourself) all the permissions needed.

Look here:  Fusion Table API    .    Have you looked at your table using Windows or whatever OS you have?  Try accessing your table using windows.  I have found that many users are using tables that are mal-formed and un-editable even when using DropBox.  The solution is to rebuild the table using your PC and then change the table ID in your aI2 code.

Why not try this and get back to us here at the forum .  If your table is in good shape, consider providing an aia file or images of your relevant blocks as suggested by Taifun.  If you can not edit your own table using dropbox, your issues is with Fusion Tables and not AI2.

You can access your table by pasting code similar shown at this link into your browser window  Direct Windows Access to FT  . The link explains how.   Try viewing/editing your table using the example code remembering to replace the table ID with your table's id.

--
Thnks for your support so far. I continue to get the 503 service unavailable error. I would like to answer to the issus raised by you.
1) I have a windows 7 machine and I am running on a device through wifi.

2) I tried to re do the query and it still gives the same error, so probably its not a temporary issue.
3) I have Two fusion tables say A and B. On B I am running an INSERT query that works fine. On A, I run a SELECT query that works fine and an UPDATE query that gives the error.
4) I ran the update queries the way you told me through the browser.
First I ran the query 
This gave an error saying need to send a POST request and not GET.
to send the UPDATE query. After authenticating with the API key, I ran the query 
UPDATE 1yL3P7x0ET84EXE-k3nI2sktew3KDbr9wW0grFG8 SET Amount = '450' WHERE ROWID = '1'
The Query actually works and the fusion table is updated
This is a snapshot of the response

Inline image 1

Question is if this works, why is it giving the 503 Error from the app ??? Any suggestions

--
In addition to my previous response to Steve, I would also give snapshots of most of the blocks as you have asked.

Basically I am trying to modify the Pizza party app such that there are two tables: say A and B. When user buys something, we check if he has sufficient balance in A, (SELECT query works fine). If yes the transaction is stored in B (INSERT query, works well) and the specific user's balance is reduced in A (UPDATE query: not working)

Fig 1 These are the global variable declarations
Fig 2 These are the initialization and reset form functions (Similar to Pizza party)
Fig 3 Submit button functions (Similar to Pizza party)
Fig 4 and 5 SELECT query and response handling (seems to be working fine)
Fig 7 and 6 INSERT query and response handling (Similar to Pizza party and seems to be working fine) 
Fig 8 and 9 : The UPDATE query: GIVES 503 Internal error: Service not available

Attaching the figures below. Any help would be great.


















--
I you are asking for help, I recommend you to make it as easy for others to be able to help you ...
first to unzip something is not very helpful from my point of view...


to find out, if your sql statement is correct, right click onto the join block of the statement and select "Do It"... it looks like there is a space missing after UPDATE, also the amount in your table most probably is numeric and not text? if yes, remove the quotes around the amount...
you might want to provide another screenshot of the update statement incl. Do it result...

--
I agree with Taifun, there is a space missing after UPDATE in your updateBalanceTab

Also, your values probably are numeric.  You can check your table on Windows and find out whether each field is text or numeric;  Do you know how to do that.  You may need to remove the quotes from the amount and the row ID.  Do those things, try your app and let us know.  So basically, I am agreeing with Taifun's suggestions.

Another thing that seems suspicious is where you retrieve  SET Amount=   I am not sure what the actual name for the field is in your table.    Consider "UPDATE 1yL3P7x0ET84EXE-k3nI2sktew3KDbr9wW0grFG8 SET Amount = '450' WHERE ROWID = '1'    " as a direct query works.  Check for missing spaces.  I noticed that when you defined the two globals used in this sql query they are defined as text.

I would get rid of the quotify blocks temporarily and test the sql statement again.   Since the UPDATE does work on the table, you are possibly close to a solution.

--
Thnks for your prompt reply.
My apologies if the way I mailed was not helpful. I on the contrary felt that sending all the attachments zipped in one file would be helpful as it would help you not having to download all the  attachments separately. I will keep your advice in mind.

Coming to your suggestions:  there is a space after UPDATE. 
I have removed the quotes as the Amount column indeed is numeric. But the problem continues.
I am sending you the snapshot of the UPDATE block. 



--
Remove the quotify block from the row ID too.

Why?   The answer is probably here:      '450' WHERE ROWID = '1' 

so if '450' should be 450, then rowid should be 1    .    Does that make sense.

--
When I remove the quotify block from row ID it gives me a different error
400 Bad Request Invalid Query: Parse error near '1&#39 (line 2 position 0)

Though I am not sure, is it that the row_no variable is getting the value \n 1 instead of 1 ??
Sending you the update block again



--
Also to reply to an earlier query, the table has two fields Name (Text) and Amount (Numeric, format 1235.56 ) 
the rowid needs to be quotified
unfortunately I can't see in your Do it result, if the statement is correct...
it would help if we could see the Do it result in one row only, just resize that window accordingly...

--
Quotified rowid. That again brings back the 503 error

I am sending the query in one line. Somehow the rowId never comes in the same line of the query. Is there an unnecessary  \n or something??



--
Would it make sense instead of getting the row ID  to get     WHERE Name=     ?
Also is ROWID=  called in all capitals or should it be rows.id=    ??? 

even though this query works perfectly well:  UPDATE 1yL3P7x0ET84EXE-k3nI2sktew3KDbr9wW0grFG8 SET Amount = '450' WHERE ROWID = '1'

--
I think I know now why you get the problem...
how do you retrieve the rowid?
in case you do a query like that "SELECT ROWID FROM <tableid> WHERE ...
you will get a 1 column result like that:

rowid
1

now use the split command to split the result by \n to get a 2 item list and select the second item, which is the rowid: 1
probably you do it different currently and the invisible \n is inside your rowid variable...

--
The quotify procedure is same as the one being used in pizza party example, I dont think there is any mistake there.
I think the point you are making is right. I think there is a problem in the split. Let me see to it.
Also to Steve's suggestion can we have a UPDATE query with WHERE name = . If yes, that would suffice because Name is the primary key. But the syntax seems to say we need WHERE ROWID thing.

I will try out both and connect back in some time.

--
Also to Steve's suggestion can we have a UPDATE query with WHERE name = .  But the syntax seems to say we need WHERE ROWID thing.
exactly, "WHERE name=" is not possible in the fusion table syntax, you need the ROWID...

--
It works !!!!
Yes, though the splits have been done haphazardly by me, I followed Taifun's suggestion and did one more split at \n and then took index 2. This removes the \n problem and the UPDATE worked !!!
Really want to thank both of you, for helping me out. 

I would probably do some more cases and see if this works all the time and get back to you.

Also @ Taifun, I found the parsing of JSON packets pretty difficult for first timers like us. Any links/posts that I may follow. I say a few posts from you in ai1, but not much in ai2. 

--
I am very glad you got this working and I hope you had a lot of fun.   It was clever of Taifun about the \n split.  You spent a lot of time on the project, tried lots of suggestions and it payed off.  Congratulations.

--

댓글 없음:

댓글 쓰기