Utilities functions
Learn about utilities functions in the Digibee Integration Platform and how to use them.
The functions were created to:
Speed up the creation of your integrations even more.
Decrease the complexity of your pipelines.
Simplify data conversions and transformations during the flow of your pipelines.
The utilities functions make diverse operations, which don't fit any of the other categories, and are available for components that support Double Braces expressions. To know how to provide information to the components using this resource, refer to Double Braces Functions.
BASEDECODE
This function in Double Braces decodes a string in a base64 format.
Syntax
BASEDECODE(value:string, [charset:string - optional])
value: string to be decoded
charset: charset for the decodification (standard = UTF-8) (optional)
Let's say you need to decode a string. You can do the following:
The expected result will be:
BASEENCODE
This function in Double Braces codes a string in a base64 format.
Syntax
BASEENCODE(value:string, [charset:string - optional])
value: string to be coded
charset: charset for the codification (standard = UTF-8) (optional)
Let's say you need to code a string. You can do the following:
The expected result will be:
BASEURLDECODE
This function in Double Braces decodes a string in a Base64 format in the standard usage for URL.
Syntax
BASEDECODE(value:string, [charset:string - optional])
value: string to be decoded
charset: charset for decoding (default = UTF-8) (optional)
Let’s say you need to decode a string. You can do the following:
The result will be:
BASEURLENCODE
This function in Double Braces encodes a string in a Base64 format for use in URL’s.
Syntax
BASEENCODE(value:string, [charset:string - optional])
value: string to be encoded
charset: charset for encoding (default = UTF-8) (optional)
Let's say you need to encode a string. You can do the following:
The result will be:
UUID
This function in Double Braces generates a unique universal identifier - the number of 128 bits is used to identify information in systems.
Syntax
UUID()
Let's say you need to generate a unique identifier. You can do the following:
The expected result will be:
TOBOOLEAN
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function allows you to convert a string value to boolean.
Syntax
TOBOOLEAN(value)
Let's say you need to convert the values below to boolean:
Converting the values:
The result will be:
If the function is applied in strings with different values of "true", "false", "TRUE" and "FALSE", numerical fields, null fields, objects and arrays, the function will always return the result false.
SIZE
This function in Double Braces allows the size of strings, arrays and objects to be obtained.
Syntax
SIZE(value, [throwErrorOnUnexpectedType:boolean - optional])
value: value to be checked the size
throwErrorOnUnexpectedType: indicates whether an exception will be returned when the value parameter isn’t expected by the function. If not informed, a true value will be assumed and, when a false value is informed, the function's return will be null.
Let's say you need to get the size of a text from a comments property contained in your payload. You can use the following snippet in the JSON Generator component:
The result will be a numeric value corresponding to the number of characters contained in the text:
Now imagine there’s a JSON object in the following structure:
The size of this object must be checked. If using JSON Generator again, the following snippet must be configured:
The result will be the amount of properties contained in the body object:
In this case, the function only considers properties that directly belong to the body object and doesn’t consider nested properties.
You can also check the size of an array:
Considering the array above, use JSON Generator one more time to configure the following snippet:
When executing the function, the result will represent the number of elements contained in the array:
The SIZE function expects string, array and object value types. When the value doesn’t match this requirement, an exception will be thrown. However, it’s also possible to configure the function not to throw an exception and simply return null. If that’s the case, just configure the second parameter of the function with the value false.
Consider the following payload:
And the following JSON Generator configuration:
The result of the function execution will be:
That way, no exception will be thrown and some verification logic can be adopted in your integration flow.
URIDECODE
This function allows you to decode a URI (string).
Syntax
URIDECODE( value:string, [charset:string - optional ] )
uri: string to be decoded
charset: charset for the decodification ( standard = UTF-8 ) ( opcional )
Let’s say you need to decode a URI. You can do the following:
The result will be:
URIENCODE
This function allows you to encode a URI (string).
Syntax
URIENCODE( value:string, [charset:string - optional ] )
uri: string to be encoded
charset: charset for the codification ( standard = UTF-8 ) ( opcional )
Let’s say that you need to encode a URI. You can do the following:
The result will be:
Other functions
You can also read about these functions:
Last updated