Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Getting error while getting Google plus posts

Reply
Thread Tools

Getting error while getting Google plus posts

 
 
George
Guest
Posts: n/a
 
      06-27-2012
Hi,
I am using the following code to get the Google Plus posts,


import com.google.api.client.googleapis.auth.oauth2.Googl eCredential;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTranspor t;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.client.json.jackson.JacksonFactory;
import com.google.api.services.plus.Plus;
import com.google.api.services.plus.PlusScopes;
import com.google.api.services.plus.model.Activity;
import com.google.common.base.Preconditions;
import com.google.common.io.Files;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URI;
import java.nio.charset.Charset;
import java.security.PrivateKey;
import java.text.*;
import java.util.Properties;

import redegg.redcals.update.View;

public class Test {

/** E-mail address of the service account. */
private static final String SERVICE_ACCOUNT_EMAIL = "801283043278-
ek42r1e5ulsvdremass1huh7rtcq16lp.apps.googleuserco ntent.com";

/** Global instance of the HTTP transport. */
private static final HttpTransport HTTP_TRANSPORT = new
NetHttpTransport();

/** Global instance of the JSON factory. */
private static final JsonFactory JSON_FACTORY = new
JacksonFactory();

private static Plus plus;

public static void main(String[] args) {
try {
try {

GoogleCredential credential = new GoogleCredential.Builder()
.setClientSecrets("801283043278-
ek42r1e5ulsvdremass1huh7rtcq16lp.apps.googleuserco ntent.com",
"1BgzhV28ie_EXF7AD4Xf3y75")
.build();
plus = new Plus.Builder(HTTP_TRANSPORT,JSON_FACTORY,
credential).build();

getActivity();
// success!
return;
} catch (IOException e) {
System.err.println(e.getMessage());

}
} catch (Throwable t) {
t.printStackTrace();
}
System.exit(1);
}

/** Get an activity for which we already know the ID. */
private static void getActivity() throws IOException {
String activityId = "z12stbfxcpmkuthac04ci3gjvoywglkwx0k";
Activity activity = plus.activities().get(activityId).execute();

System.out.println("id: " + activity.getId());
System.out.println("url: " + activity.getUrl());
System.out.println("content: " +
activity.getObject().getContent());
}
}

While running this code I am getting the following error,


403 Forbidden
{
"code" : 403,
"errors" : [ {
"domain" : "usageLimits",
"message" : "Daily Limit Exceeded. Please sign up",
"reason" : "dailyLimitExceededUnreg",
"extendedHelp" : "https://code.google.com/apis/console"
} ],
"message" : "Daily Limit Exceeded. Please sign up"
}

Could any one please help me to fix this error.

Thanks in Advance!

 
Reply With Quote
 
 
 
 
George
Guest
Posts: n/a
 
      06-27-2012
On Jun 27, 9:03*pm, markspace <-@.> wrote:
> On 6/27/2012 7:32 AM, George wrote:
>
> > * * *"message" : "Daily Limit Exceeded. Please sign up",

>
> Here is the problem, and the solution. *My, that was easy.


can ypu please tell me what the solution is?
 
Reply With Quote
 
 
 
 
George
Guest
Posts: n/a
 
      06-27-2012
On Jun 27, 9:03*pm, markspace <-@.> wrote:
> On 6/27/2012 7:32 AM, George wrote:
>
> > * * *"message" : "Daily Limit Exceeded. Please sign up",

>
> Here is the problem, and the solution. *My, that was easy.



Could you please tell me what the solution is?
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      06-27-2012
George wrote:
> markspace <-@.> wrote:
>> George wrote:
>>
>>> * * *"message" : "Daily Limit Exceeded. Please sign up",

>>
>> Here is the problem, and the solution. *My, that was easy.

>
> can ypu please tell me what the solution is?


"Daily Limit Exceeded. Please sign up"

It's not very polite to ignore the answer given and demand it again.

--
Lew
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      06-28-2012
On Wed, 27 Jun 2012 07:32:13 -0700 (PDT), George <(E-Mail Removed)>
wrote, quoted or indirectly quoted someone who said :

> "message" : "Daily Limit Exceeded. Please sign up"


It looks as though you must register with Google and get some sort of
account and password that you must use it to receive these messages. I
looks as if you left it out, got it wrong or screwed up the format.
Apparently it lets you experiment a little without signing up, or
maybe the limit is 0 and this is misleading error message.

I suggest googling for code that other people have written to do this.
That is how I cracked a similar problem with an Amazon API with
monumentally incompetent documentation.

Use the names of Google-specific classes to help you find it.
--
Roedy Green Canadian Mind Products
http://mindprod.com
When you get stuck trying to solve a computer program:
1. Go into the kitchen and make coffee.
2. If that fails, go for a walk.
3. If that fails, take a nap.
Why? To avoid being swamped with details, to see the big picture,
to allow in some random noise to kick you out of your thinking rut.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
c plus plus code comparator furqan shaikh C++ 6 11-12-2008 06:14 AM
Invoking c function in a c plus plus function... Rahul C++ 9 03-25-2008 05:24 PM
C plus plus vs C Sharp The LoxFather C Programming 23 08-14-2003 03:51 AM
C plus plus vs C Sharp The LoxFather C++ 23 08-14-2003 03:51 AM



Advertisments