Modified the.api() implementation for the browser platform to support the full function signature of path, method, params, cb including support for optional params