I am building an HTTP adapter to retrieve information about assets in IBM Rational Asset Manager (RAM) via its REST API. I can retrieve all assets in RAM with
https://<server>/tools/cm/ram/oslc/simpleQuery
This works fine from a browser, using RESTClient in Firefox and from my adapter when invoking with
var input = {
method : 'get',
returnedContentType : 'xml',
path : 'tools/cm/ram/oslc/simpleQuery'
};
return WL.Server.invokeHttp(input);
The problem is that I get hundreds of assets in my response. I would like to filter the response from RAM by using a query like
https://<server>/tools/cm/ram/oslc/simpleQuery?query=ram_asset:community="My Community"
This works fine from a browser or RESTClient.
But when I add the query parameter to my adapter with
var input = {
method : 'get',
returnedContentType : 'xml',
path : 'tools/cm/ram/oslc/simpleQuery',
parameters : {"query" : 'ram_asset:community="My Community"'
};
return WL.Server.invokeHttp(input);
RAM returns no assets. This leads me to believe the parameters are not being added to the URI correctly. I'm suspecting it may be because the query value has special characters (':' and '=') in it. I have tried encoding with %3A and %3D with no luck.
Per suggestions from other users, I have also tried including the query parameters directly on the path with encoding but still get nothing returned from RAM:
var input = {
method : 'get',
returnedContentType : 'xml',
path : 'tools/cm/ram/oslc/simpleQuery?query=ram_asset:community%3D%22My+Community%22'
};
Is it possible that the WL adapter is not handling the parameters correctly? Any ideas on how to work around it?