Mailjet Web API
Communication to and from our API is done through HTTP(S) GET and POST queries. We support different formats to choose from depending on your affinities : JSON, XML, serialized PHP, and CSV for some export functions. You can access our API from almost any programming language, and in just a few minutes with our plug and play libraries.
Downloads
PHP
v0.1 Public Api class (.php)
v0.1 Event Api class (.php)
Usage
1. Edit your Api Keys in the Mailjet's API Class.
2. Make a quick call to confirm that everything's fine!
<?php // Include Mailjet's API Class include_once('php-mailjet.class-mailjet-0.1.php'); // Create a new Object $mj = new Mailjet(); // Get some of your account informations $me = $mj->userInfos(); // Display your firstname echo $me->infos->firstname; ?>
Urls
The can send or get data via our API functions via two types of requests: GET and POST. Each request made match a method of the API on our servers.
To make the best use of the public API (the one you may have downloaded and installed on your own server), you should understand the difference between GET and POST methods, in which cases and how to use them.
Our public API has been developed to help you formatting queries and interpreting the results (or errors) with the least effort possible.
Still, this documentation will be even more necessary if you want to use your own scripts.
GET Requests
Data recovery is done via GET requests. This means you can specify all the information and options directly into the url.
Your need to specify the method and the function and if needed options necessary for your request.
The URL looks like this :
For example, if your want to get the statistics of your message with the ID 123, The final built URL must be :
POST Requests
Inserting, updating, or deleting data works via the POST methods. These more sensitive methods require authentication via HTTP_AUTH.
POST requests work much like the GET request, the only difference being that the variables passed as parameters must be submitted via a POST request, and will not be visible in the url.