httpClient

The httpClient submodule includes helper functions for making HTTP requests within the Wix platform.

Import statement

Copy
1

Methods

fetchWithAuth()

Makes HTTP requests to Wix REST APIs and external endpoints that require a Wix access token, such as endpoints hosted by a Wix app backend. The Wix development framework generates the access token. The token reflects the identity of the current site user and is automatically included in requests from this function as an Authorization header.

Note: Only use this function to call a Wix REST API if the needed functionality isn't available in the SDK. Otherwise, use the SDK version.

Syntax

Copy
1

Parameters

NameTypeDescription
urlstringURL of the REST API to call.
optionsobjectStandard fetch request options.

Returns

Standard fetch() response.

Example

Call the List Published Site Urls endpoint:

Copy
1
Was this helpful?
Yes
No