0

我能够从 duncio Curl 运行 API。然后从 google Apps Script 尝试。部分获得令牌工作,但后来我不能再做任何动作了。我放了代码以防它有助于显示我的问题所在

function Token() {
var user = "USUARIO";
var apikey= "KEY";
var Url = "https://identity.api.rackspacecloud.com/v2.0/tokens";
var payload =  {"auth":{"RAX-KSKEY:apiKeyCredentials":{"username": "mvillani","apiKey": apikey}}};   
var opt = {
                   "contentType" : "application/json",
                   "method" : "POST",
                   "payload" : Utilities.jsonStringify(payload)
                    };

var response = UrlFetchApp.fetch(Url,opt);
var json = JSON.parse(response.getContentText());
var token=json.access.token.id
var user="NUMERO DE USUARIO"                  

var Url="https://dns.api.rackspacecloud.com/v1.0/829221/domains/3715127/clone?cloneName=mvilaclone3.com" ;

var opt = {
                   "Content-Type": "application/json",
                   "method" : "POST",
                   "X-Auth-Token": token,
                   "Accept": "application/json"
                    };
  var response1 = UrlFetchApp.fetch(Url);
var json1 =response1.getContentText();
var c=2
}

穆哈斯·格拉西亚斯!!!!

4

1 回答 1

0

我找到了解决方案:

var Url="https://dns.api.rackspacecloud.com/v1.0/829221/domains/" ;
var response1 = UrlFetchApp.fetch(Url, {  "headers": {    'X-Auth-Token': Token  }})
于 2014-09-04T18:13:47.700 回答