LogoLogo
HomeBlogDocsGuides
  • Engage Documentation
  • GETTING STARTED
    • Quick Start Guide
    • Feature Introduction
    • A basic installation
      • Platform specific installation
  • Integrations
    • Overview
    • Destinations
      • Customer.io
      • Facebook Conversion API
      • Facebook Marketing API
      • Facebook Pixel
      • Google Ads API
      • Google Analytics 4
      • Google Analytics 4 -Send audience data
      • Google Analytics 4 - Server-side
      • Google Enhanced Conversions
      • Klaviyo
      • Klaviyo Server Side
      • LinkedIn Pixel
      • TikTok Pixel
    • Sources
      • AbiCart Plugin
        • Event Tracking
      • Google Product Feed
      • Javascript Tracker
      • Magento 1 Plugin
      • Magento 2 Plugin
      • Prestashop Module
        • Event Tracking
      • Shopify Plugin
        • Event Tracking
      • Wikingruppen Plugin
      • Woocommerce Plugin
        • Event Tracking
      • Troubleshooting
  • Features
    • Event Tracking
      • Capture Video events
      • Cart
      • Checkout
      • Order
      • Product
      • Product Lists
      • Promotions
      • Reviews
      • User
      • Wishlist
    • Identities
    • Segments
    • Audiences
    • Actions
      • Sync audiences
    • Analytics
      • Customer Report
      • Sales Report
      • Attribution Models
    • Personalization
      • Product Recommendations
        • Setup Recommendations
        • Blocks
        • Models
        • Troubleshoot
      • Personalized landing pages for marketing automation
      • Recommendation Report
  • API
    • Recently Viewed
    • Recommended Products
    • Server-side Tracker
    • Order History API
    • Product Catalog API
  • Billing
    • Legacy plans
    • Shopify
  • Terms & Conditions
    • Terms and Conditions
    • Privacy Policy
      • Privacybeleid
      • Informativa sulla Privacy
      • Datenschutz-Richtlinie
      • Politique de Confidentialité
      • Política de privacidad
Powered by GitBook
On this page
  • Add this source
  • Use this source
  • Historic Order API
  • Example call
  • Data formats
  • Dates & Time

Was this helpful?

Export as PDF
  1. API

Order History API

PreviousServer-side TrackerNextProduct Catalog API

Last updated 2 years ago

Was this helpful?

The order History API enables you to send order data to engage. While the Javascript source will catch order data through events happening now, this source let you send historic data to quickly add enough data to train the machine learning models, such as the recommendation engine.

Add this source

  1. Log into your engage account

  2. Go to Data Platform > Integrations and select the Order History API

  3. Follow the instructions to get started

Use this source

Once activated, you may start to send orders to us. The endpoint accept single orders or batches of maximum 250 orders at a time. Check the for specifics and code examples in most languages.

Historic Order API

POST https://api.zubi.ai/e/data/orders

This endpoint allows you to upload your orders to engage. Both historical orders dating back the last 2 years, and new orders can be sent through this endpoint. Sending two orders with identical order_id will overwrite the first record.

Query Parameters

Name
Type
Description

city*

string

"New York"

completion_date_gmt

string

Check the accepted date formats below

country*

string

"US" or "USA" or "United States"

currency*

string

"USD"

date_created_gmt*

string

Check the accepted date formats below

date_modified_gmt*

string

Check the accepted date formats below

email*

string

"[email protected]"

first_name

string

"John"

last_name

string

"Doe"

order_id*

integer

10021

phone

string

"+46 123 456 789"

status*

string

"completed"

order_value*

number

76.99

zip_code

string

"10800"

line_items*

object

[ { "line_item_product_id": 1002, [required] "line_item_price": 17.49, [required] "line_item_quantity": 1 [required] "line_item_name": "Any name", "line_item_sku": "sku 123", "line_item_variation_id": 1234, "line_item_subtotal": 17.49, "line_item_total": 17.49, "line_item_tax_class": "Class A", "line_item_subtotal_tax": 0, "line_item_total_tax": 0 }, ... ]

Headers

Name
Type
Description

Authorization*

string

"Bearer eyJhbGciOiJIUzI1NiIssdzNCw..." Log in to retrieve your user token.

Order successfully added
Order upload failed

Example call

