Module: call

(require("call"))(url, paramsopt, dataopt) → {promise}

Send a call to the polaris API This function does most of the heavy lifting of talking to the API. It will load default values for most things but you can override by passing params
Parameters:
Name Type Attributes Description
url string the endpoint being requested
params object <optional>
you can override default options & env settings by passing options in params
Properties
Name Type Attributes Description
scheme string <optional>
ex: https://
server string <optional>
ex: polaris.mylibrary.org
path string <optional>
ex: PAPIService/REST
version string <optional>
ex: v1
appid string <optional>
ex: 100
orgid string <optional>
ex: 1
method string <optional>
ex: GET
auth string <optional>
ex: public
pass string <optional>
ex: myPassword
token string <optional>
Generated Staff Authorization Token
lang string <optional>
ex: 1033
encode string <optional>
ex: application/json
accept string <optional>
ex: application/json
data object <optional>
required for POST/PUT methods, accepts basically anything Javascript can stringify
Source:
Requires:
  • module:axios
  • module:es6-promise
Returns:
- an Axios Promise
Type
promise
Example
myPapi.call('bib/979127', { lang: '3082' })
        .then(function(response){
            console.log(response.data);
        })
        .catch(function(error) {
            console.log(error);
        };