Response

Response

Response objects, created on your behalf. Contains both the actual response object returned by UrlFetchApp and the params object that was built and sent to UrlFetchApp

Constructor

new Response(param)

Response object, created in Request#fetch

Parameters:
Name Type Description
param Object
Properties
Name Type Description
response Object
request Object
verbosity Boolean
Source:

Members

headers

Same as getAllHeaders

Source:

hitRateLimit

Returns false if the response is anything except 429. Returns true only after sleeping for how many milliseconds as indicated in the x-ratelimit-reset header. Can be used to retry. Used internally by Request#fetch to avoid rate limitations.

Source:

json

Returns the parsed text of the response. By default, if an error is encountered in call to JSON.parse, the returned json has an error property which in turn has status, message, charset, and mime properties.

Source:

ok

Returns true if statusCode == 200

Source:

statusCode

Same as getRepsonseCode, 200 is success

Source:

text

Return the plain text of the response (getContentText)

Source:

Methods

getRequest() → {HTTPResponse}

Returns the HTTPResponse object as returned by UrlFetchApp#fetch

Source:

getStatusCode() → {Number}

Returns this.statusCode

Source:

getText() → {String}

Return the plain text of the response (getContentText)

Source:

isOk() → {Boolean}

Returns true if the statusCode of the repsonse object is 200

Source: