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"))