Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Mailjet unique algorithm boosts your deliverability and the platform provides in-depth insight so you can optimize more than ever.
More info on Mailjet.com
Info on the API can be found here
To install maljet run npm install mailjet
In order to use mailjet you need to require it and instantiate it first:
var Mailjet = require('mailjet');
var instance = new Mailjet('APIKEY', 'SECRETKEY', {
secure : true, // When true uses https when false it uses http, default is true
output : 'json' // The output type you prefer, default is json, you can choose between php, json, xml, serialize, html, csv
});
The options object can be skiped so you can simply get an instance like this: var instance = new Mailjet('APIKEY', 'SECRETKEY');
of course you replace APIKEY with your API key and SECRETKEY with your Secret key
To call a method from API you use sendRequest
method. This method gets 4 optional parameters:
method
(String) / Required: Is the method you need to call.params
(Object) / Optional: The params you want to send.request
(String) / Optional: The type of request you want to make, it's either GET
or POST
, by default is GET
.cb
(Function) / Optional: This is the callback method that will be triggered when the API request is done. Callback returns 4 params as well:
err
: Error object in case of failurestatus
: The request status codedata
: The returned data object (WARNING: In case of API error (like internal errors) this may also be html instead of object)headers
: The returned headersinstance.sendRequest('userinfos', {}, 'GET', function (err, status, data, headers) {
console.log('Error: ' + err);
console.log('Status: ' + status);
console.log('Data: '); console.log(data);
console.log('Headers: '); console.log(headers);
});
In this example all the params are used.
instance.sendRequest('userinfos', {}, function (err, status, data, headers) {
console.log('Error: ' + err);
console.log('Status: ' + status);
console.log('Data: '); console.log(data);
console.log('Headers: '); console.log(headers);
});
In this example the request
param is omited.
instance.sendRequest('userinfos', function (err, status, data, headers) {
console.log('Error: ' + err);
console.log('Status: ' + status);
console.log('Data: '); console.log(data);
console.log('Headers: '); console.log(headers);
});
In this example the params
and request
params are omited as we don't need them.
In case callback function is not provided then a promise is returned.
var promise = instance.sendRequest('userinfos');
promise.once('complete', function (result) {
if (result.status) {
console.log(result);
} else {
// Handle error
}
});
result
in case of failure is an error object, otherwise it's an object with status
, data
and headers
properties which are same as in callback method.
Simply run make
in mailjet root directory.
# make
* Project Tasks
make deps Install Dependencies
make deps-clean Removes the node_modules directory
make lint Run Code Analysis tool (scans entire project)
* Test Suites
make tests Run All tests
make test-basic Run Basic tests (module specific tests)
make test-api Run API Methods tests (test fixtures required)
make test-user Run User Methods tests (test fixtures required)
make test-contact Run Contact Methods tests (test fixtures required)
make test-lists Run Lists Methods tests (test fixtures required)
make test-message Run Message Methods tests (test fixtures required)
make test-report Run Report Methods tests (test fixtures required)
make test-cleanup Run Cleanup Methods tests (test fixtures required)
FAQs
Mailjet web API
The npm package mailjet receives a total of 121 weekly downloads. As such, mailjet popularity was classified as not popular.
We found that mailjet 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.