I want to create an API (remote method) like this, note "version" is a query paramter and not a path parameter:
I defined my remote method like this in loopback:
elastic.insertInElastic = function (version, json, cb) {
cb(null, insertInElastic(version, json));
};
elastic.remoteMethod('insertInElastic', {
accepts: [
{arg: 'version', type: 'string'},
{arg: 'json', type: 'object', http: {source: 'body'}}
],
returns: {arg: 'confirmation', type: 'string'},
http: {path: '/insert', verb: 'put'}
});
If I call this API through postman, it works without a problem but it fails in the loopback API explorer. What happens is that the "version" becomes undefined, meaning it doesn't get set when called through the API explorer. I am using loopback 3.2. Let me know if I am missing anything?