How to validate if user sends the query parameter which is not defined in the below URL?

/v1/customer-self-management/crm /billing-accounts?id=1&serviceId=2&lastName=3&personalId=4&accountType=5&status=6

My requirement is, when user sends parameter named "firstname" (that is not defined in the above URL) I should throw an error like "invalid parameter".

0 2 3,709
2 REPLIES 2

@Sakthivel ,

Welcome to Apigee Community.

It should be simple & straight forward. Use Raise Fault Apigee Policy in Request Proxy Preflow & then execute the policy with policy condition flow variable request.queryparam.firstname is null.

Keep us posted if you have any difficulty while implementing same.

Former Community Member
Not applicable

If you want a generic way to prevent "extra" query params from being sent, you might want to look at this article: https://community.apigee.com/questions/12782/how-do-you-iterate-collection-from-requestquerypar.html

This gives you an array of query params you can iterate over. If you find params that you are not looking for, you can raise a fault.