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 8431021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:44:39+00:00 2026-06-10T05:44:39+00:00

I am trying to call a url with put request and the url is

  • 0

I am trying to call a url with put request and the url is

PUT https://www.googleapis.com/groups/v1/groups/groupUniqueId but
getting error response as { “error”: { “errors”: [ { “domain”:
“global”, “reason”: “required”, “message”: “Required” } ], “code”:
400, “message”: “Required” } }

if i open the link
https://developers.google.com/google-apps/groups-settings/v1/reference/groups/update
then there is a Try It Section i authorize it with OAuth2.0 and put some fields as shown in image enter image description here

i write a java servlet for calling this url
here is its doGet Method code and i am writing it on Google Appengine.i authorized the applicaion with oauth2 and acess_token is valid else it will show Authorization Error.
it showing me invalid values.

public void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws IOException {

        String url = "https://accounts.google.com/o/oauth2/token";

        // FetchOptions opt = FetchOptions.Builder.doNotValidateCertificate();
           URL url1=new URL(url); 
           String param="code="+req.getParameter("code")+"&client_id=719226850877-tr21kp47phthuli0hu2v24akgfrplde9.apps.googleusercontent.com&client_secret=hSXi3dWfEmDQfl0XZJJmBssc&redirect_uri=https://www.onemoredemo.appspot.com/oauth2callback&grant_type=authorization_code";

             HttpURLConnection connection = 
        (HttpURLConnection)url1.openConnection(); 
             connection.setDoOutput(true); 
             connection.setRequestMethod("POST"); 
             connection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
             connection.getOutputStream().write( param.getBytes() ); 
          InputStream str= connection.getInputStream();
          BufferedReader reader=new BufferedReader(new InputStreamReader(str));
        String l="";
        String l1="";

          while((l=reader.readLine())!=null){
              l1+=l;
             resp.getWriter().println(l);

          }
          try {
              JSONObject obj=new JSONObject();
              obj.put("email", "testing9@iritesh.com");
            JSONObject json=new JSONObject(l1);
            String access_token=json.getString("access_token");
            URL url2=new URL("https://www.googleapis.com/groups/v1/groups/testing@iritesh.com?key=AIzaSyATDZHO5J7a3ItTSBhPby__Xzxi7rZlMJQ");
            HttpURLConnection connection1=(HttpURLConnection) url2.openConnection();
            connection1.setRequestMethod("PUT");
            connection1.addRequestProperty("Content-Type", "application/json");
            connection1.setDoOutput(true);
            connection1.addRequestProperty("Authorization","Bearer "+ access_token);
            connection1.getOutputStream().write(obj.toString().getBytes());
            connection1.connect();
            InputStream str1= connection1.getInputStream();
              BufferedReader reader1=new BufferedReader(new InputStreamReader(str1));
             String rit;
              while( (rit=reader1.readLine())!=null)
             {resp.getWriter().println(rit);

             }


        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }


    }

I tried to make a request same as in image.
first set key parameter to api key then setting request method as PUT by invoking setRequestMethod(“PUT”);
after that added two properties one is Authorization:Bearer access_token
and then Content-Type : application/json
then setting its request body as a json object by invoking method

connection1.getOutputStream().write(obj.toString().getBytes());

Can any one please point me where i am wrong and where i am putting invalid value?

  • 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-10T05:44:41+00:00Added an answer on June 10, 2026 at 5:44 am

    because i am trying to change the email address of the group but when i tried manually in groups page it cant be changes that’s why i am getting 400 error

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

Sidebar

Related Questions

I'm trying to call the Google URL Shortener API in my python code: def
I am trying to call to the bit.ly URL shortening service using jQuery with
I am trying to use relative url with a post ajax call as follows:
I'm trying to call send a message to a JBoss MQ queue but it
I am trying to put comments on Facebook wall using jquery. But my ajax
Trying to use Ajax, Spring, REST and JAXB but getting Errors....... I am trying
I have the following API call: URL: /api/some-call Method: PUT PARAMS: No params Its
Trying to call a SAP SOAP Web Service from a generated sudzc app shows
Im trying to call a method that will add or subtract 1 from a
I trying to call 2 functions in the same page to submit jquery-ajax at

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.