Getting error while getting Google plus posts

Discussion in 'Java' started by George, Jun 27, 2012.

  1. George

    George Guest

    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!
     
    George, Jun 27, 2012
    #1
    1. Advertising

  2. George

    George Guest

    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?
     
    George, Jun 27, 2012
    #2
    1. Advertising

  3. George

    George Guest

    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?
     
    George, Jun 27, 2012
    #3
  4. George

    Lew Guest

    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
     
    Lew, Jun 27, 2012
    #4
  5. George

    Roedy Green Guest

    On Wed, 27 Jun 2012 07:32:13 -0700 (PDT), George <>
    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.
     
    Roedy Green, Jun 28, 2012
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nospam
    Replies:
    21
    Views:
    2,193
    Guy Macon
    Sep 11, 2005
  2. The LoxFather

    C plus plus vs C Sharp

    The LoxFather, Aug 9, 2003, in forum: C++
    Replies:
    23
    Views:
    9,372
  3. The LoxFather

    C plus plus vs C Sharp

    The LoxFather, Aug 9, 2003, in forum: C Programming
    Replies:
    23
    Views:
    1,453
  4. Rahul
    Replies:
    9
    Views:
    448
    Andrey Tarasevich
    Mar 25, 2008
  5. furqan shaikh

    c plus plus code comparator

    furqan shaikh, Nov 7, 2008, in forum: C++
    Replies:
    6
    Views:
    848
    red floyd
    Nov 12, 2008
Loading...

Share This Page