windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server https://softhier.com/ instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

Authorization request header in Appscript

Asked By: Anonymous

I need to call API data in Appscript
I have Token: ZjA2YmYwNjYtNzgxYy00ZThjLWFjZjktMjEwYjM1O
I have URL: https://webexapis.com/v1/devices?

How to authenticate token with the link.
I get the below error if I only call URL

{"message":"The request requires a valid access token set in the Authorization request header.","errors":[{"description":"The request requires a valid access token set in the Authorization request header."}],"trackingId":"ROUTER_60ABA481-B37E-01BB-03DC-0AFDE82A03DC"}

Solution

Answered By: Anonymous

The Auth token needs to be put into the header:

function makeRequest_(po) {
  var options,r;

  /*
    po - A JSON object with the following settings
    po.url - The url to make the request to
    po.token - The Auth Token
    po.method - POST or GET etc
  */
  
  if (!po.url) {
    console.error('No URL passed in. Parameters:' + JSON.stringify(po));
    return;
  }

  options = {};
  options.method = po.method;
  options.headers = {Authorization: 'Bearer ' + po.token};
  options.muteHttpExceptions = true;//Make sure this is always set

  r = UrlFetchApp.fetch(po.url, options);

  if (!r) {
    console.error('ERROR - getting response' );
    return;
  }
  
  //Logger.log('r.getResponseCode(): ' + r.getResponseCode());

  if (r && r.getResponseCode() !== 200) {//There should always be a response unless the
    //Fetch call failed

    var arg = po ? JSON.stringify(po) :"po not passed in";
    Logger.log('ERROR ' + r + 'npo:' + arg);

    return false;
  }
  
  //Logger.log('r: ' + r)
  return r;

}

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno
Alanya escort Manavgat escort Fethiye escort Kemer escort Didim escort http://www.kadinescort.net Gaziantep escort Denizli escort Adana escort Hatay escort Aydın escort İzmir escort Ankara escort Antalya escort Bursa escort İstanbul escort Kocaeli escort Konya escort Muğla escort Malatya escort Kayseri escort Mersin escort Samsun escort Sinop escort Tekirdağ escort Eskişehir escort Yalova escort Rize escort Amasya escort Balıkesir escort Çanakkale escort Bolu escort Erzincan escort Şırnak escort Van escort Yozgat escort Zonguldak escort Afyon escort Adıyaman escort Bilecik escort Aksaray escort Ağri escort Bitlis escort Siirt escort Çorum escort Burdur escort Diyarbakir escort Edirne escort Düzce escort Erzurum escort Kırklareli escort Giresun escort Kilis escort Kars escort Karabük escort Kırıkkale escort Mardin escort Kırşehir escort Maraş escort Manisa escort Muş escort Kastamonu escort Ordu escort Nevşehir escort Sakarya escort Osmaniye escort Şanliurfa escort Sivas escort Trabzon escort Tokat escort Ardahan escort Bartın escort Karaman escort Batman escort Bayburt escort Bingöl escort Elaziğ escort Gümüşhane escort Hakkari escort Isparta escort Uşak escort Igdır escort