Class: HttpApi

HttpApi

new HttpApi(conn, optionsopt)

HTTP based API class with authorization hook
Parameters:
Name Type Attributes Description
conn Connection Connection object
options Object <optional>
Http API Options
Properties
Name Type Attributes Description
responseType String <optional>
Overriding content mime-type in response
transport Transport <optional>
Transport for http api
noContentResponse Object <optional>
Alternative response when no content returned in response (= HTTP 204)
Source:

Extends

  • events.EventEmitter

Members

(static) SessionRefreshDelegate

Source:

Methods

(protected) beforeSend()

Source:

(protected) getError()

Get error message in response
Source:

(protected) getRefreshDelegate()

Source:

(protected) getResponseBody()

Get response body
Source:

(protected) getResponseContentType()

Detect response content mime-type
Source:

(protected) hasErrorInResponseBody()

Detect error in response body
Source:

(protected) isErrorResponse()

Detect error response
Source:

(protected) isSessionExpired()

Detect session expiry
Source:

(protected) parseError()

Parsing error message in response
Source:

parseResponseBody()

Source:

request(request, callback) → {Promise.<Object>}

Callout to API endpoint using http
Parameters:
Name Type Description
request Object Http Request object
Properties
Name Type Attributes Description
url String Endpoint URL to request
method String Http method for request
headers Object <optional>
Http request headers in hash object
callback Callback.<Object> Callback function
Source:
Returns:
-
Type
Promise.<Object>