Operations (sample payloads)

Main operations
Copy

Add
Copy

Add two numbers together.

Sample Input

1
{
2
"first_value": 5,
3
"second_value": "3.7"
4
}

Sample Output

1
{
2
"result": 8.7
3
}

Average
Copy

Get the average of a list of numbers.

Sample Input

1
{
2
"values": [
3
10,
4
20,
5
30,
6
40,
7
50
8
]
9
}

Sample Output

1
{
2
"result": 30
3
}

Divide
Copy

Divide one number by another number.

Sample Input

1
{
2
"first_value": 10,
3
"second_value": 2
4
}

Sample Output

1
{
2
"result": 5
3
}

Multiply
Copy

Multiply two numbers.

Sample Input

1
{
2
"first_value": 5.5,
3
"second_value": "3"
4
}

Sample Output

1
{
2
"result": 16.5
3
}

Page offset
Copy

When looping through pages, you'll often want to get the "offset" - the number of items to skip. If the page is zero based, the offset is page number x per page.

Sample Input

1
{
2
"page": 3,
3
"per_page": 20,
4
"is_page_zero_based": false
5
}

Sample Output

1
{
2
"result": 40
3
}

Parse number
Copy

Parse a number from a string. Will parse "$20" as 20 by removing the currency symbol.

Sample Input

1
{
2
"string": "$1,234.56"
3
}

Sample Output

1
{
2
"result": 1234.56
3
}

Remainder
Copy

Given two numbers, return the remainder/modulus by dividing the first by the second.

Sample Input

1
{
2
"value": 17,
3
"divider": 5
4
}

Sample Output

1
{
2
"result": 2
3
}

Round
Copy

Round a number to the specified number of decimals. Note that floating point numbers cannot represent all decimals precisely in binary.

Sample Input

1
{
2
"number": 3.14159265359,
3
"decimal_precision": 2
4
}

Sample Output

1
{
2
"result": 3.14
3
}

Run expression
Copy

Run an arithmetic expression such as "1 + 2 * (2 + 4)" and get the result.

Sample Input

1
{
2
"expression": "5 * (3 + 2) - 10 / 2"
3
}

Sample Output

1
{
2
"result": 20
3
}

Subtract
Copy

Subtract one number from another number.

Sample Input

1
{
2
"first_value": 10,
3
"second_value": 3
4
}

Sample Output

1
{
2
"result": 7
3
}

Sum
Copy

Get the sum of a list of numbers.

Sample Input

1
{
2
"values": [
3
10,
4
20,
5
30,
6
"40",
7
50.5
8
]
9
}

Sample Output

1
{
2
"result": 150.5
3
}