This section is intended for developers who want to integrate EmailMarkerĀ® service on their own applications. The REST APIs provide programmatic access to verification service. Verify single email , upload file , get list informations and download files results. The REST API identifies users using Api key authentification; responses are in JSON format. .
The single verification API is located as an HTTP GET request at the following URL :
https://app.emailmarker.com/api/verify
https://app.emailmarker.com/api/[email protected]
{
"success": true,
"result": "invalid",
"message": ""
}
success | true | false - true if the API request was successful. |
---|---|
result | The email status : valid , invalid , unknown |
message | The reason for the error if success == false . |
https://app.emailmarker.com/api/upload
https://app.emailmarker.com/api/upload?apiKey=wkzxEIa0EXSMZgcvw62Ow&filename=myFile.csv
{
"success": true,
"file_id": "20190",
"message": ""
}
{
"success": false,
"file_id": "",
"message": "Invalid API key"
}
https://app.emailmarker.com/api/info
https://app.emailmarker.com/api/info?apiKey=wkzxEIa0EXSMZgcvw62Ow&fileId=20190
{
"success": true,
"result": {
"file_id": "20190",
"filename": "myFile.csv",
"lines": "18",
"lines_processed": "10",
"valid": "6",
"invalid": "0",
"unknown": "0",
"status": "progress",
"timestamp": 1479678411,
"valid_file": "",
"full_report_file": ""
},
"message": ""
}
{
"success": true,
"result": {
"file_id": "20190",
"filename": "myFile.csv",
"lines": "18",
"lines_processed": "18",
"valid": "6",
"invalid": "0",
"unknown": "12",
"status": "finished",
"timestamp": 1479678411,
"valid_file": "https://app.emailmarker.com/valid_file.csv",
"full_report_file": "https://app.emailmarker.com/full_report_file.csv"
},
"message": ""
}
$email = "[email protected]";
$url= 'https://app.emailmarker.com/api/verify?apiKey=wkzxEIa0EXSMZgcvw62Ow&email='.$email;
$response = file_get_contents($url);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$filename = "myFile.csv";
$filepath = realpath($filename);
$mimeType = finfo_file($finfo, $filepath);
$url = 'https://app.emailmarker.com/api/upload?apiKey=wkzxEIa0EXSMZgcvw62Ow&filename='.$filename;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$settings['file_contents'] = new CURLFile($filepath,$mimeType,$filename);
curl_setopt($ch, CURLOPT_POSTFIELDS, $settings);
$file_id = curl_exec($ch);
curl_close($ch);
$file_id = 20190; //File id that was saved after file upload
$url= 'https://app.emailmarker.com/api/info?apiKey=wkzxEIa0EXSMZgcvw62Ow&fileId='.$file_id;
$response = file_get_contents($url); //execute request to api
$data = json_decode($response, true); // optional : convert the response to an array