Operations (sample payloads)
Main operations
Add
Add two numbers together. Sample Input
\{
"first_value": 5,
"second_value": "3.7"
\}
Sample Output
{
"result": 8.7
}
Average
Get the average of a list of numbers. Sample Input
\{
"values": [
10,
20,
30,
40,
50
]
\}
Sample Output
{
"result": 30
}
Divide
Divide one number by another number. Sample Input
\{
"first_value": 10,
"second_value": 2
\}
Sample Output
{
"result": 5
}
Multiply
Multiply two numbers. Sample Input
\{
"first_value": 5.5,
"second_value": "3"
\}
Sample Output
{
"result": 16.5
}
Page offset
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
\{
"page": 3,
"per_page": 20,
"is_page_zero_based": false
\}
Sample Output
{
"result": 40
}
Parse number
Parse a number from a string. Will parse "$20" as 20 by removing the currency symbol. Sample Input
\{
"string": "$1,234.56"
\}
Sample Output
{
"result": 1234.56
}
Remainder
Given two numbers, return the remainder/modulus by dividing the first by the second. Sample Input
\{
"value": 17,
"divider": 5
\}
Sample Output
{
"result": 2
}
Round
Round a number to the specified number of decimals. Note that floating point numbers cannot represent all decimals precisely in binary. Sample Input
\{
"number": 3.14159265359,
"decimal_precision": 2
\}
Sample Output
{
"result": 3.14
}
Run expression
Run an arithmetic expression such as "1 + 2 * (2 + 4)" and get the result. Sample Input
{
"expression": "5 * (3 + 2) - 10 / 2"
}
Sample Output
{
"result": 20
}
Subtract
Subtract one number from another number. Sample Input
\{
"first_value": 10,
"second_value": 3
\}
Sample Output
{
"result": 7
}
Sum
Get the sum of a list of numbers. Sample Input
\{
"values": [
10,
20,
30,
"40",
50.5
]
\}
Sample Output
{
"result": 150.5
}