Check Blank Spaces for statements endpoint

Hello Team,

We have two endpoints,

/accounts/{accountId}/statements –> Gives list of statements.

accounts/{accountId}/statements/{statementId} –> Get statement details.

We are doing some headless validations and calling the endpoint for statement details as below,

accounts/{accountId}/statements/ {few spaces here}, and spaces are encoding by browser and coming as

accounts/{accountId}/statements/%20%20 .

and Api is considering something value was present and null check validation was skipping. How to do null check validation against statementId?

Thanks in Advance.

Hey @Aravind_1

The two options I can think of is as follows:

  1. Extract the statement id (as Apigee assumes it is non-null given the white spaces are encoded) and perform RegEx validation on the spaces - if there are spaces you can raise a fault (ie: if statement id is null or if statement id matches ^\s*$)
  2. You can do the above, but in Javascript, essentially set a toggle if the above matches and raise a fault if the condition is hit

Hope this helps, if you need more specifics on the above let us know!

1 Like

Thanks @hartmann