1

I'm trying to add Rally functionality to Google Apps Sheets using the Google App Script engine. Everything seems fairly simple, except managing the authentication from a user on the Google Apps system trying to connect with Rally. Google's UrlFetchApp.fetch() function seems to do the trick, except for the Auth bit. Any suggestions?

function RallyQuery(sz, order, fetch, stylesheet)
{
  if (typeof fetch === "undefined"){ fetch = true; }
  if (typeof stylesheet === "undefined"){ stylesheet = "/slm/doc/webservice/browser.xslsz";}

  var result = "[null]";
  var query  = "https://rally1.rallydev.com/slm/webservice/1.42/task?query=" + sz 
             + "&order=" + order 
             + "&fetch=" + fetch 
             + "&stylesheet=" + stylesheet;

  result = UrlFetchApp.fetch(query);

  return result;
}
4

2 回答 2

2

如果我理解正确,对于外部 javascript Rally 应用程序,您将需要使用LoginKey。此密钥必须绑定到只读(查看者)帐户(即该帐户不能拥有编辑权限)。但是,这种方法存在一些安全问题(如链接中所述)。

于 2013-04-30T20:06:32.847 回答
1

根据this question的答案,拉力赛webservice使用基本身份验证。您应该检查Web 服务文档以验证这一点。(我不是注册用户,所以不能。)

以下是您RallyQuery可以如何重构以包含基本身份验证:

function RallyQuery(sz, order, fetch, stylesheet)
{
  if (typeof fetch === "undefined"){ fetch = true; }
  if (typeof stylesheet === "undefined"){ stylesheet = "/slm/doc/webservice/browser.xslsz";}

  var username = "USERNAME";
  var password = "PASSWORD";

  var result = "[null]";
  var url = "https://rally1.rallydev.com/slm/webservice/1.42/task"
  var options = {
      "query" : sz, 
      "order" : order, 
      "fetch" : fetch, 
      "stylesheet" : stylesheet,
      "headers": {
          "Authorization": "Basic "
              + Utilities.base64Encode(username + ":" + password)
                 }
    }
  result = UrlFetchApp.fetch(url,options);

  return result;
}

或者,您可能需要查看LoginKey

于 2013-04-30T03:23:52.670 回答