Configuring resourceRules for Apps Scripts

533 views
Skip to first unread message

Matt

unread,
Dec 5, 2012, 12:22:52 PM12/5/12
to googl...@googlegroups.com
Is anyone using an Apps Script project to pull information from SDC?  If so, can you provide the rule configure for Apps Script?  There is no documentation for this service.

Thanks!

Dan B.

unread,
Dec 6, 2012, 3:41:49 PM12/6/12
to googl...@googlegroups.com
Matt,

In the resourceRules add the following: 

    <apps repeatable="true">
      <service>Apps Script</service>
      <allowAnyAppId>true</allowAnyAppId>
    </apps>


Although I have it set up this way, I have only had success in a spreadsheet or when the FetchURL points not to the intranet.

=ImportData(".../index.html")  works fine and populates the cells below with 

 <html>

<body>

<h1>

a,b,c,d <br />

1,2,3,4 <br /> 

It works! <br />

</h1>

</body>

</html>

 

But in the script attached to this spreadsheet I have the following code:

var response = UrlFetchApp.fetch(".../index.html",{use_Intranet: 'yes'});

But all I get is "Bad Request" in the red banner, in debug mode.

 

I attempted to use X-secureDataConnectorDebug  and muteHttpExceptions, to debug the response, but no avail.

 

I tried both URLEXACT and HOSTPORT in the rules file, but only the spreadsheet calls through ImportData work.


A non-Intranet call with FetchURL to a MS-SQL Reporting Server works fine with authentication, too. But, the same call through the SDC fails. It appears the agent is only able to return static resources, not a response from a report server.  The same failure occurs attempting to use ART 2.4.1 with an Oracle connection to the same database, rendering the expected results on the local browser, but not through the SDC.


It may be that the SDC is being deprecated, since there is no apparent benefit over generating static files with SQL Server supershell scripts and syncing them through Google Drive and reading those through Apps Script.

Let me know if you do have success and how.

Thanks,

Dan B.

Matthew Firtion

unread,
Dec 6, 2012, 3:55:21 PM12/6/12
to googl...@googlegroups.com
Thanks Dan.  I added the X-secureDataConnectorDebug=true to my URL for fetch and found out that the service it is expecting is Apps-Script. When I would specify an appId using <service>Apps Script</service> an error about white space would occur.  I was able to get everything working with:

<apps repeatable="true">
  <service>Apps-Script</service>
  <appId>myAppId</appId>
</apps>

Unfortunately =ImportData wasn't working for me since the data was not static and Spreadsheets caches data.
--
Matt Firtion

Dan B.

unread,
Dec 6, 2012, 6:33:19 PM12/6/12
to googl...@googlegroups.com
Matt,
           The  SDC service is crashing, but I'll try your suggestions.

           Did you make <appId> be your Apps Script Project Name?

           The X-secureDataConnectorDebug=true (or =text per other sources)  doesn't populate with anything other than "true" or "text" in the debug inspection.

           How did you include in the FetchURL, as an object and quotes?

Thanks,
Dan


Eric Pollmann

unread,
Dec 6, 2012, 7:07:36 PM12/6/12
to googl...@googlegroups.com
Hi,

Thanks Dan!

Matt and Dan: The only piece I have to add (from an earlier post by a member of our team) is that you may be able to get around the heaving caching Google Spreadsheets does on the importData command (incl. caching of errors) by modifying a dummy URL param.  E.g. 

http://mysdc.me.com/contacts.csv?cacheBuster=7238 

If Spreadsheets happens to catch and cache an error for your server, you can increment the number in the param until the cache clears.

Best regards,
-Eric





--
You received this message because you are subscribed to the Google Groups "enterprise-data-questions" group.
To post to this group, send email to enterprise-d...@google.com.
To unsubscribe from this group, send email to enterprise-data-qu...@google.com.
For more options, visit this group at http://groups.google.com/a/google.com/group/enterprise-data-questions/?hl=en.

Dan B.

unread,
Dec 6, 2012, 7:16:52 PM12/6/12
to googl...@googlegroups.com, poll...@google.com
Eric,

Yes, the CacheBuster works fine, including with a time stamp, but I'm not having any success within a script.

Does the agent only return files and not responses from a report server?

What is the correct syntax and parameters of the options in the FetchURL. { "use_Intranet = yes, X-secureDataConnectorDebug = ?"

Is X-secureDataConnectorDebug = text? or = true?

Shouldn't the response appear in the object inspector during debug?

Can the script be attached to a spreadsheet or not?

Thanks,
Dan B.


On Thursday, December 6, 2012 6:07:36 PM UTC-6, Eric Pollmann wrote:
Hi,

Thanks Dan!

Matt and Dan: The only piece I have to add (from an earlier post by a member of our team) is that you may be able to get around the heaving caching Google Spreadsheets does on the importData command (incl. caching of errors) by modifying a dummy URL param.  E.g. 

http://mysdc.me.com/contacts.csv?cacheBuster=7238 

If Spreadsheets happens to catch and cache an error for your server, you can increment the number in the param until the cache clears.

Best regards,
-Eric



On Thu, Dec 6, 2012 at 3:33 PM, Dan B. <daniel....@flycfm.net> wrote:
Matt,
           The  SDC service is crashing, but I'll try your suggestions.

           Did you make <appId> be your Apps Script Project Name?

           The X-secureDataConnectorDebug=true (or =text per other sources)  doesn't populate with anything other than "true" or "text" in the debug inspection.

           How did you include in the FetchURL, as an object and quotes?

                 Is the cache buster needed for a script?

Thanks,
Dan



Matthew Firtion

unread,
Dec 7, 2012, 9:40:58 AM12/7/12
to googl...@googlegroups.com
I used the SDC Key from the Apps Script project as the appId.

Try this function:

function test() {

    
    var options = 
      {
        "useIntranet" : true,
        "muteHttpExceptions" : true
      };
      
    response = UrlFetchApp.fetch(url, options);
    Logger.log(response.getContentText());
}

I'm muting HTTP exceptions in case of a DNS failure or another issue.  That's actually the type of information I'm trying to determine with my script.

If you take a look at the Log output, you'll see the request_service and request_appId, and even the agent that answered.  The Apps Script project SDC key can be found under File > Project Properties.
--
Matt Firtion

Reply all
Reply to author
Forward
0 new messages