2016-04-07 9 views
-1

kullanırken hata Bir numara doğrulamak için senotp serverside api kullanıyorum. Aynı içeriğe sahip soap ui kullanılarak çalıştırıldığında hata yoktur.GAS: UrlFetchApp

{"status":"error","response":{"code":"INVALID_REQUEST_BODY"}} 

doğru yanıtı olmalıdır oysa: Ben

var payload = 
     { 
     "countryCode": "94", 
     "mobileNumber": "0766075555", 
     "getGeneratedOTP": true 
     }; 

    var header= 
     { 
     "application-Key":"application_key_value" 
     }; 


    var options = 
    { 
    "method" : "POST", 
    "headers":header, 
    "muteHttpExceptions": true, 
    "contentType":"application/json", 
    "payload" : payload 
    }; 

    var request=UrlFetchApp.getRequest("https://sendotp.msg91.com/api/generateOTP", options) 
    Logger.log(request) 
    var response=UrlFetchApp.fetch("https://sendotp.msg91.com/api/generateOTP", options); 
    Logger.log(response); 

: Ben kullanılan kod foll0ws gibidir

{ 
    "status": "success", 
    "response": { 
     "code": "OTP_SENT_SUCCESSFULLY", 
     "oneTimePassword": "34859" 
    } 
} 

Ben UrlFetchApp ile yaptığımda Ama hata veriyor Burada sorun ne olduğundan emin değilim. Lütfen hata ayıklamama yardım edin veya kodla ilgili sorunun ne olduğunu bana bildirin.

cevap

İlgili konular