Skip to main content
Before getting started, reach out to Support at [email protected] to receive your API key.

Orders Endpoint

Orders Endpoint: https://api.emotiveapp.co/ecommerce/v1/orders/ Method: POST Content-type: application/json

Authorization

To access the Emotive Open API, a client must add an “Authorization” HTTPS header to every API request and that header’s value must contain a valid API token. This will be provided to you by Emotive.

Formatting

Your Authorization header should contain the word “Token” followed by a space, and the API key provided by Emotive.
Authorization: Token <api_token>

Required Body Parameters

The minimum required parameters for Emotive to successfully track an order are listed below. Orders sent without all required data, or with invalid values will result in a 400 error code. A full order object example is available at the bottom of the article to show how the data payload should be formed.
{ 
  "customer": {
    "phone": "+14132737194"
  },
  "line_items": [ 
    { 
      "product":{
        "title": "Test Product",
        "sku": "SKU"
      },      
      "price": 0
    } 
  ],
  "total_price": 0,
  "order_id": 12346,
  "order_date": "2020-02-02 10:10:10"
}

HTTPS Status Codes

Success Codes

CodeDescription
200OK
201Created
292Accepted (Request accepted, and queued for execution)

Client Error Codes

CodeDescription
400Bad Request (missing or invalid data provided)
401Unauthorized/Authentication Failure
403Forbidden
404Resource not found
405Method not allowed
409Conflict
412Precondition failed
413Request entity too large

Server Error Codes

CodeDescription
500Internal server error
501Not implemented
503Service unavailable

Example POST Code Snippets

Python

import http.client

conn = http.client.HTTPSConnection("api.emotiveapp.co")
payload = "{ \n \"customer\": {\n \"id\": \"10506\", \n \"first_name\": \"Test\", \n \"last_name\": \"Order\", \n \"phone\": \"+14132737194\",\n \"email\": \"[email protected]\",\n \"notes\":\"\",\n \"extra_data\": {}\n },\n \"shipping_address\": {\n \"state_code\": \"NJ\",\n \"name\": \"Stella Valle\",\n \"zip\": \"08822\",\n \"city\": \"Flemington\",\n \"address1\": \"12 MinneakoningRoad\",\n \"address2\": \"Suite 109B\",\n\t\t\"country_code\": \"us\",\n \"notes\":\"\",\n \"extra_data\": {}\n },\n \"line_items\": [ \n \t{ \n \"product\":{\n \t \"title\": \"Test Product\", \n \t\t \"sku\": \"3151235\"\n\t \t }, \n \"collection\": {\n \"title\": \"Testing Collection\", \n \"id\": \"TEST\"\n }, \t \t \n \"variant\": {\n \"id\": \"\", \n \"title\": \"\"\n },\n \"price\": 0,\n \"quantity\": 1,\n \"notes\":\"\",\n \"extra_data\": {}\n } \n ],\n \"discount_codes\": \"TEST15\",\n \"total_price\": 0,\n \"currency\": \"USD\",\n \"order_id\": 12346,\n \"order_date\": \"2020-02-02T10:10:10\", \n \"is_subscribed_order\": false,\n \"email_opt_in\": true,\n \"text_opt_in\": false,\n \"notes\": \"\",\n \"extra_data\": {},\n \"customer_tags\": [\"Test Customer\", \"New Tag\"]\n}"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Token <api_token>'
}
conn.request("POST", "/ecommerce/v1/orders/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

cURL

curl --location --request POST 'https://api.emotiveapp.co/ecommerce/v1/orders/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token <api_token>' \
--data-raw '{ 
  "customer": {
    "id": "10506", 
    "first_name": "Test", 
    "last_name": "Order", 
    "phone": "+14132737194",
    "email": "[email protected]",
    "notes":"",
    "extra_data": {}
  },
  "shipping_address": {
    "state_code": "NJ",
    "name": "Stella Valle",
    "zip": "08822",
    "city": "Flemington",
    "address1": "12 MinneakoningRoad",
    "address2": "Suite 109B",
    "country_code": "us",
    "notes":"",
    "extra_data": {}
  },
  "line_items": [ 
    { 
      "product":{
        "title": "Test Product", 
        "sku": "3151235"
      }, 
      "collection": {
        "title": "Testing Collection", 
        "id": "TEST"
      }, 
      "variant": {
        "id": "", 
        "title": ""
      },
      "price": 0,
      "quantity": 1,
      "notes":"",
      "extra_data": {}
    } 
  ],
  "discount_codes": "TEST15",
  "total_price": 0,
  "currency": "USD",
  "order_id": 12346,
  "order_date": "2020-02-02T10:10:10", 
  "is_subscribed_order": false,
  "email_opt_in": true,
  "text_opt_in": false,
  "notes": "",
  "extra_data": {},
  "customer_tags": ["Test Customer", "New Tag"]
}'