Question

I was able to run the API from the duncio Curl. Then try from google Apps Script. Part of Get the token WORKED, but then I can not make any more acion. I put the code in case it helps show where I have the problem

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
}

Muchas Gracias !!!!

Was it helpful?

Solution

I found the solution:

var Url="https://dns.api.rackspacecloud.com/v1.0/829221/domains/" ;
var response1 = UrlFetchApp.fetch(Url, {  "headers": {    'X-Auth-Token': Token  }})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top