Within The Portal Connector we can make use of Saved Queries to define Fetch XML Query.
Once defined we get a REST based URL which can be used from our client side script.
Login to the Portal and go to Saved Queries
Click on Create a Saved Query
Click on Build and create a Fetch XML Query
The fetch xml builder
We can see the parameter added to the query string.
To consume it we can make use of JavaScript widget
Click on Edit and define the JavaScript inside it to call the function