HTTP functions allow you to expose the functionality of a Wix site as a service in the form of REST APIs. If you’ve added functionality to a site with code and want to use it in a Headless site or app, you can expose HTTP functions and call the APIs in your client's code.
Learn more about exposing a site API with HTTP functions.
Authentication context is information about which identity is calling an API.
If a HTTP function on a Wix site doesn't receive authentication context, it treats the call as if it was made by an anonymous site visitor. This restricts the methods you can use in your code without overriding authentication using elevate()
.
Providing your HTTP functions with authentication context allows you to:
getCurrentMember()
.Note: Wix app identity isn't supported.
You can call site HTTP functions using 2 approaches:
The JavaScript SDK to call your site's endpoints with authentication context.
The REST API using access tokens or API Keys to send authentication context to your site's HTTP functions.