HTTP Trigger

Instantly build an HTTP endpoint that connects your favorite APIs, databases, and programming languages, using WayScript.
Trigger a function when a user goes to a URL.

To display a webpage back to the user, use the HTTP Response module.


The HTTP Trigger is used to setup a web request. You can use it to implement a web page endpoint, a JSON post request, or other types of web requests.

Sample Code

To get you started quickly, the HTTP Trigger provides cURL, Python, and JavaScript sample code, which can simply be pasted into your terminal and run.

This sample code includes some data that demonstrates how to pass query parameters and JSON body parameters with your request.

curl -d '{"name":"Peter Parker"}' \
-H "Content-Type: application/json" \
import http.client
data = {"name":"Peter Parker"}
conn = http.client.HTTPSConnection("")
conn.request("POST", "/?hero=Spiderman", str(data), headers={"Content-Type":"application/json"})
const data = {"name":"Peter Parker"};
fetch("", {
method: "POST",
headers: new Headers({"Content-Type":"application/json"}),
mode: "cors",
body: JSON.stringify(data),

Use the WayScript Python and JavaScript libraries to make calling your HTTP endpoints even easier!


When setting up the HTTP Trigger, you can create as many named endpoints as you like. If you don't provide a name for your endpoint, the trigger will match the root URL. All endpoint names must be unique throughout your script to prevent ambiguity.

To access your endpoints, use the program ID as a subdomain of For example, in the image above, you can trigger your script by hitting either or

Remember to activate your trigger before using the endpoint!

🔐Password-Protect your Endpoints

If you would like the endpoints in your HTTP trigger to require a login to view, enable the "Password Protection" toggle.

A button to "Manage Login Credentials" will appear.

Clicking this button will take you to "Login Credentials" section of the "Script Setup" tab, where you can manage the usernames and passwords that will allow people to log in to your endpoints.

When you click "Add a credential," a new login will be automatically generated for you, including a username and randomly-generated password. You can choose to use these values, or edit them as you see fit.

When a user goes to access your endpoint for the first time, they will now be prompted to login.

The username information of each trigger run will be available in the system global struct , context.

Custom Endpoint Login Prompt

Basic Authentication

If you password-protect your endpoints, you can use the credentials added above to access your endpoints by including an Authorization: Basic header in your request.

This header should follow the standard for HTTP basic access authentication. For example, suppose your Username is "[email protected]" and your Password is "letmein," you would create the Authorization header by:

  1. Joining the Username and Password into a single string, separated by a semicolon: [email protected]:letmein

  2. Encoding that string in Base64: Y2FwdGFpbkB3YXlzY3JpcHQuY29tOmxldG1laW4=

  3. Passing that encoded string to your custom endpoint by including the Authorization: Basic Y2FwdGFpbkB3YXlzY3JpcHQuY29tOmxldG1laW4= header in your request.

These headers are also displayed for you under each password in the "Login Credentials" section of the "Script Setup" tab.

Authenticating Using Your API Key

If your endpoint is not public, you can also use your WayScript API Key to access your endpoints api call by including an Authorization: Bearer header in your request.

For example, if your WayScript API Key is fhAEdGT9EbFDh_migcrukZ1Vb28rLFKqt9AxOiq9bdQ, you would include the Authorization: Bearer fhAEdGT9EbFDh_migcrukZ1Vb28rLFKqt9AxOiq9bdQ header in your request.


The Outputs section allows you to define variables that you would like the HTTP Trigger to create and make available for use later in your script. You can pass values for these variables within the request to your endpoint.

You can add as many variable outputs as you like, as well as pass any combination of query parameters and JSON body data.

Request Query Parameters

This section allows you to define variable outputs whose values you will pass as query parameters to your script. For example, if you define a query parameter output called "hero," you would pass its value to your script by appending the query parameter to your endpoint url:

🗒Request JSON Body Parameters

If you define an output to be passed as a JSON body parameter, you will include the data as a key-value pair within the body of your request. For example, if you define a JSON body parameter called "name," you will pass its value to your script by including the relevant data within your request:

curl -d '{"name":"Peter Parker"}' \
-H "Content-Type: application/json" \

🔣Raw Request Data

The raw data sent to the HTTP Trigger endpoint.

Http Metadata

Request_Metadata =
'accept_encodings' : String,
'accept_languages' : String,
'accept_mimetypes' : String,
'base_url' : String,
'content_length' : Int,
'content_type' : String,
'content_md5' : String,
'data' : String,
'date' : Date,
'form' : JSON,
'full_path' : String,
'host' : String,
'host_url' : Url,
'if_modified_since' : Date,
'if_unmodified_since' : Date,
'is_json' : Bool,
'is_secure' : Bool,
'json' : JSON,
'mimetype' : String,
'mimetype_params' : JSON,
'method' : String,
'path' : String,
'query_string' : String,
'remote_addr' : String,
'remote_user' : String,
'referrer' : String,
'scheme' : String,
'url' : Url,
'url_root' : Url,
'user_agent' : String


Standup a Web App on the Cloud in 1 Minute