(Google Apps脚本)简单的网站请求

时间:2018-11-12 12:07:57

标签: google-apps-script gas

还没有GAS经验,请告诉我错误在哪里。 该代码应显示类似的内容(C#中类似的算法显示此内容):“ {” document“:{”收据“:{” operationType“:1,” taxSign“:3522207165 .......... .....“ 它显示了我“ {” id“:” 5be96bfc38ded67a6285e66c“}” 错误在哪里?

function shortenURL(longUrl) {

  var v1 = "9288000100076770"
  var v2 = "36326"
  var v3 = "1322455576"
  var v4 = "57100"
  var v5 = "2018-11-10T14:55" //2018-10-31T16:12:00

  var serviceUrl = "https://proverkacheka.nalog.ru:9999/v1/inns/*/kkts/*/fss/"+v1+"/tickets/"+v2+"?fiscalSign="+v3+"&sendToEmail=no&operationType=1&sum="+v4+"&date="+v5  
  var username ="+79312009126"
  var password ="780980"

  var options = {
    muteHttpExceptions:true,
    method:"get",
    contentType: "application/json",
    payload : JSON.stringify({'longUrl': longUrl }),
  };
  options.headers = {
  "Authorization": "Basic " + Utilities.base64Encode(username + ":" + password),
  "device-id": "",
  "device-os": ""
  };

  var response=UrlFetchApp.fetch(serviceUrl, options);
  Browser.msgBox(response.getContentText())

}

0 个答案:

没有答案