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!
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!