Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Minimal higher-level wrapper around AWeber's API for Node.js.
Features
Install using npm:
$ npm install aweber-api --save
With a consumer key and secret, you are now ready to authenticate your app and verify one or more accounts. We'll start by verifying a single account. Open a Node.js console session:
$ node
> Aweber = require('aweber-api')
[Function: Aweber]
> aw = Aweber('your-consumer-key', 'your-consumer-secret')
> aw.getAuthorizationUrl().then(console.log).catch(console.log)
Promise { <pending> }
> https://auth.aweber.com/1.0/oauth/authorize?oauth_token=XXXXXXXXXXXXXXXXXXXXXXXX
Visit the URL this generates. You will be prompted to enter the credentials for the AWeber account you'd like to access via the API (NOTE: AWeber account, NOT your labs developer account).
After submitting the form, copy the verifier code that was generated and return to your node console session:
> aw.getAccessToken('your-verifier-token').then(console.log).catch(console.log)
Promise { <pending> }
{ token: "XXXXXXXXXXXXXXXXXXXXXXXX", tokenSecret: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" }
At this point, your account is fully authenticated. Make note of your token and token secret. These should be stored securely for future use.
aweber-api exports a factory function for creating new aweber
instances.
Consumer key and secret are required.
const Aweber = require('aweber-api');
// ...
const aw = Aweber(config.consumerKey, config.consumerSecret, {
token: session.token,
tokenSecret: session.tokenSecret
});
Overview of defaults:
Aweber(consumerKey, consumerSecret, {
token: null,
tokenSecret: null,
userAgent: 'aweber-api (https://github.com/jimf/aweber-api)',
Promise: Promise
});
Aweber#getAuthorizationUrl([callbackUrl])
Resets the instance's internal token value to an empty string, requests a new temporary token, stores the new token internally, and returns the URL where authorization can be made. An optional callback url may be specified. Returns a Promise.
Aweber#getAccessToken(verifier)
Request a new token and token secret. This method requires the verifier code obtained from the user authorization process. Returns a Promise.
See the official AWeber API docs for specifics on using individual endpoints.
Aweber#del(url, options)
Makes a single DELETE
request to the AWeber API for the given resource,
returning a Promise.
Params
url
{String}: URL of the resource to be deleted (host and query params optional)options
{Object}: Options objectoptions.params
{Object}: Dictionary of query parameters to specifyExample
// All of the following are equivalent:
aw.del('https://api.aweber.com/1.0/example/1?ws.op="delete"').then(/* ... */);
aw.del('/1.0/example/1?ws.op="delete"').then(/* ... */);
aw.del('/1.0/example/1', { params: { 'ws.op': 'delete' } }).then(/* ... */);
Aweber#get(url, options)
Makes a single GET
request to the AWeber API for the given resource,
returning a Promise.
Params
url
{String}: URL of the resource to be retrieved (host and query params optional)options
{Object}: Options objectoptions.params
{Object}: Dictionary of query parameters to specifyExample
// All of the following are equivalent:
aw.get('https://api.aweber.com/1.0/example?status="new"').then(/* ... */);
aw.get('/1.0/example?status="new"').then(/* ... */);
aw.get('/1.0/example', { params: { status: 'new' } }).then(/* ... */);
Aweber#patch(url, options)
Makes a single PATCH
request to the AWeber API for the given resource,
returning a Promise.
Params
url
{String}: URL of the resource to be updated (host and query params optional)options
{Object}: Options objectoptions.data
{Object}: Dictionary of fields with their updated valuesoptions.params
{Object}: Dictionary of query parameters to specifyExample
const opts = { data: { subject: 'new value' } };
// All of the following are equivalent:
aw.patch('https://api.aweber.com/1.0/example/1', opts).then(/* ... */);
aw.patch('/1.0/example/1', opts).then(/* ... */);
Aweber#post(url, options)
Makes a single POST
request to the AWeber API for the given resource,
returning a Promise.
Params
url
{String}: URL of the resource to be created (host and query params optional)options
{Object}: Options objectoptions.data
{Object}: Dictionary of field/value pairsoptions.params
{Object}: Dictionary of query parameters to specifyExample
const data = { foo: 1, bar: true };
const params = { 'ws.op': 'create' };
// All of the following are equivalent:
aw.post('https://api.aweber.com/1.0/example?ws.op=create', { data }).then(/* ... */);
aw.post('https://api.aweber.com/1.0/example', { data, params }).then(/* ... */);
aw.post('/1.0/example?ws.op=create', { data }).then(/* ... */);
aw.post('/1.0/example', { data, params }).then(/* ... */);
Aweber#put(url, options)
Makes a single PUT
request to the AWeber API for the given resource,
returning a Promise.
Params
url
{String}: URL of the resource to be updated (host and query params optional)options
{Object}: Options objectoptions.data
{Object}: Dictionary containing fully updated recordoptions.params
{Object}: Dictionary of query parameters to specifyExample
const opts = { data: { id: 1, foo: 1, bar: true } };
// All of the following are equivalent:
aw.post('https://api.aweber.com/1.0/example', opts).then(/* ... */);
aw.post('/1.0/example', opts).then(/* ... */);
MIT
FAQs
Minimal higher-level wrapper around AWeber's API for Node.js
We found that aweber-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.