Formula - Base64

base64decode & base64encode

The base64decode( ) And base64encode( ) are both powerful , flexible functions since you can use both of them with different, numerous data content scenarios.That is to say ,the Content parameter could simply be any one of the Formula Plugin functions as long as you apply this on a valid logic scenario as we will notice in this section.

base64decode

Description:

Base64decode as the name implies, it is simply decode the provided data content into a human readable format.

Syntax

On the Message Body :

base64decode(body)

On the Message Context :

base64decode(context('MessageContextKey'))

Some operations on the Message Body :

1.Simple base64decode body parameter

Example: "body" is the content parameter , if "bm9kaW5pdGU=" is the encoding text, the result will be "nodinite". 	

Test Expression

You can test an expression when configuring a Search Field in the Test Expression tab.

e.g. base64decode(body)

base64decode


2.Nested jsonpath( ) as content parameter

Example: We simply can use jsonpath function(Formula plugin specification) as Content parameter of base64decode function(Or any function belongs to Formula plugin functions list) to extract the desired content from the "json body" and base64decode it.

Test Expression

e.g. base64decode(jsonpath('$..name',body))

base64decodeJson

Note: jsonpath( ) will be discussed in later section.


3.Nested regex( ) as content parameter

Example: The body  is normal text,thereby, regex function can be used as Content parameter of base64decode function to extract the desired content from the body(Using any valid Regular Expression)and base64decode the extracted match text.

Test Expression

e.g. base64decode(regex('R01U|VVRD',body))

base64decodeRegx

Note: regex( ) will be discussed in later section.


Some operations on the Message Context :

1.Simple base64decode content parameter

Example: If "bm9kaW5pdGU=" is the value for the corresponding key "id" , the result will be "nodinite" when we apply  base64decode function on the message context value as shown below. 

Test Expression

e.g. base64decode(context('id'))

base64decodeMessageContext


2.Nested jsonpath( ) as content parameter.

Example: We can simply use the jsonpath function "jsonpath()" as a Content parameter of base64decode function(Or any function belongs to Formula plugin) to extract the desired content from the message context value(json Array in this example..),then base64decode it.

Test Expression

e.g. base64decode(jsonpath('$..name',context('id')))

base64decodeMessageContext_json


3.Nested regex( ) as content parameter

Example: Regex function could be used as content parameter of base64decode function to get the desire values  from the Message Context that correspond the selected key(Using valid Regular Expression),then base64decode the extracted match text.

Test Expression

e.g. base64decode(context(regex('id.*')))

base64decodeMessageContext_regex


base64encode

Description:

The base64encode( ) is used to encode your text to base64.

Syntax

On the Message Body :

base64encode(body)

On the Message Context :

base64encode(context('MessageContextKey'))

Some operations on the Message Body and Message Context :

Resemble the implementation of base64encode( ) , same syntax and same content parameter structure.