I see Hermann already replied on the Convert Query Params DataPower action, but if you're partial to GatewayScript, you can use the url module. Here's an example:
let testurl = 'https://host:443/mypath?p1=v1&p2=v2';
let url = require('url');
let urlObj = url.parse(testurl,true);
The urlObj object after the parse is shown by my GatewayScript debugger output:
(debug) p urlObj
{ protocol: 'https:',
slashes: true,
auth: null,
host: 'host:443',
port: '443',
hostname: 'host',
hash: null,
search: '?p1=v1&p2=v2',
query: { p1: 'v1', p2: 'v2' },
pathname: '/mypath',
path: '/mypath?p1=v1&p2=v2',
href: 'https://host:443/mypath?p1=v1&p2=v2' }
Since you have the query property (because the 2nd argument to parse was true), you can not only count the number of Object.keys in urlObj.query, but you can iterate over them to determine if they're the ones you want. To reject the request if it doesn't have the query parameters you expect, you can do a
session.reject('some error message');
Regards,
Steve