Layer7 API Management

Policy Repository: Date Validation 

12-12-2018 01:53 PM

Sometimes it may be necessary to perform date validation to confirm invalid data is not supplied.

For example, you may need to prevent bad data like February 52, 2018 from being sent to a back end server.

 

The attached sample policy retrieves a data from a JSON Payload and validates it. This will also check for valid leap years. February 29, 2018 will fail where as February 29, 2020 will success as it is a valid leap year.

 

To test:

 

1) Load the sample policy in policy manager

2) Edit the date on line 2 to any value, ie: 2020-10-52  (October 52, 2020 as an example of invalid data)

3) Consume the service

Statistics
0 Favorited
7 Views
1 Files
0 Shares
1 Downloads
Attachment(s)
zip file
kb000122934.xml.zip   865B   1 version
Uploaded - 05-29-2019

Tags and Keywords

Related Entries and Links

No Related Resource entered.