Getting error while getting Google plus posts

G

George

Hi,
I am using the following code to get the Google Plus posts,


import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
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.googleusercontent.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.googleusercontent.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!
 
L

Lew

George said:
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.
 
R

Roedy Green

"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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top