1

Whenever I make the API request with GET method, it is returning a 503 error from Google AppScript. However, this same request is successfully getting response consistently when run from Postman or the web-browser.

The AppScript code returns a JSON response out of the blue at first call and all consecutive calls return with the error 503. This server response is showing up specifically to the AppScript code here.

The detailed error message is as follows:

Exception: Request failed for https://api.dailymotion.com returned code 503. Truncated server response: Gone. (use muteHttpExceptions option to examine full response) (line 24, file "DailyMotion")

function dailymotionArtist() {
    var artistchannelID = 'x24dh63';

    var requestOptions = {
        'headers': {
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'Cache-Control': 'no-cache'
        },
        'muteHttpExceptions': true,
        method: 'GET'
    }

    var finalResponse2 = UrlFetchApp.fetch('https://api.dailymotion.com/user/' + artistchannelID + '?fields=followers_total%2Cviews_total', requestOptions);
    Logger.log(finalResponse2.getContentText());


}

1 Answers1

1

A 503 error message is generally representative of a server being unable to respond to a request temporarily, and is not normally a representation of an incorrect request - see description of the 503 code.

I would always suggest trying a request using Postman or another HTTP Client to test the API isn't just down temporarily before debugging a 503 code.

  • Hi Simon, Thanks for the prompt response. I tested the method through Postman as you suggested and was successfully able to get a JSON response. I even tried it in a new tab from the browser and it too successfully returned the requested response. Is there anything else that you can think of that would be causing this problem? – TheSonicFan Apr 25 '20 at 20:39