Operations (sample payloads)

Main operations
Copy

Base64 Encoder/Decoder
Copy

Base64 encode/decode a specified value.

Sample Input

1
{
2
"value": "Hello, World!",
3
"operation": "encode"
4
}

Sample Output

1
{
2
"result": "SGVsbG8sIFdvcmxkIQ=="
3
}

Change type
Copy

Change the type of a value.

Sample Input

1
{
2
"value": "42",
3
"type2": "number"
4
}

Sample Output

1
{
2
"result": 42
3
}

Concatenate
Copy

Concatenate a list of texts, using a separator if provided.

Sample Input

1
{
2
"values": [
3
"Hello",
4
"world",
5
"from",
6
"Tray.io"
7
],
8
"separator": " "
9
}

Sample Output

1
{
2
"result": "Hello world from Tray.io"
3
}

Contains
Copy

Check if text contains a particular pattern.

Sample Input

1
{
2
"text": "The quick brown fox jumps over the lazy dog",
3
"pattern": "fox"
4
}

Sample Output

1
{
2
"result": true
3
}

Escape characters
Copy

Escape characters from a string, specified in the input.

Sample Input

1
{
2
"text": "Hello, world! This is a test string with special characters: $100 & 50% off!",
3
"special_characters": [
4
"$",
5
"&",
6
"%",
7
"!"
8
]
9
}

Sample Output

1
{
2
"result": "Hello, world\\! This is a test string with special characters: \\$100 \\& 50\\% off\\!"
3
}

Extract all by Regular Expression
Copy

Extract a list of matches when a regular expression is applied to a given text.

Sample Input

1
{
2
"text": "The quick brown fox jumps over the lazy dog. The dog barks at 3 cats.",
3
"regex": "/[a-zA-Z]+/",
4
"flags": {
5
"ignore_case": true,
6
"multiline": false,
7
"unicode": false,
8
"sticky": false
9
}
10
}

Sample Output

1
{
2
"result": [
3
"The",
4
"quick",
5
"brown",
6
"fox",
7
"jumps",
8
"over",
9
"the",
10
"lazy",
11
"dog",
12
"The",
13
"dog",
14
"barks",
15
"at",
16
"cats"
17
]
18
}

Extract by Regular Expression
Copy

Extract the first match when a regular expression is applied to a given text.

Sample Input

1
{
2
"text": "Hello, my email is john.doe@example.com and my phone number is 123-456-7890.",
3
"regex": "\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b",
4
"flags": {
5
"ignore_case": true,
6
"multiline": false,
7
"unicode": false,
8
"sticky": false
9
}
10
}

Sample Output

1
{
2
"result": [
3
"john.doe@example.com"
4
]
5
}

Extract URLs
Copy

Extract all of the URLs from a given piece of text, returning them as a list.

Sample Input

1
{
2
"text": "Check out these websites: https://www.example.com and http://blog.example.org. For more information, visit https://docs.example.net/guide or www.example.io."
3
}

Sample Output

1
{
2
"result": [
3
"https://www.example.com",
4
"http://blog.example.org",
5
"https://docs.example.net/guide",
6
"www.example.io"
7
]
8
}

Format currency
Copy

Format currency to the specified denomination.

Sample Input

1
{
2
"currency": "USD",
3
"amount": 1234567.89,
4
"decimal_digits": 2,
5
"decimal_separator": ".",
6
"thousands_separator": ","
7
}

Sample Output

1
{
2
"result": "$1,234,567.89"
3
}

Generate unique name
Copy

Given the name of an object (e.g. an account), and a list of one or more existing object names, generate a unique name by appending "(n)" on the end of the name.

Sample Input

1
{
2
"name": "Sales Report",
3
"existing_names": [
4
"Sales Report",
5
"Sales Report (1)",
6
"Sales Report (2)",
7
"Marketing Report",
8
"Financial Report"
9
]
10
}

Sample Output

1
{
2
"result": "Sales Report (3)"
3
}

Get domain from email address
Copy

Given a user's email address, extract the website domain.

Sample Input

1
{
2
"email": "john.doe@example.com"
3
}

Sample Output

1
{
2
"result": "example.com"
3
}

Get domain from URL
Copy

Given a website URL, extract the full website domain.

Sample Input

1
{
2
"url": "https://www.example.com/path/to/page?param=value",
3
"exclude_www": true
4
}

Sample Output

1
{
2
"result": "example.com"
3
}

Get first middle last name
Copy

Given a user's full name, extract their first, middle and last name.

Sample Input

1
{
2
"full_name": "John Michael Smith"
3
}

Sample Output

1
{
2
"first_name": "John",
3
"middle_name": "Michael",
4
"last_name": "Smith"
5
}

Get text after
Copy

Given a string and a pattern, this operation will return the substring between where the pattern was found depending on the match number and beginning of the string.

Sample Input

1
{
2
"text": "Hello world! This is a sample text. Hello again!",
3
"pattern": "Hello",
4
"match_number": 2
5
}

Sample Output

1
{
2
"result": " again!"
3
}

Get text before
Copy

Given a string and a pattern, this operation will return the substring between the beginning of the string and where the pattern was found depending on the match number.

