Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
npm install anx-api --save
var AnxApi = require('anx-api');
// Create a new instance with api target
var anxApi = new AnxApi({
target: 'https://api.appnexus.com'
token: 'SESSION_TOKEN', // (optional) see also anxApi.login(...)
rateLimiting: true
});
anxApi.get(<serviceName>).then(function (res) {
...
}).catch(function (err) {
...
})
var anxApi = new AnxApi(config);
config[object]:
target
- (string) base api urltoken
- (string) optional session tokenrequest
- (object) optional request objectuserAgent
- (string) optional user agentrateLimiting
- (boolean) optional rate limitingconcurrencyLimit
- (integer) optional max concurrent requestsIssues a GET request
anxApi.get('service url')
anxApi.get('service url', opts)
anxApi.get(opts)
** Experimental Feature **
Usage and parameters are the same as #get accept it pages through api calls. Response body is parsed as json.
Issues a POST request with a payload
anxApi.post('service url', <payload>)
anxApi.post('service url', <payload>, opts)
anxApi.post(opts)
Issues a PUT request with a payload
anxApi.put('service url', <payload>)
anxApi.put('service url', <payload>, opts)
anxApi.put(opts)
Issues a DELETE request
anxApi.delete('service url')
anxApi.delete('service url', opts)
anxApi.delete(opts)
Authenticates with the API and returns a token. The token will be reused for future requests.
anxApi.login('username', 'password').then(function (token) {
// The api object is now logged in. Optionally store the token.
...
})
anxApi.switchUser(userId).then(...)
The get, post, put, and delete methods can be called with an opts object. The opts object has the following request options.
uri
- (string) service uribody
- (object) options payload for .post
and .put
startElement
- (string) optional start indexnumElements
- (integer) optional number of records to returnparams
- (object) optional query string parametersmimeType
- (string) optional mimetype// Fetch the third page of 25 creatives
anxApi.get({
uri: 'creative',
startElement: 50,
numElements: 25
})
The following are two different methods of modifying and or spying on requests made to the api.
anxApi._config.request = _.wrap(anxApi._config.request, function (request, opts) {
console.log('DEBUG: ', opts);
return request.call(api, opts);
});
var request = require('request');
function customRequest(opts) {
return new Promise(function (resolve, reject) {
// Customize the request
request(opts, function (err, res) {
if (err) {
// Add additional error handling
reject(err);
} else {
// Customize the response
resolve(res);
}
});
});
}
var anxApi = new AnxApi({
target: process.env.ANX_TARGET,
token: 'SESSION_TOKEN',
request: customRequest
});
Run the unit test suite from the project root, make sure you've run npm install
first:
npm test
Coming soon
See LICENSE file
FAQs
AppNexus Api Wrapper
The npm package anx-api receives a total of 233 weekly downloads. As such, anx-api popularity was classified as not popular.
We found that anx-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.