Hi All,
Have written an API proxy that accepts two query parameters.
1st query param is 'code'
2nd query param is 'id'
The query parameter 'id' has fixed format based on value of 'code'
code |
Format for id |
|
AT | 1 block of 9 characters |
|
BE | 1 block of 10 digits |
How do I check format of 'id' based on code?
Here is few concrete examples of what am trying to achieve.
/verify?code=AT&id=123 | {"errorCode": 1001, "errorCode": "Invalid parameter"} |
/verify?code=AT&id=12311BBcd | pass through |
/verify?code=BE&id=12345678AA | {"errorCode": 1001, "errorCode": "Invalid parameter"} |
/verify?code=BE&id=1234567890 | pass through |
There are 22 codes and each code have specific format. Most are simple format check, some are a bit complex.
What's the best way to achieve this?
Thanks in advance.