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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:24:00+00:00 2026-06-14T04:24:00+00:00

I am stuck for 3 days now trying to get 2 google gadgets to

  • 0

I am stuck for 3 days now trying to get 2 google gadgets to reliably communicate on a google site to exchange anonymous user session information based on UiInstance.getId() value. Since gadget-to-gadget pubsub feature is deprecated, I am trying to use the ContentService in the server gadget to service a doPost request from originating from the client gadget – the idea being, I will store the session information in a server gadget and pull the data into gadgets on other pages in the site – not sure if this is possible.

BUT, I am stuck even trying to tinker with the various examples on the ContentService posted on StackOverflow. I am stuck at a very basic step and unable to proceed beyond the super simple server code below. I am not able to figure out what would the URL of the server gadget I need to use from my client gadget. I seem to be getting confusing results.

Server code:

function doGet(e) {
  var output = ContentService.createTextOutput();
  output.setContent("Hi from ContentServer!");
  return output;
}

Steps I followed:

1) Published the server as a web app and set it up so anyone/anonymous can access it.

2) The publish window popup says the gadget is available at
https://script.google.com/macros/s/AKfycbyIa07kBC-gqG0nJq3Up5GzUntbTaYcM1KmaYF7vQvFIWN_qxA/exec

3) If I use a browser to open the link, I get “Unknown macro doGet”.

4) If I click on the link given by “Test web app for your latest code.” from the publish window popup, it seems to take me to
https://script.googleusercontent.com/echo?user_content_key=WwuWW_Hhp2wlHpHWsX-qAwu7jtKrwlt1fkkesojKEWeJXKm5AoUOhuRHxu4RIHLrWovOBUsHhOB3No0RYr05RE4tWtliFlXKm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnG5I1NuldcVdfVF6dOROkmljXtr0dWIARhfeRbamxWJIIJeMc5tWnrGPpehwqDtynQ&lib=MfYY3NqJ0IdcpreIfwd3uwgmzn1S_adTp

The above link from step 4 works from a browser BUT its very flaky from my client gadget! It seems to work the very first time I version and publish it but returns raw HTML if I update the version even once.

I believe I am missing some trivial step OR there is a serious version control or deployment bug with web-app gadgets.

I have checked out the following threads on stackoverflow that were pretty useful.
How to use ContentService and doPost to create a REST API

KamilG seems to have overcome the issue here Another doGet() issue with Google Apps Script – "Unknown macro doGet" error

But its very wobbly for me and I am unable to pin down any reliable procedure the get the ContentService working from my server gadget.

Any help and explanation will be much appreciated.

Here is my client gadget code.

function doGet(e) {
//  var url = "https://script.google.com/macros/s/AKfycbyIa07kBC-gqG0nJq3Up5GzUntbTaYcM1KmaYF7vQvFIWN_qxA/exec";
  //var url = "https://script.googleusercontent.com/echo?user_content_key=9tzQxTSPm8ADsHKl4bCg6ru-49C19kYZCW8IRuWiWi-Xe_lTlQZS4xq8v5aPqjR6Ybj7-xjjJXyQPhOH0T3KFtJUtXc7U-Dkm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnJlCLn2pnKC0O1TYz53ccgjxtVC9ccM8kFegFJ0AJSK_YP_ylqfjfm1EU_BUbZUu-88PMDJ6xpj8&lib=MTLHdJRs3UPYj3bYgbhBNnNGZ7UmftE34";
  var url = "https://script.googleusercontent.com/echo?user_content_key=LvlwGkBktQ732xyD1HJbh5OhMsuhkidt_rOovw-olm-wJQF4LlErMDSxsfDaAb4UBYqOeTI3-8soIBj-KaOCDi0WlUav4Nl_m5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnG5I1NuldcVdfVF6dOROkmljXtr0dWIARhfeRbamxWJIIJeMc5tWnrGPpehwqDtynQ&lib=MfYY3NqJ0IdcpreIfwd3uwgmzn1S_adTp";

  // WELL ONE OF THE URLS WORKS FROM ABOVE!!! BUT ONLY TILL I UPDATE THE SERVER WEB APP VERSION :(

  var app = UiApp.createApplication().setTitle("ClientService Client test");
  app.setStyleAttribute("background", "azure");

  var fetchMethod = 'get';
  var response = UrlFetchApp.fetch(url, {method: fetchMethod});

  //var lbl = app.createHTML("<b>Response :</b>" + response.getContentText());
  var lbl = app.createTextArea().setText(response.getContentText());

  var lbl1 = app.createHTML("<b>Response code :</b> "
                            + response.getResponseCode()); 

  app.add(lbl);
  app.add(lbl1);
  return app;
}

Help needed please.

  • 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-14T04:24:01+00:00Added an answer on June 14, 2026 at 4:24 am

    This functioning as intended for the most part, but I think there might be some alternatives.

    1. Regarding your point #3 – That URL above works. There must have been something wrong with the version you tested (perhaps you didn’t declare doGet correctly?).
    2. The link from #4 is a one time use redirect that happens when you Content Service. See the redirect section here all the way at the bottom. This link is short lived and you might be fast enough to catch it in a browser but a another separate calling client (the “gadget”) might not be so lucky. So you should never call the googlecontentservice.com link directly.
    3. Regarding the overall issue of flakiness of ContentService, I have not seen this. If I properly use the /exec link and then properly increment the version after every appropriate change things work as expected for me.

    I built a simple web app accessing your Content Service and things seem to work fine for me consistently. See below. The code looks identical to yours but I am using the first url.

    https://script.google.com/macros/s/AKfycbw6nlfv5ME6F3Z2WBdW24YAgfQm_E5gYV0xrMDvDwZLrX7PdMU/exec

    As an alternative – is there a reason you are doing a server side UrlFetch from one script to another? If you can fetch the data server side, can you just perform the logic of the content script w/in the UI script?

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

Sidebar

Related Questions

I've been stuck trying to puzzle this out for a couple days now, and
I've got a problem that I'm stuck on for days now... I'm trying to
For almost three days now I have been trying to get the boost libs
I've been stuck on this for a couple of days now, and I'm really
I have been stuck on this for a few days now and it is
I've been trying for a couple of days now to learn UDK, but I
Dear all, I've been stuck with this problem now for a few days and
Hello I'm stuck on this past few days with searching a lot, now I'm
For more than two days now, I'm trying to grab a list of all
Have been stuck with this issue for a few days now, and really need,

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.