bombbomb/BBCore

Documentation question for sendRequest

Closed this issue · 1 comments

This might just be a documentation question, but we had some trouble using the sendRequest method to call GetVideos. After some looking at the source, we found that the method argument is not actually necessary as a standalone argument, at least for the case of calling GetVideos. method is really a required key/value pair of the params object instead.

Our first try. This returns a 500 "invalid method" error:

bb.sendRequest('GetVideos', { api_key: api_key }, function (data) {
  console.log('data', data);
});

// Response:  {"status":"failure","methodName":null,"info":{"errormsg":"Invalid Method"}}

But suprisingly, this version works correctly without error.

var method = 'bombbombbombbomb'; // this string can really be anything except 'IsValidLogin' and 'ValidateSession'.
bb.sendRequest(method, { api_key: api_key, method: 'GetVideos' }, function (data) {
  console.log('data', data);
});

Is this line of thought correct? Thanks for your help!

This indeed did not work correctly. Now calls to sendRequest will respect the method requested in the first parameter, as long as the second parameter does not also specify a method.