Documentation | Appery.io

The Appery.io Developer Hub

Welcome to the Apperyio developer hub. You'll find comprehensive guides and documentation to help you start working with apperyio as quickly as possible, as well as support if you get stuck. Let's jump right in!

Guides    

SCRIPT Component

Using the SCRIPT component.

The SCRIPT component allows you to write flow logic using server-side JavaScript. The result of the script logic has to be returned via a special build-in result object.

This simple example shows manipulating a string declared inside the component. Click Run script to run the script and see the result (click on the Result tab in the code widget):

var str = "api key";
result = str.toUpperCase();
"API KEY"

The SCRIPT component also has access to all Components Data objects. Let's look at an example using one of these objects.

Let's say the API Express service defined a request parameter called count. Inside the SCRIPT component, you want to check its value and return an appropriate message.

var count = PARAMS.QUERY.count;
if (count < 10) {
    result = {
        "msg": "Inventory low."
    };
} else {
    resutl = {
        "msg": "Inventory OK."
    };
}
{
  "msg": "Inventory OK."
}
{
  "msg": "Inventory low."
}

Samples

This section has a number of samples using the SCRIPT component:

* Video: Learn How to Add Custom Logic with the SCRIPT Component.

Updated about a year ago

SCRIPT Component


Using the SCRIPT component.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.