Custom Site API Calls

Use the endpoints below to call your HTTP functions through custom site APIs.

Call these endpoints with the method defined in your HTTP function.

Make sure to define your variables correctly for the function.

Important:

The endpoints in this article call custom site APIs without authentication context. You can call your custom site APIs with authentication context using the HTTP Functions REST API or SDK module.

Variables

You need to define the following variables to construct your API calls.

baseUrl

The base URL of the site hosting the HTTP functions:

  • Premium sites: https://www.<user_domain>
  • Free sites: https://<user_name>.wixsite.com/<site_name>

Note: The top level domain for free sites may not be .com. For example, for UK based sites, it may be .co.uk.

functionName

The name of the HTTP function your custom site API calls without its method prefix.

For example, for an HTTP function defined by export function get_myFunction(request) { }, the functionName is myFunction.

Endpoints

Use the following endpoints to call your custom site APIs.

Production

Accesses the latest code published to the production site:

<baseUrl>/_functions/<functionName>

Test sites

Accesses the latest code published to a test site:

<baseUrl>/_functions/<functionName>?rc=test-site

Sites using
Git Integration

Accesses the code pushed in the specified branch (branchId) in the specified commit hash (revisionNumber):

<baseUrl>/_functions/<functionName>?siteRevision=<revisionNumber>&branchId=<branchId>

Editor preview

Accesses the latest code in the site editor:

<baseUrl>/_functions-dev/<functionName>

Note: You must create a test site to use this endpoint.

See also

Was this helpful?
Yes
No