Check text length - REST api
Question

Hello all,


When exposing a REST API;

What's the easiest way to check if a text variable length is greater than the length speficied on the structure ?

Or, any ideas to make this sort of validations easy to implement/maintain ?


Thanks,

Pedro Abreu

Hi, friend!

Do you mean the length of the structure attribute? 

I don't think it's clear.


Hi,
You can use the OnBeforeRequest Event when you call that respective REST-Action & Perform the Validation on the Inputs you passed.
or
You can have a wrapper action on top of REST then perform validation there & use this wrapper action in the system to call REST API.

Hope it helps,
Assif

Adding more details; 


Let's say I've specified the input of my exposed REST endpoint with a structure;

Title - text (30)

Description - text (50)


Outsystems will not prevent a request with a Title with 80 characters.

Are there any easy ways to check / validate / prevent this ?

Instead of, of course, going field by field: if(length(title) > 30) ....


Thanks in advance,

Pedro Abreu

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.