0

I developed an android app, which is in the play store for few weeks.
The app shortens a URL with the Google URL Shortener API.

After almost exactly 1 month after the generation of the API key , I get the following error

com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{403,[{"domain": "usageLimits",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"reason": "dailyLimitExceededUnreg",
"extendedHelp": "https://code.google.com/apis/console"}],
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."}

My app has only about 10 users. The limit is not reached.

The error occurs on this part of my code:

// build URL Shortener
Urlshortener.Builder builder = new Urlshortener
                        .Builder(AndroidHttp.newCompatibleTransport(),
                        AndroidJsonFactory.getDefaultInstance(), null)
                        .setApplicationName("URL Shortener");

Urlshortener urlshortener = builder.build();
Url url = new Url();
url.setLongUrl(urlToBeShortened);


url = urlshortener.url().insert(url).execute(); //<-- Error in this line

I am not using OAuth. I am using the public API Key. The manifest.xml is also set properly.
The app worked for a month without any problems.
Is there a 30day-trial version on the Shortener API, or is it not anymore free to use or was there an update on the API?

Or what's worng with the code? I haven't touched it for the last 2 weeks and at this time it worked fine.

I appreciate any help!

Greetings auderix

P.S.: English is not my native language. If there are any errors: Sorry

PandaPlayer
  • 162
  • 9
  • Where in your code do you set the API key? (Do NOT post your API key!) The error message suggests you're using unregistered requests (i.e. no API key). – Philipp Reichart Mar 25 '15 at 22:31
  • In fact, opening https://www.googleapis.com/urlshortener/v1/url?shortUrl=somedummyvalue (also no API key) in a browser gives the same error you get. The URL Shortener API has no unregistered quota at all it seems. – Philipp Reichart Mar 25 '15 at 22:36
  • Your trial period has expired. You need to sign up now to Google... – Buhake Sindi Mar 25 '15 at 22:41
  • @PhilippReichart I set the API key in the manifest.xml as shown in this example [Stackoverflow](http://stackoverflow.com/questions/6708297/jquery-and-google-url-shortener-api). But I don't set it again in the java files. – PandaPlayer Mar 28 '15 at 14:17
  • @BuhakeSindi I thought URL Shortener API is free to use? Where can I sign up for it? – PandaPlayer Mar 28 '15 at 14:18
  • That example you mentioned is for a Chrome extension, not an Android app. I don't think setting an API key in an Android manifest.xml has any effect. – Philipp Reichart Mar 30 '15 at 17:33
  • Getting an API key is easy, just follow these instructions and at step 5 pick "Public API access": https://developers.google.com/url-shortener/v1/getting_started#APIKey. The API key "identifies your project and provides API access, quota, and reports". The current quota is 1 million requests/day and 1 query/second/user which should be plenty for your app. – Philipp Reichart Mar 30 '15 at 17:33
  • sorry @PhilippReichart. Just copied the wrong example. I meant [this one](http://stackoverflow.com/questions/18372672/how-do-i-use-the-google-url-shortener-api-on-android). How to get the key is not the problem. But how do I set it in the app? – PandaPlayer Mar 30 '15 at 19:16

0 Answers0