Monday, May 20, 2024
169
rated 0 times [  172] [ 3]  / answers: 1 / hits: 28752  / 8 Years ago, fri, august 19, 2016, 12:00:00

I'm getting an error response from the API that I'm using, but Google scripts seems to truncate the message. How can I see the full message in Google scripts?



This is the message:



Request failed for https://api.myintervals.com/task/ returned code 400. Truncated server response: {personid:180761,status:Bad Request,code:400,error:{code:18,message:Validation error has occurred (missing required field/paramet... (use muteHttpExceptions option to examine full response) (line 171, file IntervalsPull)


More From » google-apps-script

 Answers
4

Just as @DrSatan1 pointed in the comment, pass muteHttpExceptions option in the parameter to suppress the exception and get the error returned as HTTPResponse.



options = {muteHttpExceptions: true};
var response = UrlFetchApp.fetch(https://api.myintervals.com/task/, options);
Logger.log(response.getContentText());


Now view your logs to see the complete error response.


[#60987] Wednesday, August 17, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sashacitlallik

Total Points: 30
Total Questions: 100
Total Answers: 85

Location: Belarus
Member since Tue, Mar 14, 2023
1 Year ago
;