Sample Input

1
{
2
"text": "Hello world! This is a sample text. Hello again!",
3
"pattern": "Hello",
4
"match_number": 2
5
}

Sample Output

1
{
2
"result": "Hello world! This is a sample text. "
3
}

Get text between
Copy

Extract the text between a start and an end pattern, searching in a longer piece of text.

Sample Input

1
{
2
"text": "The quick brown fox jumps over the lazy dog. The fox is very agile.",
3
"start_pattern": "The",
4
"end_pattern": "dog."
5
}

Sample Output

1
{
2
"result": " quick brown fox jumps over the lazy "
3
}

Get text length
Copy

Get the length of a string.

Sample Input

1
{
2
"text": "Hello, world! This is a sample text."
3
}

Sample Output

1
{
2
"result": 34
3
}

Hex Encoder/Decoder
Copy

Hex encode/decode a specified string.

Sample Input

1
{
2
"value": "Hello, World!",
3
"operation": "encode"
4
}

Sample Output

1
{
2
"result": "48656C6C6F2C20576F726C6421"
3
}

Is domain?
Copy

Check if a string is a valid domain.

Sample Input

1
{
2
"domain": "example.com"
3
}

Sample Output

1
{
2
"result": true
3
}

Is email?
Copy

Check if a string is a valid email address.

Sample Input

1
{
2
"email": "john.doe@example.com"
3
}

Sample Output

1
{
2
"result": true
3
}

Is generic domain?
Copy

Check if a website domain is a "generic" domain, such as gmail.com or hotmail.com.

Sample Input

1
{
2
"domain": "john.doe@gmail.com"
3
}

Sample Output

1
{
2
"result": true
3
}

Is numeric?
Copy

Check if a text string is a number.

Sample Input

1
{
2
"text": "42"
3
}

Sample Output

1
{
2
"result": true
3
}

Is URL?
Copy

Check if a string is a valid URL.

Sample Input

1
{
2
"text": "https://www.tray.io"
3
}

Sample Output

1
{
2
"result": true
3
}

Lower case
Copy

Convert a string to lower case.

Sample Input

1
{
2
"text": "HELLO WORLD! This Is A Sample Text."
3
}

Sample Output

1
{
2
"result": "hello world! this is a sample text."
3
}

Match
Copy

Retrieve the result of matching a string against a regular expression.

Sample Input

1
{
2
"text": "Hello, World! This is a sample text with numbers 123 and special characters @#$.",
3
"regex": "\\b[a-zA-Z]+\\b",
4
"flags": {
5
"ignore_case": true,
6
"multiline": false,
7
"unicode": false,
8
"sticky": false,
9
"global": true
10
}
11
}

Sample Output

1
{
2
"result": [
3
"Hello",
4
"World",
5
"This",
6
"is",
7
"a",
8
"sample",
9
"text",
10
"with",
11
"numbers",
12
"and",
13
"special",
14
"characters"
15
]
16
}

Parse email
Copy

Parse out an email address (such as "Name <name@domain.com>") into its component parts such as name and domain.

Sample Input

1
{
2
"email": "John Doe <john.doe@example.com>"
3
}

Sample Output

1
{
2
"result": {
3
"valid": true,
4
"name": "John Doe",
5
"address": "john.doe@example.com",
6
"local": "john.doe",
7
"domain": "example.com"
8
}
9
}

Parse email list
Copy

Parse out a list of email addresses (such as "Name <name@domain.com>") into component parts such as name and domain.

Sample Input

1
{
2
"emails": "John Doe <john.doe@example.com>, Jane Smith <jane.smith@company.org>, support@tray.io"
3
}

Sample Output

1
{
2
"result": [
3
{
4
"result": {
5
"valid": true,
6
"name": "John Doe",
7
"address": "john.doe@example.com",
8
"local": "john.doe",
9
"domain": "example.com"
10
}
11
},
12
{
13
"result": {
14
"valid": true,
15
"name": "Jane Smith",
16
"address": "jane.smith@company.org",
17
"local": "jane.smith",
18
"domain": "company.org"
19
}
20
},
21
{
22
"result": {
23
"valid": true,
24
"name": "",
25
"address": "support@tray.io",
26
"local": "support",
27
"domain": "tray.io"
28
}
29
}
30
]
31
}

Parse URL
Copy

Parse a URL string to get each of the core components of the URL (path, query string, etc...).

Sample Input

1
{
2
"url": "https://www.example.com:8080/path/to/page?param1=value1&param2=value2#section1"
3
}

Sample Output

1
{
2
"result": {
3
"protocol": "https:",
4
"slashes": true,
5
"auth": null,
6
"host": "www.example.com:8080",
7
"port": "8080",
8
"hostname": "www.example.com",
9
"hash": "#section1",
10
"search": "?param1=value1&param2=value2",
11
"query": {
12
"param1": "value1",
13
"param2": "value2"
14
},
15
"pathname": "/path/to/page",
16
"path": "/path/to/page?param1=value1&param2=value2",
17
"href": "https://www.example.com:8080/path/to/page?param1=value1&param2=value2#section1"
18
}
19
}

