REST API

Run WayScript programs via HTTP requests.

Add a Webhook Trigger

In order to trigger WayScript programs with an api call, you must first add a Webhook Trigger to your program.

You can add a different Webhook Trigger to every function if you like, but only one Webhook trigger per function. (See Trigger Restrictions.)

If you do not specify a function name in your request and your program has multiple functions with Webhook Triggers, you will be asked to specify which function you would like to run.

post
Run Program

https://wayscript.com/api
Request
Response
Query Parameters
api_key
required
string
Your WayScript API Key.
program_id
required
integer
The ID of the program you would like to run.
variables
optional
string
Variables that you want to pass to your program. You can append as many of these as your program takes. (See below.)
function
optional
string
The name of a specific function that you want to run.
run_async
optional
boolean
Run this program asynchronously. (See below.) Defaults to False.
200: OK
{
"Success":"Program finished.",
"Result":[]
}

For instructions on finding your WayScript API Key, see Managing Your API Key.

Examples

Run a Program

Request
Response
curl -X POST 'https://wayscript.com/api?api_key=YOUR_API_KEY&program_id=1234'
{"Success":"Program finished.","Result":[]}

Variable Inputs

You can optionally input new variable data into your WayScript programs from your api call by appending one or more variables URL params to your request.

Request
Response
curl -X POST 'https://wayscript.com/api?api_key=YOUR_API_KEY&program_id=1234&variables=Foo&variables=Bar'
{"Success":"Program finished.","Result":[]}

Variables must be submitted in the same order as the Outputs defined on the Webhook Trigger.

Running a Specific Function

You can optionally specify which function within your program you would like to run by passing the function name via the function URL parameter.

Request
Response
curl -X POST 'https://wayscript.com/api?api_key=YOUR_API_KEY&program_id=1234&function=My%20Function'
{"Success":"Program finished.","Result":[]}

If you do not specify a function name in your request and your program has one function with a Webhook Trigger, the function with the Webhook Trigger will run.

The function you specify MUST have an active Webhook Trigger.

Running Your Program Asynchronously

Typically, your program will run synchronously and your request will not return a result until the program has completed.

However, you can optionally add the run_async=True URL param to your request to trigger a non-blocking program run.

Request
Response
curl -X POST 'https://wayscript.com/api?api_key=YOUR_API_KEY&program_id=1234&run_async=True'
{"Success":"Program started."}

Note that the response in this case is "Program started", as opposed to "Program finished."