Namespace: Rest

WonderPushSDK. Rest

Methods


delete(path, params, handlers, options)

Perform a DELETE request to WonderPush REST API.

Parameters:
Name Type Description
path string

API endpoint path

params object

key/value pair of query string parameters

handlers WonderPushSDK.Rest.Handlers

request callbacks

options object

Options

Properties
Name Type Description
fetch bool

Whether to use the Fetch API or stick with XHR (if available)


fetch(method, path, params, body)

Use the Fetch API call to retrieve data.

Parameters:
Name Type Description
method string

"GET" or "POST"

path string

API endpoint path

params object

key/value pair of query string parameters

body mixed

(not implemented)

Returns:

Promise


get(path, params, handlers, options)

Perform a GET request to WonderPush REST API.

Parameters:
Name Type Description
path string

API endpoint path

params object

key/value pair of query string parameters

handlers WonderPushSDK.Rest.Handlers

request callbacks

options object

Options

Properties
Name Type Description
fetch bool

Whether to use the Fetch API or stick with XHR (if available)


patch(path, params, body, handlers, options)

Perform a PATCH request to WonderPush REST API.

Parameters:
Name Type Description
path string

API endpoint path

params object

key/value pair of query string parameters

body mixed

(not implemented)

handlers WonderPushSDK.Rest.Handlers

request callbacks

options object

Options

Properties
Name Type Description
fetch bool

Whether to use the Fetch API or stick with XHR (if available)


post(path, params, body, handlers, options)

Perform a POST request to WonderPush REST API.

Parameters:
Name Type Description
path string

API endpoint path

params object

key/value pair of query string parameters

body mixed

(not implemented)

handlers WonderPushSDK.Rest.Handlers

request callbacks

options object

Options

Properties
Name Type Description
fetch bool

Whether to use the Fetch API or stick with XHR (if available)


postBeacon(path, params, session)

Perform a POST request to WonderPush REST API using navigator.sendBeacon.

sdk-sync note (bd yaw): outgoing _<source>Sync.* injection still applies here via addCommonParams, BUT beacons are response-less — there is no body to read — so the INCOMING side (Sync.consumeIncomingResponse via wrapHandlersForSync) cannot run for a beacon send. This is an inherent limitation of sendBeacon, not specific to the Measurements API. Sync data delivered in a beacon response would be lost; rely on the next non-beacon call to pick it up.

Parameters:
Name Type Description
path string
params object
session session

Optional

Returns:

Resolves to true when navigator.sendBeacon was able to queue the transfer

Type
Promise

postEventually(path, params, body)

Perform a POST request to WonderPush REST API without an accessToken and ensure it goes to the server. No handler is possible for postEventually.

Parameters:
Name Type Description
path string

API endpoint path

params object

key/value pair of query string parameters

body mixed

(not implemented)


postEventually(path, params, body)

Perform a POST request to WonderPush REST API and ensure it goes to the server. No handler is possible for postEventually.

Parameters:
Name Type Description
path string

API endpoint path

params object

key/value pair of query string parameters

body mixed

(not implemented)

Returns:

Promise resolving until user consent is given and call has been persisted as to be made


put(path, params, body, handlers, options)

Perform a PUT request to WonderPush REST API.

Parameters:
Name Type Description
path string

API endpoint path

params object

key/value pair of query string parameters

body mixed

(not implemented)

handlers WonderPushSDK.Rest.Handlers

request callbacks

options object

Options

Properties
Name Type Description
fetch bool

Whether to use the Fetch API or stick with XHR (if available)

Type Definitions


Handlers

WonderPush object to handle request responses.

Callback functions are called in the scope (this keyword) of the XMLHttpRequest object when available or the window object otherwise.

Type:
  • Object
Properties:
Name Type Description
onload function
onerror function
ontimeout function
onabort function
onloadend function
See: