HTTP Hook trigger
One of the supported triggers for a Skybear.NET Script is the HTTP Hook trigger. You can create an HTTP Hook trigger from the script details page, under the Settings tab. Find all your scripts in the dashboard UI.
The HTTP Hook trigger is a globally unique URL that upon receiving a POST
request runs the script’s Hurl source files.
For example, assume that script s_n0GF2xxjv0X86dLL3HLBm8N
has the following HTTP Hook trigger:
The following curl
command will trigger a run of the script s_n0GF2xxjv0X86dLL3HLBm8N
:
The output of the above command will look something like below:
Visiting the URL of the scriptRunViewURL
property will take you to the script run report in the Skybear.NET application UI, where you can inspect every single request and response including headers and bodies, any occurred assertion failures, and the JSON report(s) as generated by Hurl.
The runStatus
value of complete.pass
indicates that all the script files passed successfully, whereas complete.fail
would indicate that even though the Hurl execution completed successfully, something in the script failed (e.g. an assertion).
If the runStatus
value is server_error_undefined
, then something failed on the Skybear.NET backend and the script did not execute to completion, therefore no report has been generated.
In this case, the errorStatus
object would contain more information on the failure that you can send to our support email for further investigation.
Execution overrides
Hurl variables
As part of the POST
request to the HTTP Hook trigger URL you can provide Hurl variable overrides for the script to use.
Any provided Hurl variable takes precedence over the values of same-named Hurl variables set in the dashboard (see Secrets & Hurl variables).
Hurl source texts
A script created and authored in the Skybear.NET dashboard only has a single Hurl source file. However, the “script” resource can actually contain more than one Hurl source files.
As part of the POST
request to the HTTP Hook trigger URL you can provide the source text for the files you want to run in this specific execution, instead of the source text authored in the dashboard.
JSON request
The following Hurl file (named example-json-request.hurl
) is an example of how you can send a POST
request to the HTTP Hook trigger URL with overrides for both Hurl variables and source files.
Running the above Hurl script with hurl example-json-request.hurl
will invoke the HTTP Hook trigger URL and the script execution will use the provided value for the Hurl variable BASE_URL
, and the Hurl files executed will be the ones provided in the srcTexts
property.
The corresponding curl
command is as follows:
Multipart FormData request
Apart from JSON, the HTTP Hook trigger supports multipart/form-data
requests.
The multipart request can provide a srcTexts[]
field that will contain all the source files to run as part of the script execution.
Assume a directory hurl/samples
has the following structure:
We can use the following bash command to find all the *.hurl
files in the directory and send them with curl
as part of a multipart/form-data
request (see curl
docs).
In order to provide Hurl variable overrides you can provide the variables as multipart values with the following curl
options:
So, each variable needs two values, hurlVariables.<index>.Name=<name>
for the variable name and hurlVariables.<index>.Val=<value>
for the variable value.
You can use up to 100 Hurl variables, including overrides and the ones defined in the account dashboard.