Parameter Validation

Validation rules can be created for

  • Parameters that are passed to APIs as inbound API parameters (request Parameters)
  • Response Parameters from Connectors in Orchestration (response Parameters)

Depending on the type of parameter, various types of validation are available.

Hash is described in the GLU Functions & Formulas article.

Min/Max Length

This refers to the character length of Text and the number of digits for an Integer or Float.

If the min Length is left null then only the max length will apply.

If the max Length is left null then only the min length will apply.


Example

For the configuration of Min = 2 & Max = 4;

A string of “hello world” would fail this validation as the number of characters is greater than 4 and not equal to 4.

A string of “h” would fail this validation as the number of characters is less than 2 and not equal to 2.

A string of “hell” would pass this validation as the number of characters is greater than 2 and less than 4.

An Integer of 232 would pass this validation as the number of characters is greater than 2 and less than 4.

An Integer of 23 would pass this validation as the number of characters is equal to 2.

An Integer of 2324 would pass this validation as the number of characters is equal to 4.

Example

You could do a validation on the length of an incoming parameter, so as to then route to a specific action based on the length. To do so, you can create a Derived Parameter to calculate length then add a Handler to route based on the Derived Parameter value (i.e. length). In this case, the Derived Parameter formula might look like this: ${token_num}.length()

Min/Max Value

This refers to the parameter value.

If the min Value is left null then only the max Value will apply.

If the max Value is left null then only the min Value will apply.

Example

For the configuration of Min = 2 & Max = 4;

An integer of “27” would fail this validation as the value is greater than 4 and not equal to 4.

An integer of “1” would fail this validation as the value is less than 2 and not equal to 2.

An integer of “3” would pass this validation as the value is greater than 2 and less than 4.

An integer of “2” would pass this validation as the value is equal to 2.

An integer of “4” would pass this validation as the value is equal to 4.

Regex

Regex format validation can be applied by putting the regular expression into the regex field.

Use this link to see a cheat sheet of common regular expressions.

Use this link to try out the regular expressions prior to configuring in the validation of the parameter.

Example

For the configuration of RegEx (Alpha Only): [a-zA-Z]*

A string of “hello_world” would fail this validation as the string contains a special character.

A string of “hello2” would fail this validation as the string contains a number.

A string of “helloWorld” would pass this validation as the string contains only letters ( Alpha Only).

Date Format

The format field should be used to set the format the date will need to be passed to the parameter in.

If the date format was set to dd-mm-yyyy

if 23-OCT-2019 was passed in as a date, it would not pass the validation and an error would be raised.

of 23-10-2019 was passed in as a date then this would pass validation.

Date formats are defined by ISO 8601

Recommended date format

2012-04-23T18:25:43.511Z

It is recommended to ensure date formats used

  • are human-readable but also succinct
  • sorts correctly
  • includes fractional seconds which can help re-establish chronology
  • conforms to ISO 8601

For a more detailed view of date formatting please refer to GLU Formulas & Functions

Image

For an image parameter, if the default value is set, then if an image base64 value is not passed into the parameter then the default base64 value will be used.

This base64 image decoder can be used to extract a base64 image string.

All datatypes have a default value field which can be set if the parameter is passed in without a value set.

Default

The default value needs to adhere to the data type it configures and needs to adhere to the validation rules applied.

Required

All Validation rules have the Boolean option to indicate if the field is required or not.

If the Required checkbox is ticked then default values can not be entered.

If required and a parameter is not provided then the validation will fail.

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support
Fill the form and we’ll contact you shortly

    I agree with

    cookies
    We uses cookies to make your experience on this website better. Learn more
    Accept cookies