Introduction

The WixHttpFunctionRequest object breaks the URL of the incoming call to an HTTP function into different parameters for easy access.

The URL of the incoming call to an HTTP function is broken into:

For premium sites, the URL of the incoming call has the following format: https://www.domain.com/_functions/myFunction/sub?q=value

  • baseUrl:     https://www.domain.com/_functions
  • path:          sub
  • query:        q=value

For free sites, the URL of the incoming call has the following format: https://user_name.wixsite.com/mysite/_functions/myFunction/sub?q=value

  • baseUrl:     https://user_name.wixsite.com/mysite/_functions
  • path:          sub
  • query:        q=value
Did this help?

baseUrl


baseUrlstringRead-only

Returns the base URL of a call to an HTTP function.

Premium sites: Premium site baseUrl

Free sites: Free site baseUrl

Get the base URL of a call to an HTTP function
JavaScript
Did this help?

body


Returns an object representing the body of the incoming call to an HTTP function.

Use the functions of the returned WixHttpFunctionRequestBody object to get the body in a number of formats.

The request body can be a maximum of 512kb.

Get the body from a call to an HTTP function
JavaScript
Did this help?

functionName


functionNamestringRead-only

Returns the function name of a call to an HTTP function.

Premium sites: Premium site URL

Free sites: Free site URL

Get the function name of a call to an HTTP function
JavaScript
Did this help?

headers


headersHeadersRead-only

Returns the HTTP header fields used in a call to an HTTP function.

The headers property returns an object of key:value pairs where the key is the header field name and the value is the header field value.

Headers are returned in lowercase, regardless of how they were sent by the function caller.

Get the headers from a call to an HTTP function
JavaScript
Did this help?

ip


ipstringRead-only

Returns the IP address of the client who called the HTTP function.

Get the IP from a call to a HTTP function
JavaScript
Did this help?

method


methodstringRead-only

Returns the HTTP method used in calling an HTTP function.

Returns "GET", "POST", "PUT", or "DELETE".

Get the method used to call the HTTP function
JavaScript
// In http-functions.js export function use_myFunction(request) { let method = request.method; // "GET" }
Did this help?