Reputation:
I was checking out IBM worklight and used HTTP Adapters. In my Rest response I get so many details. I want to filter the records like send the specific nodes to the app as response.
For example
It returns so many data which I don't need and I want to send filtered records to app like,
distance: { "value": 1734542, "text": "1 735 km" }
Is it possible anyway in the Worklight HTTP Adapters
Upvotes: 0
Views: 611
Reputation: 679
You can use xsl filter in adapter for filtering the contents of the response as well.
Upvotes: 0
Reputation: 3166
sure, you can use JavaScript to filter data and create only response that you need. In case you use XML based web-service you can even use XSLT transformation. In case your webservice returns JSON like the one you've provided, use something like:
var backendResponse = WL.Server.invokeHttp(....);
var adapterResponse = {
distanceValue : backendResponse.somePropertyDescribingDistanceValue,
distanceText : backendResponse.someOtherPropertyDescribingDistanceText
};
return adapterResponse;
Upvotes: 1