Introduction
Welcome to the MWW OnDemand API! You can use our API to access MWW OnDemand API endpoints, which will allow you to submit orders, query order status, and update orders.
We have language bindings in Shell, Ruby, Python, Java, and PHP! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
Our API conforms to the JSON API 1.0 Specification. Please visit http://jsonapi.org for more information.
Postman Collection
Postman is a free application that allows you to test calls in an easy to use interface. Click here to get our Postman collection of MWW API calls. OR Click here to get our Postman V2 collection of MWW API calls.
Authentication
Customers are granted a API Key that can be used to authorize requests to the application server at https://api.mwwondemand.com
API Key
To authorize, use this code:
# With shell, you can just pass the correct header with each request
curl -X GET https://api.mwwondemand.com/api/login \
-H "Content-Type: application/vnd.api+json" \
-H "Accept: application/vnd.api+json; version=1" \
-H "Authorization: auth-key=YOUR_API_KEY"
require 'net/http'
# api_user Login API KEY (POST )
def send_request
uri = URI('https://api.mwwondemand.com/api/login')
# Create client
http = Net::HTTP.new(uri.host, uri.port)
# Create Request
req = Net::HTTP::Post.new(uri)
# Add headers
req.add_field "Content-Type", "application/vnd.api+json"
# Add headers
req.add_field "Authorization", "auth-key=S@mpl3!"
# Add headers
req.add_field "Accept", "application/vnd.api+json; version=1"
# Fetch Request
res = http.request(req)
puts "Response HTTP Status Code: #{res.code}"
puts "Response HTTP Response Body: #{res.body}"
rescue StandardError => e
puts "HTTP Request failed (#{e.message})"
end
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
# api_user Login API KEY
# POST https://api.mwwondemand.com/api/login
try:
response = requests.post(
url="https://api.mwwondemand.com/api/login",
headers={
"Content-Type": "application/vnd.api+json",
"Authorization": "auth-key=S@mpl3!",
"Accept": "application/vnd.api+json; version=1",
},
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')
import java.io.IOException;
import org.apache.http.client.fluent.*;
public class SendRequest {
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// api_user Login API KEY (POST )
try {
// Create request
Content content = Request.Post("https://api.mwwondemand.com/api/login")
// Add headers
.addHeader("Content-Type", "application/vnd.api+json")
.addHeader("Authorization", "auth-key=S@mpl3!")
.addHeader("Accept", "application/vnd.api+json; version=1")
// Fetch request and return content
.execute().returnContent();
// Print content
System.out.println(content);
}
catch (IOException e) {
System.out.println(e);
}
}
}
<?php
// Get cURL resource
$ch = curl_init();
// Set url
curl_setopt($ch, CURLOPT_URL, 'https://api.mwwondemand.com/api/login');
// Set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
// Set options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/vnd.api+json",
"Authorization: auth-key=S@mpl3!",
"Accept: application/vnd.api+json; version=1",
]
);
// Send the request & save response to $resp
$resp = curl_exec($ch);
if(!$resp) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
} else {
echo "Response HTTP Status Code : " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "\nResponse HTTP Body : " . $resp;
}
// Close request to clear up some resources
curl_close($ch);
Be sure to replace
YOUR_API_KEY
with your API key.
If you need an API key, please contact your MWW representative.
The API expects an API key to be included in all API requests to the server in a header that looks like the following:
Authorization: auth-key=YOUR_API_KEY
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json; version=1
Regenerate Your API Key
To expire your existing api-key and generate a new one, use this code:
curl -X PATCH "https://api.mwwondemand.com/api/regenerate-api-key" \
-H "Content-Type: application/vnd.api+json" \
-H "Accept: application/vnd.api+json; version=1" \
-H "Authorization: auth-key=YOUR_EXISTING_API_KEY"
Be sure to replace
YOUR_EXISTING_API_KEY
with your existing API key. The above command returns a response like:
HTTP/1.1 200 OK
Authorization: auth-key=YOUR_NEW_API_KEY
Content-Type: application/json; charset=utf-8
{
"data": {
"id": "YOUR_USER_ID",
"type": "users",
"attributes": {
"api-key": "YOUR_NEW_API_KEY"
}
}
}
For any issues with regenerating an API key please contact your MWW representative.
Orders
Submit Order
curl -X "POST" "https://api.mwwondemand.com/api/orders" \
-H "Accept: application/vnd.api+json; version=1" \
-H "Authorization: auth-key=YOUR_API_KEY" \
-H "Content-Type: application/vnd.api+json" \
-d $'{
"data": {
"type": "orders",
"attributes": {
"vendor-po": "1467988109",
"marketplace": "TIKTOK",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"test-order": "test",
"shipping-details": {
"IOSS": "GB295849305",
"tracking_url": "https://your.shipping.label.url",
"tracking_number": "your tracking number"
}
}
},
"included": [
{
"type": "shipping-address",
"attributes": {
"name": "Phillip J. Fry",
"address1": "123 Green St.",
"address2:" "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "billing-address",
"attributes": {
"name": "Hubert Farnsworth",
"address1": "123 Green St.",
"address2:" "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "line-items",
"attributes": {
"line-number": 1,
"quantity": 2,
"description": "It\'s not sò fluffy!",
"product-code": "MWW-PRODUCT-CODE",
"customer-product-code": "YOUR_UPC/SKU_NUMBER",
"item-properties": {
"thread-color": "white",
"hs-code": "1234.56.789",
"declared-value": "12.99"
},
"designs": [
{
"image-remote-url": "https://static.pexels.com/photos/39803/pexels-photo-39803.jpeg"
}
]
}
},
{
"type": "line-items",
"attributes": {
"line-number": 2,
"quantity": 5,
"description": "Velour Vest",
"product-code": "MWW-PRODUCT-CODE",
"customer-product-code": "YOUR_UPC/SKU_NUMBER",
"item-properties": {
"thread-color": "white"
},
"designs": [
{
"image-remote-url":"https://www.publicdomainpictures.net/pictures/10000/velka/orange-871282749123hSB3.jpg"
}
]
}
},
{
"type": "packing-list",
"attributes": {
"url": "https://dllc.appstate.edu/sites/dllc.appstate.edu/files/SearchCCimages.pdf"
}
},
{
"type": "shipping-label",
"attributes": {
"url": "https://upload.wikimedia.org/wikipedia/commons/0/04/Einschreiben-Label_Deutsche_Post_2011.jpg"
}
}
]
}'
# DTG undergarment placement example payload
-d $'{
"data": {
"type": "orders",
"attributes": {
"vendor-po": "14679881309",
"marketplace": "TIKTOK",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"test-order": "test",
"shipping-details": {
"IOSS": "GB295849305",
"tracking_url": "https://your.shipping.label.url",
"tracking_number": "your tracking number"
}
}
},
"included": [
{
"type": "shipping-address",
"attributes": {
"name": "Phillip J. Fry",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "billing-address",
"attributes": {
"name": "Hubert Farnsworth",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type":"line-items",
"attributes":{
"line-number":0,
"quantity":1,
"description":"Description",
"product-code":"MWW-PRODUCT-CODE",
"designs":[
{
"image-remote-url": "https://url.jpg",
"location":"front",
"placement":"elastic"
},
{
"image-remote-url": "https://url.jpg",
"location":"back",
"placement":"elastic"
},
{
"image-remote-url": "https://url.jpg",
"location":"front",
"placement":"body"
},
{
"image-remote-url": "https://url.jpg",
"location":"back",
"placement":"body"
}
]
}
}
]
}'
require 'net/http'
# Create Order (POST )
def send_request
uri = URI('https://api.mwwondemand.com/api/orders')
# Create client
http = Net::HTTP.new(uri.host, uri.port)
# Create Request
#http.use_ssl = true
req = Net::HTTP::Post.new(uri)
# Add headers
req["Accept"] = "application/vnd.api+json; version=1"
# Add headers
req.add_field "Authorization", "auth-key=YOUR_API_KEY"
# Add headers
req["Content-Type"] = "application/vnd.api+json"
# Set body
req.body = '{
"data": {
"type": "orders",
"attributes": {
"vendor-po": "14679881309",
"marketplace": "TIKTOK",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"test-order": "test",
"shipping-details": {
"IOSS": "GB295849305",
"tracking_url": "https://your.shipping.label.url",
"tracking_number": "your tracking number"
}
}
},
"included": [
{
"type": "shipping-address",
"attributes": {
"name": "Phillip J. Fry",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "billing-address",
"attributes": {
"name": "Hubert Farnsworth",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "line-items",
"attributes": {
"line-number": 1,
"quantity": 2,
"description": "It\'s not sò fluffy!",
"product-code": "MWW-PRODUCT-CODE",
"customer-product-code": "YOUR_UPC/SKU_NUMBER",
"item-properties": {
"thread-color": "white"
},
"designs": [
{
"image-remote-url": "https://static.pexels.com/photos/39803/pexels-photo-39803.jpeg"
}
]
}
},
{
"type": "line-items",
"attributes": {
"line-number": 2,
"quantity": 5,
"description": "Velour Vest",
"product-code": "MWW-PRODUCT-CODE",
"customer-product-code": "YOUR_UPC/SKU_NUMBER",
"item-properties": {
"thread-color": "white",
"hs-code": "1234.56.789",
"declared-value": "12.99"
},
"designs": [
{
"image-remote-url": "https://www.publicdomainpictures.net/pictures/10000/velka/orange-871282749123hSB3.jpg"
}
]
}
},
{
"type": "packing-list",
"attributes": {
"url": "https://dllc.appstate.edu/sites/dllc.appstate.edu/files/SearchCCimages.pdf"
}
},
{
"type": "shipping-label",
"attributes": {
"url": "https://upload.wikimedia.org/wikipedia/commons/0/04/Einschreiben-Label_Deutsche_Post_2011.jpg"
}
}
]
}'
# DTG undergarment placement example payload
req.body = '{
"data": {
"type": "orders",
"attributes": {
"vendor-po": "14679881309",
"marketplace": "TIKTOK",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"test-order": "test",
"shipping-details": {
"IOSS": "GB295849305",
"tracking_url": "https://your.shipping.label.url",
"tracking_number": "your tracking number"
}
}
},
"included": [
{
"type": "shipping-address",
"attributes": {
"name": "Phillip J. Fry",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "billing-address",
"attributes": {
"name": "Hubert Farnsworth",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type":"line-items",
"attributes":{
"line-number":0,
"quantity":1,
"description":"Description",
"product-code":"MWW-PRODUCT-CODE",
"designs":[
{
"image-remote-url": "https://url.jpg",
"location":"front",
"placement":"elastic"
},
{
"image-remote-url": "https://url.jpg",
"location":"back",
"placement":"elastic"
},
{
"image-remote-url": "https://url.jpg",
"location":"front",
"placement":"body"
},
{
"image-remote-url": "https://url.jpg",
"location":"back",
"placement":"body"
}
]
}
}
]
}'
# Fetch Request
res = http.request(req)
puts "Response HTTP Status Code: #{res.code}"
puts "Response HTTP Response Body: #{res.body}"
rescue StandardError => e
puts "HTTP Request failed (#{e.message})"
end
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
# Create Order
# POST https://api.mwwondemand.com/api/orders
try:
response = requests.post(
url="https://api.mwwondemand.com/api/orders",
headers={
"Content-Type": "application/vnd.api+json",
"Authorization": "auth-key=YOUR_API_KEY",
"Accept": "application/vnd.api+json; version=1",
},
data=
"""{
"data": {
"type": "orders",
"attributes": {
"vendor-po": "14679881092",
"marketplace": "TIKTOK",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"test-order": "test",
"shipping-details": {
"IOSS": "GB295849305",
"tracking_url": "https://your.shipping.label.url",
"tracking_number": "your tracking number"
}
}
},
"included": [
{
"type": "shipping-address",
"attributes": {
"name": "Phillip J. Fry",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "billing-address",
"attributes": {
"name": "Hubert Farnsworth",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "line-items",
"attributes": {
"line-number": 1,
"quantity": 2,
"description": "It\'s not so fluffy!",
"product-code": "MWW-PRODUCT-CODE",
"customer-product-code": "YOUR_UPC/SKU_NUMBER",
"item-properties": {
"thread-color": "white",
"hs-code": "1234.56.789",
"declared-value": "1234.56.789"
},
"designs": [
{
"image-remote-url": "https://static.pexels.com/photos/39803/pexels-photo-39803.jpeg"
}
]
}
},
{
"type": "line-items",
"attributes": {
"line-number": 2,
"quantity": 5,
"description": "Velour Vest",
"product-code": "MWW-PRODUCT-CODE",
"customer-product-code": "YOUR_UPC/SKU_NUMBER",
"item-properties": {
"thread-color": "white"
},
"designs": [
{
"image-remote-url": "https://www.publicdomainpictures.net/pictures/10000/velka/orange-871282749123hSB3.jpg"
}
]
}
},
{
"type": "packing-list",
"attributes": {
"url": "https://dllc.appstate.edu/sites/dllc.appstate.edu/files/SearchCCimages.pdf"
}
},
{
"type": "shipping-label",
"attributes": {
"url": "https://upload.wikimedia.org/wikipedia/commons/0/04/Einschreiben-Label_Deutsche_Post_2011.jpg"
}
}
]
}"""
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException as e:
print(e)
# DTG undergarment placement example payload
data=
"""{
"data": {
"type": "orders",
"attributes": {
"vendor-po": "14679881309",
"marketplace": "TIKTOK",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"test-order": "test",
"shipping-details": {
"IOSS": "GB295849305",
"tracking_url": "https://your.shipping.label.url",
"tracking_number": "your tracking number"
}
}
},
"included": [
{
"type": "shipping-address",
"attributes": {
"name": "Phillip J. Fry",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "billing-address",
"attributes": {
"name": "Hubert Farnsworth",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type":"line-items",
"attributes":{
"line-number":0,
"quantity":1,
"description":"Description",
"product-code":"MWW-PRODUCT-CODE",
"designs":[
{
"image-remote-url": "https://url.jpg",
"location":"front",
"placement":"elastic"
},
{
"image-remote-url": "https://url.jpg",
"location":"back",
"placement":"elastic"
},
{
"image-remote-url": "https://url.jpg",
"location":"front",
"placement":"body"
},
{
"image-remote-url": "https://url.jpg",
"location":"back",
"placement":"body"
}
]
}
}
]
}"""
<?php
// Get cURL resource
$ch = curl_init();
// Set url
curl_setopt($ch, CURLOPT_URL, 'https://api.mwwondemand.com/api/orders');
// Set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
// Set options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/vnd.api+json",
"Authorization: auth-key=YOUR_API_KEY",
"Accept: application/vnd.api+json; version=1",
]
);
// Create body
$body = '{"data": {
"type": "orders",
"attributes": {
"vendor-po": "1467988109",
"marketplace": "TIKTOK",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"shipping-details": {
"IOSS": "GB295849305",
"tracking_url": "https://your.shipping.label.url",
"tracking_number": "your tracking number"
}
}
},
"included": [
{
"type": "shipping-address",
"attributes": {
"name": "Phillip J. Fry",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "billing-address",
"attributes": {
"name": "Hubert Farnsworth",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "line-items",
"attributes": {
"line-number": 1,
"quantity": 2,
"description": "It\'s not sò fluffy!",
"product-code": "MWW-PRODUCT-CODE",
"customer-product-code": "YOUR_UPC/SKU_NUMBER",
"item-properties": {
"thread-color": "white",
"hs-code": "1234.56.789",
"declared-value": "12.99"
},
"designs": [
{
"image-remote-url": "https://static.pexels.com/photos/39803/pexels-photo-39803.jpeg"
}
]
}
},
{
"type": "line-items",
"attributes": {
"line-number": 2,
"quantity": 5,
"description": "Velour Vest",
"product-code": "MWW-PRODUCT-CODE",
"customer-product-code": "YOUR_UPC/SKU_NUMBER",
"item-properties": {
"thread-color": "white",
"hs-code": "1234.56.789"
},
"designs": [
{
"image-remote-url": "https://www.publicdomainpictures.net/pictures/10000/velka/orange-871282749123hSB3.jpg"
}
]
}
},
{
"type": "packing-list",
"attributes": {
"url": "https://dllc.appstate.edu/sites/dllc.appstate.edu/files/SearchCCimages.pdf"
}
},
{
"type": "shipping-label",
"attributes": {
"url": "https://upload.wikimedia.org/wikipedia/commons/0/04/Einschreiben-Label_Deutsche_Post_2011.jpg"
}
}
]}';
// Set body
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
// Send the request & save response to $resp
$resp = curl_exec($ch);
if(!$resp) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
} else {
echo "Response HTTP Status Code : " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "\nResponse HTTP Body : " . $resp;
}
// Close request to clear up some resources
curl_close($ch);
# DTG undergarment placement example payload
$body ='{"data": {
"type": "orders",
"attributes": {
"vendor-po": "14679881309",
"marketplace": "TIKTOK",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"test-order": "test",
"shipping-details": {
"IOSS": "GB295849305",
"tracking_url": "https://your.shipping.label.url",
"tracking_number": "your tracking number"
}
}
},
"included": [
{
"type": "shipping-address",
"attributes": {
"name": "Phillip J. Fry",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type": "billing-address",
"attributes": {
"name": "Hubert Farnsworth",
"address1": "123 Green St.",
"address2": "Suite 321",
"city": "New New York",
"state": "NY",
"country": "US",
"postal-code": "10012",
"email": "bob@dobalina.net",
"phone": "8288888888"
}
},
{
"type":"line-items",
"attributes":{
"line-number":0,
"quantity":1,
"description":"Description",
"product-code":"MWW-PRODUCT-CODE",
"designs":[
{
"image-remote-url": "https://url.jpg",
"location":"front",
"placement":"elastic"
},
{
"image-remote-url": "https://url.jpg",
"location":"back",
"placement":"elastic"
},
{
"image-remote-url": "https://url.jpg",
"location":"front",
"placement":"body"
},
{
"image-remote-url": "https://url.jpg",
"location":"back",
"placement":"body"
}
]
}
}
]
}'
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.DataOutputStream;
public class SubmitOrder {
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// Create Order (POST )
try {
// Create request
URL obj = new URL("https://api.mwwondemand.com/api/orders");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
// // Add headers
con.setRequestProperty("Accept", "application/vnd.api+json; version=1");
con.setRequestProperty("Authorization", "auth-key=YOUR_API_KEY");
con.setRequestProperty("Content-Type", "application/vnd.api+json");
// Add body
String urlParams = "{"+
"\"data\": {"+
"\"type\": \"orders\","+
"\"attributes\":"+
"{"+
"\"vendor-po\": \"146798810923\","+
"\"marketplace\": \"TIKTOK\","+
"\"shipping-method\": \"SAMPLE\","+
"\"shipping-account-number\": \"1234\","+
"\"test-order\": \"test\""+
"\"shipping-details\": {"+
"\"IOSS\": \"GB295849305\""+
"}"+
"}"+
"},"+
"\"included\": [{"+
"\"type\": \"shipping-address\","+
"\"attributes\":"+
"{"+
"\"name\": \"Phillip J. Fry\","+
"\"address1\": \"123 Green St.\","+
"\"address2\": \"Suite 321\","+
"\"city\": \"New New York\","+
"\"state\": \"NY\","+
"\"country\": \"US\","+
"\"postal-code\": \"10012\","+
"\"email\": \"bob@dobalina.net\","+
"\"phone\": \"8288888888\""+
"}"+
"},"+
"{"+
"\"type\": \"billing-address\","+
"\"attributes\":"+
"{"+
"\"name\": \"Hubert Farnsworth\","+
"\"address1\": \"123 Green St.\","+
"\"address2\": \"Suite 321\","+
"\"city\": \"New New York\","+
"\"state\": \"NY\","+
"\"country\": \"US\","+
"\"postal-code\": \"10012\","+
"\"email\": \"bob@dobalina.net\","+
"\"phone\": \"8288888888\""+
"}"+
"},"+
"{"+
"\"type\": \"line-items\","+
"\"attributes\": {"+
"\"line-number\": 1,"+
"\"quantity\": 2,"+
"\"description\": \"It's not sò fluffy!\","+
"\"product-code\": \"MWW-PRODUCT-CODE\","+
"\"customer-product-code\": \"YOUR_UPC/SKU_NUMBER\","+
"\"item-properties\":"+
"{"+
"\"thread-color\": \"white\","+
"\"hs-code\": \"1234.56.789\","+
"\"declared-value\": \"12.99\""+
"},"+
"\"designs\": ["+
"{"+
"\"image-remote-url\": \"https://static.pexels.com/photos/39803/pexels-photo-39803.jpeg\""+
"}"+
"]"+
"}"+
"},"+
"{"+
"\"type\": \"line-items\","+
"\"attributes\": {"+
"\"line-number\": 2,"+
"\"quantity\": 5,"+
"\"description\": \"Velour Vest\","+
"\"product-code\": \"MWW-PRODUCT-CODE\","+
"\"customer-product-code\": \"YOUR_UPC/SKU_NUMBER\","+
"\"item-properties\":"+
"{"+
"\"thread-color\": \"white\""+
"},"+
"\"designs\": ["+
"{"+
"\"image-remote-url\": \"https://www.publicdomainpictures.net/pictures/10000/velka/orange-871282749123hSB3.jpg\""+
"}"+
"]"+
"}"+
"},"+
"{"+
"\"type\": \"packing-list\","+
"\"attributes\":"+
"{"+
"\"url\": \"https://dllc.appstate.edu/sites/dllc.appstate.edu/files/SearchCCimages.pdf\""+
"}"+
"},"+
"{"+
"\"type\": \"shipping-label\","+
"\"attributes\":"+
"{"+
"\"url\": \"https://upload.wikimedia.org/wikipedia/commons/0/04/Einschreiben-Label_Deutsche_Post_2011.jpg\""+
"}"+
"}"+
"]"+
"}";
System.out.println(urlParams);
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.write(urlParams.getBytes("UTF-8"));
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);
System.out.println("POST Response Message : " + con.getResponseMessage());
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream(), "UTF-8"));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
//print result
System.out.println(response.toString());
} catch (IOException e) {
System.out.println(e);
}
}
}
The above command returns JSON structured like this:
{
"data": {
"id": "568129875827754040",
"type": "orders",
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040"
},
"attributes": {
"created-at": "2016-07-07T20:53:02.578Z",
"updated-at": "2016-07-07T20:53:02.578Z",
"state": "received",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"vendor-po": "1467924781"
},
"relationships": {
"line-items": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/line-items",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/line-items"
}
},
"line-item-views": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/line-item-views",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/line-item-views"
}
},
"user": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/user",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/user"
}
},
"packing-list": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/packing-list",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/packing-list"
}
},
"shipping-label": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/shipping-label",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/shipping-label"
}
},
"billing-address": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/billing-address",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/billing-address"
}
},
"shipping-address": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/shipping-address",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/shipping-address"
}
}
}
}
}
This endpoint will submit a new order.
HTTPS Request
POST https://api.mwwondemand.com/api/orders
POST Parameters
Order details
Attributes | |
---|---|
data object |
The root element of your JSON post object. |
type string |
Resource the object represents. This will always be "orders". |
attributes object |
The object that contains all the pertanent information about the order. |
vendor-po string / number |
Your PO number. This string/number must be unique with every order. |
marketplace string |
Optional Field to denote specific marketplace source of order. (TIKTOK) |
shipping-method string |
The shipping carrier and method for the order. For example, use USPSF for USPS First Class. See shipping methods. REQUIRED |
shipping-account-number string |
The shipping account number associated with the shipping carrier and order. |
included array[objects] |
The array element describing the item(s) to be included in the order. |
test-order string optional |
Optional field, 'test' for a test order, 'new' for a new regular order (defaults to 'new') |
shipping-details object optional |
Optional field, currently accepts "IOSS" key and a string value (for EU/UK shipments) |
Line Item details
Attributes | |
---|---|
type string |
Resource the object represents This should always be "line-items". REQUIRED |
attributes object |
The object that contains all the pertanent information about the line-item resource. |
line-number number |
Each line should have a line number in incrementing order. If omitted a line number will be automatically assigned. |
quantity number |
The number of items you want to order for a given product. REQUIRED |
description string |
Your description of the item. If omitted the default product description will be used. |
product-code string |
The MWW product code of the item to order. REQUIRED |
customer-product-code string (optional) |
Your custom SKU or UPC number. Maximum of 30 characters. |
item-properties object (optional) |
Additional attributes for some products. This can be omitted in most cases. See products for more information. Options include: alias-item-no, item-price, extended-description, wsf, thread-color, inside-neck-tape-color, cuff-color, string-color, hood-thread-color, body-thread-color, waist-color, item-label, hs-code, declared-value, height, width, personalization, and unique-id |
designs array[single object] |
Information about the design to be rendered. REQUIRED |
image-remote-url string |
A publically accessible path to the source artwork. Must be a valid Http(s) accessible path to image file. MWW accepts png and jpg files. |
location string |
DTG products only. This is the print location for the image (front or back) |
placement string |
DTG products only. This is a customization of the location value (top-center, left-chest, etc) |
Shipping details
Attribute* | |
---|---|
type string |
Shipping address is required. This will always be "shipping-address". REQUIRED |
name string |
The name to reference the shipment details. |
address1 string |
First line of the address. REQUIRED |
address2 string (optional) |
Second line of the address |
city string |
The city of the shipment. REQUIRED |
state string |
Two letter ISO 3166 alpha 2 code of the destination state, ie "NC". REQUIRED |
country string (optional) |
Two letter ISO 3166 alpha 2 code of the destination country, ie "US". (Defaults to U.S. if not provided) REQUIRED |
postal-code string |
The postal code of the shipment. REQUIRED |
phone string (optional) |
Phone number associated with address |
email string (optional) |
Email associated with address |
Packing List Details (optional)
Attributes | |
---|---|
type string |
Resource the object represents. This will always be "pack-list". |
attributes object |
The object that contains all the pertanent information about the line-item resource. |
url string |
Http(s) accessible path to image file (or PDF) for the order's packing list. |
Shipping Label Details (optional)
Attributes | |
---|---|
type string |
Resource the object represents. This will always be "shipping-label". |
attributes object |
The object that contains all the pertanent information about the line-item resource. |
url string |
Http(s) accessible path to image file (or PDF) for the order's shipping label. |
Note: This endpoint follows the JSON API 1.0 Spec, and also allows included items when creating the order.
Get All Orders
curl -X "GET" "https://api.mwwondemand.com/api/orders" \
-H "Accept: application/vnd.api+json;version=1" \
-H "Authorization: auth-key=YOUR_API_KEY" \
-H "Content-Type: application/vnd.api+json"
require 'net/http'
# Get All Orders (GET )
def send_request
uri = URI.parse('https://api.mwwondemand.com/api/orders')
# Create client
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
# Create Request
req = Net::HTTP::Get.new(uri)
# Add headers
req["Accept"] = "application/vnd.api+json; version=1"
# Add headers
req.add_field "Authorization", "auth-key=YOUR_API_KEY"
# Add headers
req["Content-Type"] = "application/vnd.api+json"
# Fetch Request
res = http.request(req)
puts "Response HTTP Status Code: #{res.code}"
puts "Response HTTP Response Body: #{res.body}"
rescue StandardError => e
puts "HTTP Request failed (#{e.message})"
end
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
# Get All Orders
# GET https://api.mwwondemand.com/api/orders
try:
response = requests.get(
url="https://api.mwwondemand.com/api/orders",
headers={
"Accept": "application/vnd.api+json; version=1",
"Authorization": "auth-key=S@mpl3!",
"Content-Type": "application/vnd.api+json",
},
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class SendRequest {
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// Get All Orders (GET )
try {
// Create request
URL obj = new URL("https://api.mwwondemand.com/api/orders");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
// Add headers
con.setRequestProperty("Accept", "application/vnd.api+json; version=1");
con.setRequestProperty("Authorization", "auth-key=S@mpl3!");
con.setRequestProperty("Content-Type", "application/vnd.api+json");
// Get response code (200 is good)
int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inLine;
StringBuffer response = new StringBuffer();
while ((inLine = in.readLine()) != null) {
response.append(inLine);
}
in.close();
//print result
System.out.println(response.toString());
}
catch (IOException e) { System.out.println(e); }
}
}
<?php
// Get cURL resource
$ch = curl_init();
// Set url
curl_setopt($ch, CURLOPT_URL, 'https://api.mwwondemand.com/api/orders');
// Set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
// Set options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Accept: application/vnd.api+json; version=1",
"Authorization: auth-key=S@mpl3!",
"Content-Type: application/vnd.api+json",
]
);
// Send the request & save response to $resp
$resp = curl_exec($ch);
if(!$resp) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
} else {
echo "Response HTTP Status Code : " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "\nResponse HTTP Body : " . $resp;
}
// Close request to clear up some resources
curl_close($ch);
The above command returns JSON structured like this:
{
"data": [
{
"id": "536862475937646298",
"type": "orders",
"links": {
"self": "https://api.mwwondemand.com/api/orders/536862475937646298"
},
"attributes": {
"created-at": "2016-04-26T20:53:19.530Z",
"updated-at": "2016-05-25T17:30:17.855Z",
"state": "received",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"vendor-po": "1467924781",
"tracking_numbers": [
"XYZ0002KDKRYNNMASDAN"
]
},
"relationships": {
"line-items": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/536862475937646298/relationships/line-items",
"related": "https://api.mwwondemand.com/api/orders/536862475937646298/line-items"
}
},
"line-item-views": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/536862475937646298/relationships/line-item-views",
"related": "https://api.mwwondemand.com/api/orders/536862475937646298/line-item-views"
}
},
"user": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/536862475937646298/relationships/user",
"related": "https://api.mwwondemand.com/api/orders/536862475937646298/user"
}
},
"packing-list": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/536862475937646298/relationships/packing-list",
"related": "https://api.mwwondemand.com/api/orders/536862475937646298/packing-list"
}
},
"shipping-label": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/536862475937646298/relationships/shipping-label",
"related": "https://api.mwwondemand.com/api/orders/536862475937646298/shipping-label"
}
},
"billing-address": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/536862475937646298/relationships/billing-address",
"related": "https://api.mwwondemand.com/api/orders/536862475937646298/billing-address"
}
},
"shipping-address": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/536862475937646298/relationships/shipping-address",
"related": "https://api.mwwondemand.com/api/orders/536862475937646298/shipping-address"
}
}
}
}
],
"meta": {
"page": {
"total": 34
}
},
"links": {
"first": "https://api.mwwondemand.com/api/orders?page%5Blimit%5D=1&page%5Boffset%5D=0",
"next": "https://api.mwwondemand.com/api/orders?page%5Blimit%5D=1&page%5Boffset%5D=1",
"last": "https://api.mwwondemand.com/api/orders?page%5Blimit%5D=1&page%5Boffset%5D=33"
}
}
require 'thing'
api = thing::APIClient.authorize!('meowmeowmeow')
api.things.get
import thing
api = thing.authorize('meowmeowmeow')
api.things.get()
An endpoint to retrieve orders. By default the first request will limit to 10 orders with an offset of 0.
HTTPS Request
GET https://api.mwwondemand.com/api/orders
Query Parameters
Attributes | |
---|---|
include string (optional) |
If set to "line-items", the result will also include line-items. |
Get a Specific Order
curl -X "GET" "https://api.mwwondemand.com/api/orders/001122334455667788" \
-H "Accept: application/vnd.api+json;version=1" \
-H "Authorization: auth-key=YOUR_API_KEY" \
-H "Content-Type: application/vnd.api+json"
require 'net/http'
# Get All Orders (GET )
def send_request
uri = URI.parse('https://api.mwwondemand.com/api/orders/705517149988324623')
# Create client
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
# Create Request
req = Net::HTTP::Get.new(uri)
# Add headers
req["Accept"] = "application/vnd.api+json; version=1"
# Add headers
req.add_field "Authorization", "auth-key=YOUR_API_KEY"
# Add headers
req["Content-Type"] = "application/vnd.api+json"
# Fetch Request
res = http.request(req)
puts "Response HTTP Status Code: #{res.code}"
puts "Response HTTP Response Body: #{res.body}"
rescue StandardError => e
puts "HTTP Request failed (#{e.message})"
end
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
# Get Order
# GET https://api.mwwondemand.com/api/orders/
try:
response = requests.get(
url="https://api.mwwondemand.com/api/orders/572425086284334684",
params={
},
headers={
"Content-Type": "application/vnd.api+json",
"Authorization": "auth-key=YOUR_API_KEY",
"Accept": "application/vnd.api+json;version=1",
},
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class SendRequest2 {
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// Get All Orders (GET )
try {
// Create request
URL obj = new URL("https://api.mwwondemand.com/api/orders/705517149988324623");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
// Add headers
con.setRequestProperty("Accept", "application/vnd.api+json; version=1");
con.setRequestProperty("Authorization", "auth-key=S@mpl3!");
con.setRequestProperty("Content-Type", "application/vnd.api+json");
// Get response code (200 is good)
int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inLine;
StringBuffer response = new StringBuffer();
while ((inLine = in.readLine()) != null) {
response.append(inLine);
}
in.close();
//print result
System.out.println(response.toString());
}
catch (IOException e) { System.out.println(e); }
}
}
<?php
// Get cURL resource
$ch = curl_init();
// Set url
curl_setopt($ch, CURLOPT_URL, 'https://api.mwwondemand.com/api/orders/572425086284334684');
// Set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
// Set options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/vnd.api+json",
"Authorization: auth-key=YOUR_API_KEY",
"Accept: application/vnd.api+json;version=1",
]
);
// Send the request & save response to $resp
$resp = curl_exec($ch);
if(!$resp) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
} else {
echo "Response HTTP Status Code : " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "\nResponse HTTP Body : " . $resp;
}
// Close request to clear up some resources
curl_close($ch);
The above command returns the following JSON:
{
"data": {
"id": "572425086284334684",
"type": "orders",
"links": {
"self": "https://api.mwwondemand.com/api/orders/572425086284334684"
},
"attributes": {
"created-at": "2016-07-13T19:06:51.563Z",
"updated-at": "2016-07-13T19:06:51.563Z",
"state": "received",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"vendor-po": "1468436810",
"tracking_numbers": [
"XYZ0002KDKRYNNMASDAN"
]
},
"relationships": {
"line-items": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/572425086284334684/relationships/line-items",
"related": "https://api.mwwondemand.com/api/orders/572425086284334684/line-items"
}
},
"line-item-views": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/572425086284334684/relationships/line-item-views",
"related": "https://api.mwwondemand.com/api/orders/572425086284334684/line-item-views"
}
},
"packing-list": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/572425086284334684/relationships/packing-list",
"related": "https://api.mwwondemand.com/api/orders/572425086284334684/packing-list"
}
},
"shipping-label": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/572425086284334684/relationships/shipping-label",
"related": "https://api.mwwondemand.com/api/orders/572425086284334684/shipping-label"
}
},
"billing-address": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/572425086284334684/relationships/billing-address",
"related": "https://api.mwwondemand.com/api/orders/572425086284334684/billing-address"
}
},
"shipping-address": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/572425086284334684/relationships/shipping-address",
"related": "https://api.mwwondemand.com/api/orders/572425086284334684/shipping-address"
}
}
}
}
}
require 'mww'
api = Mww::APIClient.authorize!('meowmeowmeow')
api.orders.get(2)
import thing
api = thing.authorize('meowmeowmeow')
api.orders.get(2)
This endpoint retrieves a specific order.
HTTPS Request
GET https://api.mwwondemand.com/api/orders/<MWW_ORDER_ID>
or
GET https://api.mwwondemand.com/api/orders/<YOUR_VENDOR_PO>
URL Parameters
Parameter | Description |
---|---|
id | The ID of the thing to retrieve |
vendor_po | Your PO number. This string/number must be unique with every order |
[comment]: <> (## Update Ship Method
[comment]: <> (> The above command returns the following JSON:
[comment]: <> (This endpoint requests to update a specific order. We are unable to immediately update the order. We will deny requests immediately if the order is already packed, shipped or cancelled. We will also deny requests if the original order has not been fully ingested. This may take up to an hour from submission. Successful requests will then receive a webhook confirming the update.
[comment]: <> (### HTTPS Request
[comment]: <> (PATCH https://api.mwwondemand.com/api/orders/<MWW_ORDER_ID>/
[comment]: <> (### or
[comment]: <> (PATCH https://api.mwwondemand.com/api/orders/<YOUR_VENDOR_PO>/
[comment]: <> (### URL Parameters
[comment]: <> (Parameter | Description [comment]: <> (--------- | ----------- [comment]: <> (id | The ID of the thing to retrieve [comment]: <> (vendor_po | Your PO number. This string/number must be unique with every order
Cancel
curl -X "PATCH" "https://api.mwwondemand.com/api/orders/:id/" \
-H "Accept: application/vnd.api+json;version=1" \
-H "Authorization: auth-key=YOUR_API_KEY" \
-H "Content-Type: application/vnd.api+json"
-d $'{
"data": {
"type": "orders",
"id": <YOUR_VENDOR_PO/ORDER_ID>
"attributes": {
"request": "cancel"
}
}
}'
require 'net/http'
# Create Order (POST )
def send_request
uri = URI('https://api.mwwondemand.com/api/orders')
# Create client
http = Net::HTTP.new(uri.host, uri.port)
# Create Request
#http.use_ssl = true
req = Net::HTTP::Post.new(uri)
# Add headers
req["Accept"] = "application/vnd.api+json; version=1"
# Add headers
req.add_field "Authorization", "auth-key=YOUR_API_KEY"
# Add headers
req["Content-Type"] = "application/vnd.api+json"
# Set body
req.body = '{
"data": {
"type": "orders",
"attributes": {
"vendor-po": "14679881309",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"test-order": "test"
}
}
}'
# Fetch Request
res = http.request(req)
puts "Response HTTP Status Code: #{res.code}"
puts "Response HTTP Response Body: #{res.body}"
rescue StandardError => e
puts "HTTP Request failed (#{e.message})"
end
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
# Cancel Order
# PATCH https://api.mwwondemand.com/api/orders/:id
try:
response = requests.post(
url="https://api.mwwondemand.com/api/orders",
headers={
"Content-Type": "application/vnd.api+json",
"Authorization": "auth-key=YOUR_API_KEY",
"Accept": "application/vnd.api+json; version=1",
},
data=
"""{
"data": {
"type": "orders",
"attributes": {
"vendor-po": "14679881092",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"test-order": "test"
}
}
}"""
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException as e:
print(e)
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.DataOutputStream;
public class SubmitOrder {
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// Create Order (POST )
try {
// Create request
URL obj = new URL("https://api.mwwondemand.com/api/orders/:id");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
// // Add headers
con.setRequestProperty("Accept", "application/vnd.api+json; version=1");
con.setRequestProperty("Authorization", "auth-key=YOUR_API_KEY");
con.setRequestProperty("Content-Type", "application/vnd.api+json");
// Add body
String urlParams = "{"+
"\"data\": {"+
"\"type\": \"orders\","+
"\"id\": \"YOUR_PO/ORDER_ID\","+
"\"attributes\":"+
"{"+
"\"request\": \"cancel\""+
"}"+
"},"+
"}"
System.out.println(urlParams);
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.write(urlParams.getBytes("UTF-8"));
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);
System.out.println("PATCH Response Message : " + con.getResponseMessage());
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream(), "UTF-8"));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
//print result
System.out.println(response.toString());
} catch (IOException e) {
System.out.println(e);
}
}
<?php
// Get cURL resource
$ch = curl_init();
// Set url
curl_setopt($ch, CURLOPT_URL, 'https://api.mwwondemand.com/api/orders/:id');
// Set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
// Set options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/vnd.api+json",
"Authorization: auth-key=YOUR_API_KEY",
"Accept: application/vnd.api+json; version=1",
]
);
// Create body
$body = '{"data": {
"type": "orders",
"id": <YOUR_VENDOR_PO/ORDER_ID>
"attributes": {
"request": "cancel"
}
}
}'
// Set body
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
// Send the request & save response to $resp
$resp = curl_exec($ch);
if(!$resp) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
} else {
echo "Response HTTP Status Code : " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "\nResponse HTTP Body : " . $resp;
}
// Close request to clear up some resources
curl_close($ch);
The above command returns the following JSON:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"data": {
"id": "568129875827754040",
"type": "orders",
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040"
},
"attributes": {
"created-at": "2016-07-07T20:53:02.578Z",
"updated-at": "2016-07-07T20:53:02.578Z",
"state": "received",
"shipping-method": "SAMPLE",
"shipping-account-number": "1234",
"vendor-po": "1467924781"
},
"relationships": {
"line-items": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/line-items",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/line-items"
}
},
"line-item-views": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/line-item-views",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/line-item-views"
}
},
"user": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/user",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/user"
}
},
"packing-list": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/packing-list",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/packing-list"
}
},
"shipping-label": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/shipping-label",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/shipping-label"
}
},
"billing-address": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/billing-address",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/billing-address"
}
},
"shipping-address": {
"links": {
"self": "https://api.mwwondemand.com/api/orders/568129875827754040/relationships/shipping-address",
"related": "https://api.mwwondemand.com/api/orders/568129875827754040/shipping-address"
}
}
}
}
}
This endpoint requests to cancel a specific order. We are unable to immediately cancel the order. We will deny requests immediatley if the order is already packed, shipped or cancelled. We will also deny requests if the original order has not been fully ingested. This may take up to an hour from submission. Successful requests will then receive a webhook confirming the cancellation.
HTTPS Request
PATCH https://api.mwwondemand.com/api/orders/<MWW_ORDER_ID>/
or
PATCH https://api.mwwondemand.com/api/orders/<YOUR_VENDOR_PO>/
URL Parameters
Parameter | Description |
---|---|
id | The ID of the thing to retrieve |
vendor_po | Your PO number. This string/number must be unique with every order |
Line Items
Line items are included when an Order request is posted.
GET LineItems
curl -X "GET" "https://api.mwwondemand.com/api/orders/647372458376520634/line-items" \
-H "Accept: application/vnd.api+json;version=1" \
-H "Authorization: auth-key=YOUR_API_KEY" \
-H "Content-Type: application/vnd.api+json"
require 'net/http'
# Get All Orders (GET )
def send_request
uri = URI.parse('https://api.mwwondemand.com/api/orders/705517149988324623/line-items')
# Create client
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
# Create Request
req = Net::HTTP::Get.new(uri)
# Add headers
req["Accept"] = "application/vnd.api+json; version=1"
# Add headers
req.add_field "Authorization", "auth-key=YOUR_API_KEY"
# Add headers
req["Content-Type"] = "application/vnd.api+json"
# Fetch Request
res = http.request(req)
puts "Response HTTP Status Code: #{res.code}"
puts "Response HTTP Response Body: #{res.body}"
rescue StandardError => e
puts "HTTP Request failed (#{e.message})"
end
send_request
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
# Get Line Items By Order
# GET https://api.mwwondemand.com/api/orders/647372455787562562/line-items
try:
response = requests.get(
url="https://api.mwwondemand.com/api/orders/705517149988324623/line-items",
headers={
"Authorization": "auth-key=YOUR_API_KEY",
"Accept": "application/vnd.api+json; version=1",
},
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class SendRequest {
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// Get All Orders (GET )
try {
// Create request
URL obj = new URL("https://api.mwwondemand.com/api/orders/705517149988324623/line-items");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
// Add headers
con.setRequestProperty("Accept", "application/vnd.api+json; version=1");
con.setRequestProperty("Authorization", "auth-key=S@mpl3!");
con.setRequestProperty("Content-Type", "application/vnd.api+json");
// Get response code (200 is good)
int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inLine;
StringBuffer response = new StringBuffer();
while ((inLine = in.readLine()) != null) {
response.append(inLine);
}
in.close();
//print result
System.out.println(response.toString());
}
catch (IOException e) { System.out.println(e); }
}
}
<?php
// Get cURL resource
$ch = curl_init();
// Set url
curl_setopt($ch, CURLOPT_URL, 'https://api.mwwondemand.com/api/orders/647372455787562562/line-items');
// Set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
// Set options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: auth-key=YOUR_API_KEY",
"Accept: application/vnd.api+json; version=1",
]
);
// Send the request & save response to $resp
$resp = curl_exec($ch);
if(!$resp) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
} else {
echo "Response HTTP Status Code : " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "\nResponse HTTP Body : " . $resp;
}
// Close request to clear up some resources
curl_close($ch);
The above command returns JSON structured like this:
{
"data": [
{
"id": "647372455787562562",
"type": "line-items",
"links": {
"self": "https://api.mwwondemand.com/api/line-items/647372455787562562"
},
"attributes": {
"created-at": "2016-10-25T18:08:38.043Z",
"updated-at": "2016-10-25T18:08:38.043Z",
"description": "It's sò fluffy!",
"quantity": 5,
"state": "received",
"product-code": "MWW-PRODUCT-CODE",
"line-number": 2,
"po": "6477724553765206641477418918.0488908",
"line-item-count": {
"line_item_id": 647372455787562562,
"received": 5,
"cancelled": 0,
"loom": 0,
"printed": 0,
"hold": 0,
"stretched": 0,
"pressed": 0,
"cut": 0,
"eton": 0,
"packed": 0,
"pillow_blow": 0,
"tentered": 0,
"quality_control": 0,
"sewn": 0,
"turned": 0,
"shipped": 0
},
"kit-data": [],
"co": null,
"tracking-numbers": []
},
"relationships": {
"items": {
"links": {
"self": "https://api.mwwondemand.com/api/line-items/647372455787562562/relationships/items",
"related": "https://api.mwwondemand.com/api/line-items/647372455787562562/items"
}
},
"designs": {
"links": {
"self": "https://api.mwwondemand.com/api/line-items/647372455787562562/relationships/designs",
"related": "https://api.mwwondemand.com/api/line-items/647372455787562562/designs"
}
},
"line-item-count": {
"links": {
"self": "https://api.mwwondemand.com/api/line-items/647372455787562562/relationships/line-item-count",
"related": "https://api.mwwondemand.com/api/line-items/647372455787562562/line-item-count"
}
},
"order-shipments": {
"links": {
"self": "https://api.mwwondemand.com/api/line-items/647372455787562562/relationships/order-shipments",
"related": "https://api.mwwondemand.com/api/line-items/647372455787562562/order-shipments"
}
}
}
},
{
"id": "647772455569458650",
"type": "line-items",
"links": {
"self": "https://api.mwwondemand.com/api/line-items/647772455569458650"
},
"attributes": {
"created-at": "2016-10-25T18:08:38.015Z",
"updated-at": "2016-10-25T18:08:38.015Z",
"description": "It's not sò fluffy!",
"quantity": 2,
"state": "received",
"product-code": "MWW-PRODUCT-CODE",
"line-number": 1,
"po": "6477724553765206641477418918.02306",
"line-item-count": {
"line_item_id": 647772455569458650,
"received": 2,
"cancelled": 0,
"loom": 0,
"printed": 0,
"hold": 0,
"stretched": 0,
"pressed": 0,
"cut": 0,
"eton": 0,
"packed": 0,
"pillow_blow": 0,
"tentered": 0,
"quality_control": 0,
"sewn": 0,
"turned": 0,
"shipped": 0
},
"kit-data": [],
"co": null,
"tracking-numbers": []
},
"relationships": {
"items": {
"links": {
"self": "https://api.mwwondemand.com/api/line-items/647772455569458650/relationships/items",
"related": "https://api.mwwondemand.com/api/line-items/647772455569458650/items"
}
},
"designs": {
"links": {
"self": "https://api.mwwondemand.com/api/line-items/647772455569458650/relationships/designs",
"related": "https://api.mwwondemand.com/api/line-items/647772455569458650/designs"
}
},
"line-item-count": {
"links": {
"self": "https://api.mwwondemand.com/api/line-items/647772455569458650/relationships/line-item-count",
"related": "https://api.mwwondemand.com/api/line-items/647772455569458650/line-item-count"
}
},
"order-shipments": {
"links": {
"self": "https://api.mwwondemand.com/api/line-items/647772455569458650/relationships/order-shipments",
"related": "https://api.mwwondemand.com/api/line-items/647772455569458650/order-shipments"
}
}
}
}
],
"links": {
"first": "https://api.mwwondemand.com/api/orders/647772455376520664/line-items?page%5Blimit%5D=10&page%5Boffset%5D=0",
"last": "https://api.mwwondemand.com/api/orders/647772455376520664/line-items?page%5Blimit%5D=10&page%5Boffset%5D=0"
}
}
Get all line items in an order.
HTTPS Request
GET https://api.mwwondemand.com/api/orders/<MWW_ORDER_ID>/line-items
This endpoint includes line item details for all items in an order, status info, and for items that are shipped - tracking numbers are available.
A LineItem resource has an tracking-numbers
attribute which is an array of
numbers for tracking the shipment(s).
GET LineItems by id
Get details for a specific line item by ID.
HTTPS Request
curl -X "GET" "https://api.mwwondemand.com/api/line-items/764805840312993036" \
-H "Accept: application/vnd.api+json;version=1" \
-H "Authorization: auth-key=YOUR_API_KEY" \
-H "Content-Type: application/vnd.api+json"
require 'net/http'
# Get All Orders (GET )
def send_request
uri = URI.parse('https://api.mwwondemand.com/api/line-items/764805840312993036')
# Create client
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
# Create Request
req = Net::HTTP::Get.new(uri)
# Add headers
req["Accept"] = "application/vnd.api+json; version=1"
# Add headers
req.add_field "Authorization", "auth-key=YOUR_API_KEY"
# Add headers
req["Content-Type"] = "application/vnd.api+json"
# Fetch Request
res = http.request(req)
puts "Response HTTP Status Code: #{res.code}"
puts "Response HTTP Response Body: #{res.body}"
rescue StandardError => e
puts "HTTP Request failed (#{e.message})"
end
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
# Get Line Item
# GET https://api.mwwondemand.com/api/line_items/
try:
response = requests.get(
url="https://api.mwwondemand.com/api/line_items/764805840312993036",
headers={
"Authorization": "auth-key=YOUR_API_KEY",
"Accept": "application/vnd.api+json; version=1",
},
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class SendRequest4 {
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// Get All Orders (GET )
try {
// Create request
URL obj = new URL("https://api.mwwondemand.com/api/line-items/764805840312993036");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
// Add headers
con.setRequestProperty("Accept", "application/vnd.api+json; version=1");
con.setRequestProperty("Authorization", "auth-key=YOUR_API_KEY");
con.setRequestProperty("Content-Type", "application/vnd.api+json");
// Get response code (200 is good)
int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inLine;
StringBuffer response = new StringBuffer();
while ((inLine = in.readLine()) != null) {
response.append(inLine);
}
in.close();
//print result
System.out.println(response.toString());
}
catch (IOException e) { System.out.println(e); }
}
}
<?php
// Get cURL resource
$ch = curl_init();
// Set url
curl_setopt($ch, CURLOPT_URL, 'https://api.mwwondemand.com/api/line-items/764805840312993036');
// Set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
// Set options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: auth-key=YOUR_API_KEY",
"Accept: application/vnd.api+json; version=1",
]
);
// Send the request & save response to $resp
$resp = curl_exec($ch);
if(!$resp) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
} else {
echo "Response HTTP Status Code : " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "\nResponse HTTP Body : " . $resp;
}
// Close request to clear up some resources
curl_close($ch);
The above command returns JSON structured like this:
{
"data":{
"id":"764805840312993036",
"type":"line-items",
"links":{
"self":"https://api.mwwondemand.com/api/line-items/764805840312993036"
},
"attributes":{
"created-at":"2017-04-05T05:18:22.573Z",
"updated-at":"2017-04-06T21:42:15.562Z",
"description":"Carry-All Pouch / Set of 3",
"quantity":1,
"state":"shipped",
"state-events":[
],
"order-id":"764805828787045582",
"product-code":"MWW-PRODUCT-CODE",
"customer-product-code":"YOUR_UPC/SKU_NUMBER",
"line-number":4,
"item-properties":{
"label":"PENCIL POUCH SPUN POLY",
"fabric":"PFP POLY SILKY SLUB 61IN",
"weight":0.25,
"law_tag":{
"con_safety":"FOR CONSUMER PRODUCT SAFETY INFORMATION. PLEASE VISIT",
"label_size":"9.5X6in 24.13X15.24cm",
"french_back":"100% POLYESTER",
"french_care":"NETTOYER LES TACHES OU PEUVENT ÊTRE NETTOYÉS À SEC",
"french_fill":"100% FIBRES DE POLYESTER",
"french_made":"FABRIQUÉ AUX E.-U.",
"english_back":"100% POLYESTER",
"english_care":"DRY OR SPOT CLEAN ONLY",
"english_fill":"100% POLYESTER FIBER",
"english_made":"MADE IN USA",
"spanish_back":"100% POLIESTER",
"spanish_care":"LIMPIEZA DE ÁREAS SUCIAS O PUEDE LIMPIARSE EN SECO",
"spanish_fill":"100% FIBRA DE POLIESTER",
"spanish_made":"HECHO EN E.U.A",
"english_front":"100% POLYESTER",
"spanish_front":"100% POLIESTER",
"label_description":"GEN -DYE ZIP PENCIL POUCH ",
"con_safety_website":"https://67.32.50.6/CSPC/defult.aspx",
"federal_registration_number":"FEDERAL RN# 90630 ONT. REG.# 34333"
},
"eton_flow":83,
"dimensions":{
"width":11.5,
"height":14.0,
"measurement":null
},
"resolution":150,
"flow_number":2,
"state_machine":[
{
"on":"print_it",
"received":"printed"
},
{
"on":"press_it",
"printed":"pressed"
},
{
"on":"cut_it",
"pressed":"cut"
},
{
"on":"sew_it",
"cut":"sewn"
},
{
"on":"pack_it",
"sewn":"packed"
}
],
"print_environment":"op130328-{0}-JV33-PP14-EJ-4C-JC2-6248-540x720v"
},
"design-urls":[
{
"original":"/system/designs/764/805/843/181/896/991/original/764805843181896991.jpg?1491370890",
"thumb":"/system/designs/764/805/843/181/896/991/thumb/764805843181896991.png?1491370890",
"medium":"/system/designs/764/805/843/181/896/991/medium/764805843181896991.png?1491370890"
}
],
"po":"SOC040517000138",
"co":"CDS-04051701134",
"line-item-count":{
"line_item_id":764805840312993036,
"received":0,
"cancelled":0,
"loom":0,
"printed":0,
"hold":0,
"stretched":0,
"pressed":0,
"cut":0,
"eton":0,
"packed":0,
"pillow_blow":0,
"tentered":0,
"quality_control":0,
"sewn":0,
"turned":0,
"shipped":1
},
"kit-data":[
],
"tracking-numbers":[
"44335442-5331554"
]
},
"relationships":{
"items":{
"links":{
"self":"https://api.mwwondemand.com/api/line-items/764805840312993036/relationships/items",
"related":"https://api.mwwondemand.com/api/line-items/764805840312993036/items"
}
},
"order":{
"links":{
"self":"https://api.mwwondemand.com/api/line-items/764805840312993036/relationships/order",
"related":"https://api.mwwondemand.com/api/line-items/764805840312993036/order"
}
},
"line-item-count":{
"links":{
"self":"https://api.mwwondemand.com/api/line-items/764805840312993036/relationships/line-item-count",
"related":"https://api.mwwondemand.com/api/line-items/764805840312993036/line-item-count"
}
}
}
}
}
GET https://api.mwwondemand.com/api/line-items/<MWW_LINE_ITEM_ID>
This endpoint includes line item details with status info;
for items that are shipped - tracking numbers are available. See the
tracking-numbers
attribute for available shipment(s).
Shipping Address
Update Address
curl -X PATCH https://api.mwwondemand.com/api/shipping-addresses/1674068325472142392 \
-d '{
"data": {
"id": "1674068325472142392",
"type": "shipping-addresses",
"attributes": {
"name": "Test User",
"address1": "5757 Howard Gap Rd.",
"address2": "",
"city": "Hendersonville",
"state": "NC",
"postal-code": 28792,
"country": "US",
"phone": "555-555-5555",
"email": "user@mwwwondemand.com"
}
}
}' \
-H "Content-Type: application/vnd.api+json" \
-H "Accept: application/vnd.api+json; version=1" \
-H "Authorization: auth-key=YOUR_API_KEY"
require 'net/http'
# Update Shipping Address (PATCH)
def send_request
shipping_address_id = "1674068325472142392"
uri = URI("https://api.mwwondemand.com/api/shipping-addresses/#{shipping_address_id}")
# Create client
http = Net::HTTP.new(uri.host, uri.port)
# Create Request
#http.use_ssl = true
req = Net::HTTP::Post.new(uri)
# Add headers
req["Accept"] = "application/vnd.api+json; version=1"
# Add headers
req.add_field "Authorization", "auth-key=YOUR_API_KEY"
# Add headers
req["Content-Type"] = "application/vnd.api+json"
# Set body
req.body = '{
"data": {
"id": "1674068325472142392",
"type": "shipping-addresses",
"attributes": {
"name": "Test User",
"address1": "5757 Howard Gap Rd.",
"address2": "",
"city": "Hendersonville",
"state": "NC",
"postal-code": 28792,
"country": "US",
"phone": "555-555-5555",
"email": "user@mwwwondemand.com"
}
}
}'
# Fetch Request
res = http.request(req)
puts "Response HTTP Status Code: #{res.code}"
puts "Response HTTP Response Body: #{res.body}"
rescue StandardError => e
puts "HTTP Request failed (#{e.message})"
end
# Install the Python Requests library:
# `pip install requests`
import requests
def send_request():
# Update Shipping Address
# PATCH https://api.mwwondemand.com/api/shipping-addresses/:id
try:
response = requests.post(
url="https://api.mwwondemand.com/api/shipping-addresses/1674068325472142392",
headers={
"Content-Type": "application/vnd.api+json",
"Authorization": "auth-key=YOUR_API_KEY",
"Accept": "application/vnd.api+json; version=1",
},
data=
"""{
"data": {
"id": "1674068325472142392",
"type": "shipping-addresses",
"attributes": {
"name": "Test User",
"address1": "5757 Howard Gap Rd.",
"address2": "",
"city": "Hendersonville",
"state": "NC",
"postal-code": 28792,
"country": "US",
"phone": "555-555-5555",
"email": "user@mwwwondemand.com"
}
},
}"""
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException as e:
print(e)
<?php
// Get cURL resource
$ch = curl_init();
// Set url
curl_setopt($ch, CURLOPT_URL, 'https://api.mwwondemand.com/api/shipping-addresses/1674068325472142392');
// Set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
// Set options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Set headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/vnd.api+json",
"Authorization: auth-key=YOUR_API_KEY",
"Accept: application/vnd.api+json; version=1",
]
);
// Create body
$body = '{"data": {
"id": "1674068325472142392",
"type": "shipping-addresses",
"attributes": {
"name": "Test User",
"address1": "5757 Howard Gap Rd.",
"address2": "",
"city": "Hendersonville",
"state": "NC",
"postal-code": 28792,
"country": "US",
"phone": "555-555-5555",
"email": "user@mwwwondemand.com"
}
}
}';
// Set body
curl_setopt($ch, CURLOPT_PATCH, 1);
curl_setopt($ch, CURLOPT_PATCHFIELDS, $body);
// Send the request & save response to $resp
$resp = curl_exec($ch);
if(!$resp) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
} else {
echo "Response HTTP Status Code : " . curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "\nResponse HTTP Body : " . $resp;
}
// Close request to clear up some resources
curl_close($ch);
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.DataOutputStream;
public class SubmitOrder {
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// Update Shipping Address (PATCH)
try {
// Create request
URL obj = new URL("https://api.mwwondemand.com/api/shipping-addresses/1674068325472142392");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
// // Add headers
con.setRequestProperty("Accept", "application/vnd.api+json; version=1");
con.setRequestProperty("Authorization", "auth-key=YOUR_API_KEY");
con.setRequestProperty("Content-Type", "application/vnd.api+json");
// Add body
String urlParams = "{"+
"\"data\": {"+
"\"type\": \"shipping-addresses\","+
"\"attributes\":"+
"{"+
"\"name\": \"Test User\","+
"\"address1\": \"5757 Howard Gap Rd.\","+
"\"address2\": \"\","+
"\"city\": \"Hendersonville","+
"\"state\": \"NV\","+
"\"country\": \"US\","+
"\"postal-code\": \"28792\","+
"\"email\": \"user@mwwondemand.com\","+
"\"phone\": \"555-555-5555\""+
"}"+
"},"+
"}";
System.out.println(urlParams);
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.write(urlParams.getBytes("UTF-8"));
wr.flush();
wr.close();
int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);
System.out.println("POST Response Message : " + con.getResponseMessage());
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream(), "UTF-8"));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
//print result
System.out.println(response.toString());
} catch (IOException e) {
System.out.println(e);
}
}
}
The above command returns JSON structured like this:
{
"data": {
"id": "1674068325472142392",
"type": "shipping-addresses",
"attributes": {
"name": "Test User",
"address1": "5757 Howard Gap Rd.",
"address2": "",
"city": "Hendersonville",
"state": "NC",
"postal_code": 28792,
"country": "US",
"phone": "555-555-5555",
"email": "user@mwwwondemand.com"
}
}
}
This endpoint will update a shipping address from an existing order.
HTTPS Request
PATCH https://api.mwwondemand.com/api/shipping-addresses/<YOUR_PO>
PATCH Parameters
Shipping Address Details
Attributes | |
---|---|
data object |
The root element of your JSON post object. |
id string |
The ID of the shipping address. |
type string |
Resource the object represents. This will be "shipping-addresses". |
attributes object |
The object that contains all the pertanent information about the shipping address. |
name string |
The name to reference the shipment details. |
address1 string |
First line of the address |
address2 string (optional) |
Second line of the address |
city string |
The city of the shipment. |
state string |
Two letter ISO 3166 alpha 2 code of the destination state, ie "NC". |
country string (optional) |
Two letter ISO 3166 alpha 2 code of the destination country, ie "US". (Defaults to U.S. if not provided) |
postal-code string |
The postal code of the shipment. |
phone string (optional) |
Phone number associated with address |
email string (optional) |
Email associated with address |
Web Hooks
# Notification for received event
{
"data": {
"id": "501323962228147713",
"type": "mwwondemand-order-notifications",
"attributes": {
"event": "received",
"title": "Order Received",
"description": "You have a webhook notice",
"timestamp": "2016-04-06T16:41:36.895Z",
"tracking-numbers": [
"1Z999AA10123456784"
]
},
"relationships": {
"mwwondemand-order": {
"data": {
"id": "YOUR-ID-HERE",
"type": "mwwondemand-orders"
}
},
"mwwondemand-order-items": {
"data": [
{
"id": "501323961934546431",
"type": "mwwondemand-order-items"
}
]
}
}
},
"included": {
"mwwondemand-orders": [
{
"id": "YOUR-ID-HERE",
"type": "mwwondemand-orders",
"attributes": {
"vendor-po": "YOUR-ID-HERE",
"state": "received"
}
}
],
"mwwondemand-order-items": [
{
"id": "501323961934546431",
"type": "mwwondemand-order-items",
"attributes": {
"state": "received",
"product-code": "MWW-PRODUCT-CODE",
"line-number": 1,
"quantity": 1
},
"meta": {
"received": 1,
"not-valid": 0,
"shipped": 0,
"cancelled": 0,
"printed": 0,
"pressed": 0,
"cut": 0,
"sewn": 0,
"turned": 0,
"packed": 0
}
}
]
},
"links": {
"callback": "https://api.mwwondemand.com/mwwondemand-orders",
"mwwondemand-api": "https://api.mwwondemand.com",
"webhook": "https://api.mwwondemand.com/webhooks/501323961246680573"
},
"meta": {
"mwwondemand-api": {
"version": 1
}
},
"jsonapi": {
"version": "1.0"
}
}
# Notification for shipped order
{
"data": {
"id": "501323962228147713",
"type": "mwwondemand-order-notifications",
"attributes": {
"event": "Shipped",
"title": "Order Shipped",
"description": "You have a webhook notice",
"timestamp": "2016-04-06T16:41:36.895Z",
"tracking-numbers": [
"1Z999AA10123456784"
]
},
"relationships": {
"mwwondemand-order": {
"data": {
"id": "YOUR-ID-HERE",
"type": "mwwondemand-orders"
}
},
"mwwondemand-order-items": {
"data": [
{
"id": "501323961934546431",
"type": "mwwondemand-order-items"
}
]
}
}
},
"included": {
"mwwondemand-orders": [
{
"id": "YOUR-ID-HERE",
"type": "mwwondemand-orders",
"attributes": {
"vendor-po": "YOUR-ID-HERE",
"state": "received"
}
}
],
"mwwondemand-order-items": [
{
"id": "501323961934546431",
"type": "mwwondemand-order-items",
"attributes": {
"state": "received",
"product-code": "MWW-PRODUCT-CODE",
"line-number": 1,
"quantity": 1
},
"meta": {
"received": 1,
"not-valid": 0,
"shipped": 0,
"cancelled": 0,
"printed": 0,
"pressed": 0,
"cut": 0,
"sewn": 0,
"turned": 0,
"packed": 0
}
}
]
},
"links": {
"callback": "https://api.mwwondemand.com/mwwondemand-orders",
"mwwondemand-api": "https://api.mwwondemand.com",
"webhook": "https://api.mwwondemand.com/webhooks/501323961246680573"
},
"meta": {
"mwwondemand-api": {
"version": 1
}
},
"jsonapi": {
"version": "1.0"
}
}
Based on your opt-in preferences for various events, the API will POST back to your Web Hook URL. The web hook url and settings are available in your profile, see the https://api.mwwondemand.com/account/ page.
The url
(string) must be a valid URL (an API endpoint you host) and the
enabled
(boolean) setting must be checked.
First login, then visit https://api.mwwondemand.com/account/user/webhooks to edit your Web Hooks (opt-in) preferences.
- The
enabled
checkbox must bechecked
in order to receive POST notifications. - Check the various events that you would like to receive notifications for.
Events for Orders | ||
---|---|---|
Attributes | |
---|---|
data object |
The root element of your JSON post object. |
type string |
Resource the object represents. |
attributes object |
The object that contains all the pertanent information about the order. |
timestamp string |
Time order was shipped/recieved. |
tracking-numbers object |
Array of tracking numbers for your order |
enabled boolean |
Pause notifications by setting false. |
meta object |
Array of status of all items in your order. |
received int |
Number of recieved items |
shipped int |
Number of shipped items |
cancelled int |
Number of cancelled items |
printed int |
Number of printed items |
pressed int |
Number of pressed items |
cut int |
Number of cut items |
sewn int |
Number of sewn items |
turned int |
Number of turned items |
packed int |
Number of packed items |
To the right is an example JSON payload for a POST notification sent after an order is received.
Errors
The MWW API relies on the following error conditions:
UnauthorizedError
Error Code | Meaning |
---|---|
401 | UNAUTHORIZED |
Title
'Authorized Users Only'
Description
The requestor is unauthorized to act on the requested resource.
ProductCodeError
Error Code | Meaning |
---|---|
100 | VALIDATION_ERROR |
Title
'Product code not valid.'
Description
The product code is incorrect, see the line number indicated in your order.
UpdateShippingAddressError
Error Code | Meaning |
---|---|
422 | UNPROCESSABLE_ENTITY |
Title
'Cannot update shipping address'
Description
The order has already shipped. It is no longer possible to change the shipping address for this order.
Notes
'The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity, and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.'
https://tools.ietf.org/html/rfc4918#section-11.2
MissingShippingAddressError
Error Code | Meaning |
---|---|
422 | UNPROCESSABLE_ENTITY |
Title
'Shipping address is required'
Description
The order is missing a shipping address. A shipping request is required to submit an order.
Notes
'The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity, and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.'
https://tools.ietf.org/html/rfc4918#section-11.2
InvalidOrderFormatError
Error Code | Meaning |
---|---|
422 | UNPROCESSABLE_ENTITY |
Title
'Invalid Order Format'
Description
Please ensure that the item designs are an array
Notes
'The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity, and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.'
https://tools.ietf.org/html/rfc4918#section-11.2
InvalidShippingAddressError
Error Code | Meaning |
---|---|
422 | UNPROCESSABLE_ENTITY |
Title
'Invalid Shipping Address'
Description
Please ensure that a valid shipping address is provided.
Notes
'The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity, and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.'
https://tools.ietf.org/html/rfc4918#section-11.2
IncompleteShippingAddressError
Error Code | Meaning |
---|---|
422 | UNPROCESSABLE_ENTITY |
Title
'Incomplete Shipping Address'
Description
Please ensure that all fields for the shipping address were provided
Notes
'The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity, and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.'
https://tools.ietf.org/html/rfc4918#section-11.2
LineItemQuantityError
Error Code | Meaning |
---|---|
422 | UNPROCESSABLE_ENTITY |
Title
'Line Item Quantity not valid'
Description
Cannot have a quantity of (insert_quantity_here), see respective line number of your order.
Notes
'The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity, and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.'
https://tools.ietf.org/html/rfc4918#section-11.2
LineItemLineNumberError
Error Code | Meaning |
---|---|
422 | UNPROCESSABLE_ENTITY |
Title
'Line Item Line Number not valid'
Description
The line number must be less than or equal to 9999 and unique to the order.
Notes
'The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity, and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.'
https://tools.ietf.org/html/rfc4918#section-11.2
DuplicateVendorPoError
Error Code | Meaning |
---|---|
422 | UNPROCESSABLE_ENTITY |
Title
'Vendor Po must be unique'
Description
The provided vendor PO has already been submitted for this user. Vendor PO must be unique.
Notes
'The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity, and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.'
https://tools.ietf.org/html/rfc4918#section-11.2
FutureShipDateError
Error Code | Meaning |
---|---|
422 | UNPROCESSABLE_ENTITY |
Title
'Future Ship Date not valid'
Description
Future Ship Date: The ship date provided is before the current date.
Notes
'The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity, and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.'
https://tools.ietf.org/html/rfc4918#section-11.2
InternalServerError
Error Code | Meaning |
---|---|
500 | INTERNAL_SERVER_ERROR |
Title
'Internal Server Error'
Description
This is a standard HTTP error
Notes 'The server encountered an unexpected condition which prevented it from fulfilling the request.'
https://tools.ietf.org/html/rfc2616#section-10.5.1
Credits
This MWW API documentation page was created with Slate. Feel free to edit it and use it as a base for your own API's documentation.