Proper case
Copy

Upper case the first character of every word in the text passed.

Sample Input

1
{
2
"text": "the quick brown fox jumps over the lazy dog"
3
}

Sample Output

1
{
2
"result": "The Quick Brown Fox Jumps Over The Lazy Dog"
3
}

Regular expression match test
Copy

Checks if a piece of text matches a regular expression. Returns true if it matches, false otherwise.

Sample Input

1
{
2
"text": "Hello, World! This is a test string with numbers 123.",
3
"regex": "/[A-Za-z]+\\s\\d+/",
4
"flags": {
5
"ignore_case": true,
6
"multiline": false,
7
"unicode": false,
8
"sticky": false,
9
"global": true
10
}
11
}

Sample Output

1
{
2
"result": true
3
}

Remove characters
Copy

Remove character(s) from a given string.

Sample Input

1
{
2
"string_to_check": "Hello, World! How are you?",
3
"characters_to_remove": "o"
4
}

Sample Output

1
{
2
"result": "Hell, Wrld! Hw are yu?"
3
}

Remove special characters
Copy

Remove all non-alpha numeric characters (including spaces) from a string.

Sample Input

1
{
2
"text": "Hello, World! How are you? 123 #$%"
3
}

Sample Output

1
{
2
"result": "HelloWorldHowareyou123"
3
}

Replace
Copy

Replace a pattern in a text string with something else.

Sample Input

1
{
2
"text": "Hello, World! Hello, Universe!",
3
"pattern": "Hello",
4
"replacement": "Greetings",
5
"replace_all": true,
6
"case_sensitive": true
7
}

Sample Output

1
{
2
"result": "Greetings, World! Greetings, Universe!"
3
}

Select first n characters
Copy

Select the first n characters from a string.

Sample Input

1
{
2
"text": "The quick brown fox jumps over the lazy dog",
3
"number_of_characters": 10
4
}

Sample Output

1
{
2
"first_characters": "The quick "
3
}

Select last n characters
Copy

Select the last n characters from a string.

Sample Input

1
{
2
"text": "Hello, World!",
3
"number_of_characters": 5
4
}

Sample Output

1
{
2
"last_characters": "orld!"
3
}

Sentence case
Copy

Convert a string to sentence case.

Sample Input

1
{
2
"text": "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. a second sentence here. and a third one."
3
}

Sample Output

1
{
2
"result": "The quick brown fox jumps over the lazy dog. A second sentence here. And a third one."
3
}

Shorten
Copy

Shorten text to a maximum allowed length.

Sample Input

1
{
2
"max_length": 20,
3
"text": "The quick brown fox jumps over the lazy dog",
4
"text_to_append": "...",
5
"only_full_words": true
6
}

Sample Output

1
{
2
"result": "The quick brown..."
3
}

Split
Copy

Split text by a character into an list of words.

Sample Input

1
{
2
"text": "apple,banana,cherry,date",
3
"split_by": ","
4
}

Sample Output

1
{
2
"result": [
3
"apple",
4
"banana",
5
"cherry",
6
"date"
7
]
8
}

Strip HTML Tags
Copy

Strip all HTML tags from the input text leaving only the tag's text content

Sample Input

1
{
2
"text": "<p>Welcome to <strong>Tray.io</strong>! Check out our <a href='https://tray.io/documentation'>documentation</a> for more information.</p>"
3
}

Sample Output

1
{
2
"result": "Welcome to Tray.io! Check out our documentation for more information."
3
}

Trim whitespace
Copy

Returns the specified string with the leading and trailing spaces removed.

Sample Input

1
{
2
"text": " Hello, World! "
3
}

Sample Output

1
{
2
"result": "Hello, World!"
3
}

Typecast
Copy

Typecast a specified value.

Sample Input

1
{
2
"value": "42"
3
}

Sample Output

1
{
2
"result": 42
3
}

Underscore
Copy

Convert some text to "snake case", lowercasing all text, removing special characters, and replacing spaces with underscores.

Sample Input

1
{
2
"text": "Hello World! This is a Sample Text."
3
}

Sample Output

1
{
2
"result": "hello_world_this_is_a_sample_text"
3
}

Upper case
Copy

Convert a string to upper case.

Sample Input

1
{
2
"text": "Hello, World!"
3
}

Sample Output

1
{
2
"result": "HELLO, WORLD!"
3
}

URL encode key/value pairs
Copy

URL encode a specified set of key/value pairs. Strings only.

Sample Input

1
{
2
"pairs": {
3
"name": "John Doe",
4
"email": "john.doe@example.com",
5
"query": "Where is the nearest café?",
6
"location": "New York, NY"
7
}
8
}

Sample Output

1
{
2
"result": "name=John%20Doe&email=john.doe%40example.com&query=Where%20is%20the%20nearest%20caf%C3%A9%3F&location=New%20York%2C%20NY"
3
}

URL encode/decode
Copy

URL encode/decode a specified string.

Sample Input

1
{
2
"text": "Hello World! How are you?",
3
"encode": "encode"
4
}

Sample Output

1
{
2
"result": "Hello%20World%21%20How%20are%20you%3F"
3
}