curl --location --request POST 'https://api-dot-solutionsone-211314.ew.r.appspot.com/v1/orders' 
--header 'Authorization: Bearer [ADD YOUR USER TOKEN HERE]' \
--header 'Content-Type: application/json' 
--data-raw '{ 
    "city": "New York", 
    "country": "USA", 
    "currency": "USD", 
    "date_created_gmt": "2020-01-01 20:20:01+01:00", 
    "email": "[email protected]", 
    "order_id": 20200101, 
    "status": "completed", 
    "order_value": 40.00, 
    "line_items":[
        { 
            "line_item_product_id": 1002, 
            "line_item_price": 17.49, 
            "line_item_quantity": 1, 
            "line_item_name": "Any name", 
            "line_item_sku": "sku 123", 
            "line_item_variation_id": 1234, 
            "line_item_subtotal": 17.49, 
            "line_item_total": 17.49, 
            "line_item_tax_class": "Class A", 
            "line_item_subtotal_tax": 0, 
            "line_item_total_tax": 0 
        }
    ]
}'
var settings = {
  "url": "https://api-dot-solutionsone-211314.ew.r.appspot.com/v1/orders",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer [ADD YOUR USER TOKEN HERE]",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({"city":"New York","country":"USA","currency":"USD","date_created_gmt":"2020-01-01 20:20:01+01:00","email":"[email protected]","order_id":20200102,"status":"completed","order_value":40,"line_items":[{"line_item_product_id":1002,"line_item_price":17.49,"line_item_quantity":1,"line_item_name":"Any name","line_item_sku":"sku 123","line_item_variation_id":1234,"line_item_subtotal":17.49,"line_item_total":17.49,"line_item_tax_class":"Class A","line_item_subtotal_tax":0,"line_item_total_tax":0}]}),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer [ADD YOUR USER TOKEN HERE]");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({"city":"New York","country":"USA","currency":"USD","date_created_gmt":"2020-01-01 20:20:01+01:00","email":"[email protected]","order_id":20200102,"status":"completed","order_value":40,"line_items":[{"line_item_product_id":1002,"line_item_price":17.49,"line_item_quantity":1,"line_item_name":"Any name","line_item_sku":"sku 123","line_item_variation_id":1234,"line_item_subtotal":17.49,"line_item_total":17.49,"line_item_tax_class":"Class A","line_item_subtotal_tax":0,"line_item_total_tax":0}]});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api-dot-solutionsone-211314.ew.r.appspot.com/v1/orders", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
var axios = require('axios');
var data = JSON.stringify({"city":"New York","country":"USA","currency":"USD","date_created_gmt":"2020-01-01 20:20:01+01:00","email":"[email protected]","order_id":20200102,"status":"completed","order_value":40,"line_items":[{"line_item_product_id":1002,"line_item_price":17.49,"line_item_quantity":1,"line_item_name":"Any name","line_item_sku":"sku 123","line_item_variation_id":1234,"line_item_subtotal":17.49,"line_item_total":17.49,"line_item_tax_class":"Class A","line_item_subtotal_tax":0,"line_item_total_tax":0}]});

var config = {
  method: 'post',
  url: 'https://api-dot-solutionsone-211314.ew.r.appspot.com/v1/orders',
  headers: { 
    'Authorization': 'Bearer [ADD YOUR USER TOKEN HERE]', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api-dot-solutionsone-211314.ew.r.appspot.com/v1/orders",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS =>"{\"city\": \"New York\",\"country\": \"USA\",\"currency\": \"USD\",\"date_created_gmt\": \"2020-01-01 20:20:01+01:00\",\"email\": \"[email protected]\",\"order_id\": 20200102,\"status\": \"completed\",\"order_value\": 40.00,\"line_items\":[ { \"line_item_product_id\":  1002,\"line_item_price\": 17.49,\"line_item_quantity\": 1,\"line_item_name\": \"Any name\",\"line_item_sku\": \"sku 123\",\"line_item_variation_id\": 1234,\"line_item_subtotal\": 17.49,\"line_item_total\": 17.49,\"line_item_tax_class\": \"Class A\",\"line_item_subtotal_tax\": 0,\"line_item_total_tax\": 0 } ] }",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer [ADD YOUR USER TOKEN HERE]",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import requests
import json

url = "https://api-dot-solutionsone-211314.ew.r.appspot.com/v1/orders"

order = {
  "city": "New York",
  "country": "USA",
  "currency": "USD",
  "date_created_gmt": "2020-01-01 20:20:01+01:00",
  "email": "[email protected]",
  "order_id": 20200102,
  "status": "completed",
  "order_value": 40.00,
  "line_items": [
    {
      "line_item_product_id":  1002,
      "line_item_price": 17.49,
      "line_item_quantity": 1,
      "line_item_name": "Any name",
      "line_item_sku": "sku 123",
      "line_item_variation_id": 1234,
      "line_item_subtotal": 17.49,
      "line_item_total": 17.49,
      "line_item_tax_class": "Class A",
      "line_item_subtotal_tax": 0,
      "line_item_total_tax": 0
    }
  ]
}
payload = json.dumps(order)
headers = {
  'Authorization': 'Bearer [ADD YOUR USER TOKEN HERE]',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))

Data formats

Dates & Time

Format

Example

YYYY-MM-DD HH:MM:SS+HH:MM

2020-01-01 04:23:01+04:00

YYYY-MM-DD HH:MM:SS.ffffff

2020-01-01 04:23:01.000384

YYYY-MM-DD HH:MM:SS

2020-01-01 04:23:01

YYYY-MM-DDTHH:MM:SS+HH:MM

2020-01-01T04:23:01+04:00

YYYY-MM-DDTHH:MM:SS.ffffff

2020-01-01T04:23:01.000384

YYYY-MM-DDTHH:MM:SS

2020-01-01T04:23:01

Generic format supported

YYYY-MM-DD[*HH[:MM[:SS[.fff[fff]]]][+HH:MM[:SS[.ffffff]]]]

API Reference