Core RESTful API (beta)
Base URL = https://dc-api.ematicsolutions.com:8084/v2
Replace dc with the correct Ematic API key suffix. For example: sg1
Methods
log
logCart
POST /log/cart
Log cart
Parameters
| Parameter | In | Type | Required | Format | Description | 
|---|---|---|---|---|---|
| Authorization | header | string | true | ematic-apikey=xxx,esp-apikey=yyyy | ematic apikey, esp apikey | 
| body | body | log | true | object | No description | 
Body parameter
{
  "email": "string",
  "clientEnv": {
    "deviceHeight": 0,
    "deviceWidth": 0,
    "viewportHeight": 0,
    "viewportWidth": 0,
    "country": "string",
    "language": "string",
    "currency": "string",
    "device_uid": "string",
    "device_model": "string",
    "device_os_family": "string",
    "device_os_version": "string"
  },
  "products": [
    {
      "experiment_id": 0,
      "client_product_id": "string",
      "client_category_id": "string",
      "price_number": 0,
      "price": "string",
      "name": "string",
      "description": "string",
      "brand_name": "string",
      "image_url": "string",
      "link": "string",
      "misc1": "string",
      "misc2": "string",
      "misc3": "string"
    }
  ]
}
Responses
| Status | Meaning | Description | 
|---|---|---|
| 201 | Created | created | 
| 400 | Bad Request | bad request | 
| 401 | Unauthorized | unauthorized | 
Example responses
{
  "message": "string"
}
{
  "message": "missing apikeys"
}
{
  "message": "invalid apikeys"
}
Code samples
HTTP
POST https://dc-api.ematicsolutions.com:8084/v2/log/cart HTTP/1.1
Host: dc-api.ematicsolutions.com:8084
Content-Type: application/json
Accept: application/json
Authorization: string
JavaScript
var headers = {
  'Authorization':'string',
  'Accept':'application/json',
  'Content-Type':'application/json'
};
$.ajax({
  url: 'https://dc-api.ematicsolutions.com:8084/v2/log/cart',
  method: 'post',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
Python
import requests
headers = {
  'Authorization': 'string',
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}
r = requests.post('https://dc-api.ematicsolutions.com:8084/v2/log/cart', params={
}, headers = headers)
print r.json()
Java
URL obj = new URL("https://dc-api.ematicsolutions.com:8084/v2/log/cart");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
logBrowse
POST /log/browse
Log browse
Parameters
| Parameter | In | Type | Required | Format | Description | 
|---|---|---|---|---|---|
| Authorization | header | string | true | ematic-apikey=xxx,esp-apikey=yyyy | ematic apikey, esp apikey | 
| body | body | log | true | object | No description | 
Body parameter
{
  "email": "string",
  "clientEnv": {
    "deviceHeight": 0,
    "deviceWidth": 0,
    "viewportHeight": 0,
    "viewportWidth": 0,
    "country": "string",
    "language": "string",
    "currency": "string",
    "device_uid": "string",
    "device_model": "string",
    "device_os_family": "string",
    "device_os_version": "string"
  },
  "products": [
    {
      "experiment_id": 0,
      "client_product_id": "string",
      "client_category_id": "string",
      "price_number": 0,
      "price": "string",
      "name": "string",
      "description": "string",
      "brand_name": "string",
      "image_url": "string",
      "link": "string",
      "misc1": "string",
      "misc2": "string",
      "misc3": "string"
    }
  ]
}
Responses
| Status | Meaning | Description | 
|---|---|---|
| 201 | Created | created | 
| 400 | Bad Request | bad request | 
| 401 | Unauthorized | unauthorized | 
Example responses
{
  "message": "string"
}
{
  "message": "missing apikeys"
}
{
  "message": "invalid apikeys"
}
Code samples
HTTP
POST https://dc-api.ematicsolutions.com:8084/v2/log/browse HTTP/1.1
Host: dc-api.ematicsolutions.com:8084
Content-Type: application/json
Accept: application/json
Authorization: string
JavaScript
var headers = {
  'Authorization':'string',
  'Accept':'application/json',
  'Content-Type':'application/json'
};
$.ajax({
  url: 'https://dc-api.ematicsolutions.com:8084/v2/log/browse',
  method: 'post',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
Python
import requests
headers = {
  'Authorization': 'string',
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}
r = requests.post('https://dc-api.ematicsolutions.com:8084/v2/log/browse', params={
}, headers = headers)
print r.json()
Java
URL obj = new URL("https://dc-api.ematicsolutions.com:8084/v2/log/browse");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
logCheckout
POST /log/checkout
Log checkout
Parameters
| Parameter | In | Type | Required | Format | Description | 
|---|---|---|---|---|---|
| Authorization | header | string | true | ematic-apikey=xxx,esp-apikey=yyyy | ematic apikey, esp apikey | 
| body | body | log | true | object | No description | 
Body parameter
{
  "email": "string",
  "clientEnv": {
    "deviceHeight": 0,
    "deviceWidth": 0,
    "viewportHeight": 0,
    "viewportWidth": 0,
    "country": "string",
    "language": "string",
    "currency": "string",
    "device_uid": "string",
    "device_model": "string",
    "device_os_family": "string",
    "device_os_version": "string"
  },
  "products": [
    {
      "experiment_id": 0,
      "client_product_id": "string",
      "client_category_id": "string",
      "price_number": 0,
      "price": "string",
      "name": "string",
      "description": "string",
      "brand_name": "string",
      "image_url": "string",
      "link": "string",
      "misc1": "string",
      "misc2": "string",
      "misc3": "string"
    }
  ]
}
Responses
| Status | Meaning | Description | 
|---|---|---|
| 201 | Created | created | 
| 400 | Bad Request | bad request | 
| 401 | Unauthorized | unauthorized | 
Example responses
{
  "message": "string"
}
{
  "message": "missing apikeys"
}
{
  "message": "invalid apikeys"
}
Code samples
HTTP
POST https://dc-api.ematicsolutions.com:8084/v2/log/checkout HTTP/1.1
Host: dc-api.ematicsolutions.com:8084
Content-Type: application/json
Accept: application/json
Authorization: string
JavaScript
var headers = {
  'Authorization':'string',
  'Accept':'application/json',
  'Content-Type':'application/json'
};
$.ajax({
  url: 'https://dc-api.ematicsolutions.com:8084/v2/log/checkout',
  method: 'post',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
Python
import requests
headers = {
  'Authorization': 'string',
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}
r = requests.post('https://dc-api.ematicsolutions.com:8084/v2/log/checkout', params={
}, headers = headers)
print r.json()
Java
URL obj = new URL("https://dc-api.ematicsolutions.com:8084/v2/log/checkout");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
logConversion
POST /log/conversion
Log conversion
Parameters
| Parameter | In | Type | Required | Format | Description | 
|---|---|---|---|---|---|
| Authorization | header | string | true | ematic-apikey=xxx,esp-apikey=yyyy | ematic apikey, esp apikey | 
| body | body | log | true | object | No description | 
Body parameter
{
  "email": "string",
  "clientEnv": {
    "deviceHeight": 0,
    "deviceWidth": 0,
    "viewportHeight": 0,
    "viewportWidth": 0,
    "country": "string",
    "language": "string",
    "currency": "string",
    "device_uid": "string",
    "device_model": "string",
    "device_os_family": "string",
    "device_os_version": "string"
  },
  "products": [
    {
      "experiment_id": 0,
      "client_product_id": "string",
      "client_category_id": "string",
      "price_number": 0,
      "price": "string",
      "name": "string",
      "description": "string",
      "brand_name": "string",
      "image_url": "string",
      "link": "string",
      "misc1": "string",
      "misc2": "string",
      "misc3": "string"
    }
  ]
}
Responses
| Status | Meaning | Description | 
|---|---|---|
| 201 | Created | created | 
| 400 | Bad Request | bad request | 
| 401 | Unauthorized | unauthorized | 
Example responses
{
  "message": "string"
}
{
  "message": "missing apikeys"
}
{
  "message": "invalid apikeys"
}
Code samples
HTTP
POST https://dc-api.ematicsolutions.com:8084/v2/log/conversion HTTP/1.1
Host: dc-api.ematicsolutions.com:8084
Content-Type: application/json
Accept: application/json
Authorization: string
JavaScript
var headers = {
  'Authorization':'string',
  'Accept':'application/json',
  'Content-Type':'application/json'
};
$.ajax({
  url: 'https://dc-api.ematicsolutions.com:8084/v2/log/conversion',
  method: 'post',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
Python
import requests
headers = {
  'Authorization': 'string',
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}
r = requests.post('https://dc-api.ematicsolutions.com:8084/v2/log/conversion', params={
}, headers = headers)
print r.json()
Java
URL obj = new URL("https://dc-api.ematicsolutions.com:8084/v2/log/conversion");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
logBatchMode
POST /log/batch
Log batch mode
Parameters
| Parameter | In | Type | Required | Format | Description | 
|---|---|---|---|---|---|
| Authorization | header | string | true | ematic-apikey=xxx,esp-apikey=yyyy | ematic apikey, esp apikey | 
| body | body | logBatch | true | object | No description | 
Body parameter
{
  "email": "string",
  "clientEnv": {
    "deviceHeight": 0,
    "deviceWidth": 0,
    "viewportHeight": 0,
    "viewportWidth": 0,
    "country": "string",
    "language": "string",
    "currency": "string",
    "device_uid": "string",
    "device_model": "string",
    "device_os_family": "string",
    "device_os_version": "string"
  },
  "batch": [
    {
      "action": "cart",
      "products": [
        {
          "experiment_id": 0,
          "client_product_id": "string",
          "client_category_id": "string",
          "price_number": 0,
          "price": "string",
          "name": "string",
          "description": "string",
          "brand_name": "string",
          "image_url": "string",
          "link": "string",
          "misc1": "string",
          "misc2": "string",
          "misc3": "string"
        }
      ]
    }
  ]
}
Responses
| Status | Meaning | Description | 
|---|---|---|
| 201 | Created | created | 
| 400 | Bad Request | bad request | 
| 401 | Unauthorized | unauthorized | 
Example responses
{
  "message": "string"
}
{
  "message": "missing apikeys"
}
{
  "message": "invalid apikeys"
}
Code samples
HTTP
POST https://dc-api.ematicsolutions.com:8084/v2/log/batch HTTP/1.1
Host: dc-api.ematicsolutions.com:8084
Content-Type: application/json
Accept: application/json
Authorization: string
JavaScript
var headers = {
  'Authorization':'string',
  'Accept':'application/json',
  'Content-Type':'application/json'
};
$.ajax({
  url: 'https://dc-api.ematicsolutions.com:8084/v2/log/batch',
  method: 'post',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
Python
import requests
headers = {
  'Authorization': 'string',
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}
r = requests.post('https://dc-api.ematicsolutions.com:8084/v2/log/batch', params={
}, headers = headers)
print r.json()
Java
URL obj = new URL("https://dc-api.ematicsolutions.com:8084/v2/log/batch");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
subscribe
createSubscription
POST /subscribe
Create subscription
For now, only email subscriptions are supported 
Use subscribe_email_addr to subscribe email address.
Parameters
| Parameter | In | Type | Required | Format | Description | 
|---|---|---|---|---|---|
| Authorization | header | string | true | ematic-apikey=xxx,esp-apikey=yyyy | ematic apikey, esp apikey | 
| subscribe body | body | subscribe | true | undefined | No description | 
Body parameter
{
  "uuid": "string",
  "email": "string",
  "subscribe_email_addr": "string",
  "clientEnv": {
    "deviceHeight": 0,
    "deviceWidth": 0,
    "viewportHeight": 0,
    "viewportWidth": 0,
    "country": "string",
    "language": "string",
    "currency": "string",
    "device_uid": "string",
    "device_model": "string",
    "device_os_family": "string",
    "device_os_version": "string"
  },
  "first_name": "string",
  "last_name": "string"
}
Responses
| Status | Meaning | Description | 
|---|---|---|
| 200 | OK | Subscription exists | 
| 201 | Created | Successful subscription(s) | 
| 400 | Bad Request | bad request | 
| 401 | Unauthorized | unauthorized | 
| 500 | Internal Server Error | Error has occured | 
Example responses
{
  "message": "string"
}
{
  "message": "string",
  "coupon": "string"
}
{
  "message": "string"
}
{
  "message": "invalid apikeys"
}
{
  "message": "string",
  "esp_code": "string",
  "mandrill_code": "string"
}
Code samples
HTTP
POST https://dc-api.ematicsolutions.com:8084/v2/subscribe HTTP/1.1
Host: dc-api.ematicsolutions.com:8084
Content-Type: application/json
Accept: application/json
Authorization: string
JavaScript
var headers = {
  'Authorization':'string',
  'Accept':'application/json',
  'Content-Type':'application/json'
};
$.ajax({
  url: 'https://dc-api.ematicsolutions.com:8084/v2/subscribe',
  method: 'post',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
Python
import requests
headers = {
  'Authorization': 'string',
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}
r = requests.post('https://dc-api.ematicsolutions.com:8084/v2/subscribe', params={
}, headers = headers)
print r.json()
Java
URL obj = new URL("https://dc-api.ematicsolutions.com:8084/v2/subscribe");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
cancelSubscription
DELETE /subscribe
Cancel subscription
For now, only email subscriptions are supported 
Use unsubscribe_email_addr to unsubscribe email address.
Parameters
| Parameter | In | Type | Required | Format | Description | 
|---|---|---|---|---|---|
| Authorization | header | string | true | ematic-apikey=xxx,esp-apikey=yyyy | ematic apikey, esp apikey | 
| unsubscribe body | body | unsubscribe | true | undefined | No description | 
Body parameter
{
  "uuid": "string",
  "email": "string",
  "unsubscribe_email_addr": "string",
  "clientEnv": {
    "deviceHeight": 0,
    "deviceWidth": 0,
    "viewportHeight": 0,
    "viewportWidth": 0,
    "country": "string",
    "language": "string",
    "currency": "string",
    "device_uid": "string",
    "device_model": "string",
    "device_os_family": "string",
    "device_os_version": "string"
  }
}
Responses
| Status | Meaning | Description | 
|---|---|---|
| 200 | OK | User is not subscribed | 
| 204 | No Content | Successfuly unsubscribed | 
| 400 | Bad Request | bad request | 
| 401 | Unauthorized | unauthorized | 
| 500 | Internal Server Error | Error has occured | 
Example responses
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "invalid apikeys"
}
{
  "message": "string",
  "esp_code": "string"
}
Code samples
HTTP
DELETE https://dc-api.ematicsolutions.com:8084/v2/subscribe HTTP/1.1
Host: dc-api.ematicsolutions.com:8084
Content-Type: application/json
Accept: application/json
Authorization: string
JavaScript
var headers = {
  'Authorization':'string',
  'Accept':'application/json',
  'Content-Type':'application/json'
};
$.ajax({
  url: 'https://dc-api.ematicsolutions.com:8084/v2/subscribe',
  method: 'delete',
  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})
Python
import requests
headers = {
  'Authorization': 'string',
  'Accept': 'application/json',
  'Content-Type': 'application/json'
}
r = requests.delete('https://dc-api.ematicsolutions.com:8084/v2/subscribe', params={
}, headers = headers)
print r.json()
Java
URL obj = new URL("https://dc-api.ematicsolutions.com:8084/v2/subscribe");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
