1. Home
  2. Getting started with the Cakemail Classic
  3. Getting started with the Cakemail Classic API

Getting started with the Cakemail Classic API

 

Cakemail Next-gen API

Although still supported for existing integration, the Cakemail Classic API (this API) is no longer available for new integrations. To develop a new integration with Cakemail, refer to the Cakemail Next-gen API.

Get started with the Cakemail Next-gen API.

User key

Most resources require a user key. This key is supplied by the User: Login method.

Curl example

curl -H 'apikey: YOUR_CAKEMAIL_API_KEY' \
  -d 'email=youremail&password=yourpassword' \
  https://api.wbsrvc.com/User/Login

PHP example

$data = array(
  'email'     => 'email@address.com',
  'password'  => 'password123'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.wbsrvc.com/User/login'); 
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('apikey: YOURAPIKEY'));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);

if ($result === false) {
  unset($result);
  echo 'Curl error: ' . curl_error($ch);
}
    
curl_close($ch);

if (isset($result)) {
  $json_object = json_decode($result, true);

  if ($json_object['status'] == 'success') {
    foreach($json_object['data'] as $key => $value) {
      echo $key . " : " . $value . "\n";
    }
  } else {
    echo $json_object['data'];
  }
}

Ruby Example

require 'net/http'
require 'net/https'
require 'rubygems'
require 'json'

http = Net::HTTP.new('api.wbsrvc.com', 443)
http.use_ssl = true
path = '/User/login'

data = {
  'email' => 'email@address.com', 
  'password' => 'password123'
}

headers = {
  'apikey' => 'YOURAPIKEY'
}

resp, data = http.post(path, data.to_query, headers)

result = JSON.parse(data)
puts result['data']

API Migration

If you are migrating from API V1 to API V2 in XML, you must change the URL from http://api.cakemail.com to https://apidev.cakemail.com.
Updated on July 16, 2020

Was this article helpful?