HTTP Functions: Sample Flow

This article shows a sample flow that calls an HTTP function using the HTTP Functions API.

Call your site's HTTP function

We'll call the HTTP function defined in your site's code as follows:

Copy
1
  1. Create, request, or refresh an access token, or create an API Key.

  2. Construct the endpoint URL using the function name defined in your site’s HTTP function in this format: https://www.wixapis.com/velo/v1/http/invoke/{functionName}. In our example, we'll use https://www.wixapis.com/velo/v1/http/invoke/respondOk.

  3. Define your headers. You must include an Authorization header whose value is the access token or API key you retrieved earlier. Include any other headers your site’s HTTP function requires. Our example doesn't require any additional header.

  4. Define your body, as required by your site’s HTTP function. The body must be a string. GET methods do not accept a body. Our example doesn't require a body.

  5. Add query parameters to the endpoint, as required by your site’s HTTP function. Our example doesn't require query parameters.

  6. Choose the HTTP method, as defined in your HTTP function. In our case, the method is GET.

  7. Call the endpoint and handle the response.

Was this helpful?
Yes
No