Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8546417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:00:54+00:00 2026-06-11T13:00:54+00:00

My Goal is to request GoogleTaskAPI for TASKLIST with specified no.of result. It works

  • 0

My Goal is to request GoogleTaskAPI for TASKLIST with specified no.of result.
It works fine, If I m passing no requestBody. But I need to pass request parameter to specific number of results to be returned. When I do that, it creates new Tasklist, Instead of listing. So how to do this?

My Code:

    GoogleAccessProtectedResource access = new GoogleAccessProtectedResource(accessToken, httpTransport, jsonFactory, clientId, clientSecret, refreshToken);
    HttpRequestFactory rf = httpTransport.createRequestFactory(access);

    String endPointUrl = "https://www.googleapis.com/tasks/v1/users/@me/lists";
    String requestBody = "{\"maxResults\":3}";

    GenericUrl endPoint = new GenericUrl(endPointUrl);
    ByteArrayContent content = new ByteArrayContent("application/json", requestBody.getBytes());

    //Try 0: Works, But Retrieving all of my Tasklist, I need only 3
    //HttpRequest request = rf.buildGetRequest(endPoint);
    //-------

    //Try 1: Fails to retrieve
    //HttpRequest request = rf.buildGetRequest(endPoint);
    //request.setContent(content);
    //request.getContent().writeTo(System.out);
    //-------

    //Try 2: Fails to retrieve
    HttpRequest request = rf.buildRequest(HttpMethod.GET, endPoint, content);
    request.getContent().writeTo(System.out);
    //-------

    HttpResponse response = request.execute();
    String str = response.parseAsString();
    utils.log(str);  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:00:56+00:00Added an answer on June 11, 2026 at 1:00 pm

    maxResults is a query parameter, not a request parameter, so you can just put it in the url:

    String endPointUrl = "https://www.googleapis.com/tasks/v1/users/@me/lists?maxResults=3";
    

    You should also consider using the Java client’s Tasks interface for making requests; it may be a little easier since it handles the details of the url for you:

    http://code.google.com/p/google-api-java-client/wiki/APIs#Tasks_API

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Goal is to make a dialog that appears on menu_key pressed, but it keeps
Goal: Gain datatype date with year and month Problem: Need to help to convert
My goal is to asynchronously call a URL via POST request (REST Webservice) to
Lets begin with the final goal - I need to able to paste a
Goal I want to simulate with a request to a HTML-document just the way
This Fetch Request takes almost 10 seconds to execute on iPhone. The goal is
My current goal is to know when an iPhone, Android, and some other specific
I need to trigger a request in my node.js app. My app has a
My goal is to be able to create a soap request that can contain
Just a request for help with batch programming. Need to do periodic backups of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.