(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
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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);
};