Comma encoding in request parameters

I have a script in Flow Designer that is looking for active events with certain properties. It worked fine when I was looking for only one property, but now I want to look for two: "service" and "resource". 

The properties are supposed to be separated with commas. I have some code that assembles the GET request like so:

var prop_name = 'propertyName=' + encodeURIComponent('service#en') + ',' + encodeURIComponent('resource#en');
var prop_value = 'propertyValue=' + encodeURIComponent(input['service']) + ',' + encodeURIComponent(input['resource']);
var prop_operator = 'propertyValueOperator=CONTAINS'; 
var _limit = 'offset=0&limit=500';
var _status = 'status=ACTIVE';

var apiRequest = http.request({
'endpoint': 'xMatters',
'path': '/api/xm/1/events?' + _status + '&' + prop_name + '&' + prop_value + '&' + prop_operator + '&' + _limit,
'method': 'GET'

The GET request returns 200 OK status but doesn't come up with the events I'm expecting to find. I think it's because the commas are being encoded to %2C: 

GET https://mathworks-np.hosted.xmatters.com/api/xm/1/events?status=ACTIVE&propertyName=service%23en%2Cresource%23en&propertyValue=%5Bdatabase%5D%2Ciatttools-codecovdbtest-00&propertyValueOperator=CONTAINS&offset=0&limit=500 

Would the comma encoding cause this request to fail? Is there a way I can get around it?


Please sign in to leave a comment.