Skip to content

Work

Version 1

Schema

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "title": "Barrett Distribution Centers, Inc. Work Order Schema",
    "description": "Version 1",
    "additionalProperties": false,
    "properties": {
        "customerId": {
            "type": "string"
        },
        "orderId": {
            "type": "string",
            "maxLength": 20,
            "pattern": "^[A-Za-z0-9\\-_. ]+$",
            "description": "At most 20 characters; send it in upper case. Barrett stores the id upper-cased and cut to 20 characters, and every later lookup by order id is an exact, case-sensitive match on that stored value."
        },
        "orderType": {
            "type": "string",
            "enum": [
                "work"
            ]
        },
        "orderStatus": {
            "type": "string"
        },
        "orderDirective": {
            "enum": [
                "hot",
                "shipShort",
                "specialHand",
                "normal",
                "backOrder",
                "scheduled",
                "dropShip",
                "exception",
                "repickSuggest",
                "hold",
                "noNotify",
                "discount",
                "routed",
                "sameDayShip",
                "edi",
                null
            ]
        },
        "facility": {
            "type": "string",
            "description": "Facility performing the build"
        },
        "tradingPartnerId": {
            "type": "string"
        },
        "purchaseOrder": {
            "type": "string",
            "maxLength": 20
        },
        "billTo": {
            "oneOf": [
                {
                    "$ref": "#/definitions/address"
                },
                {
                    "$ref": "#/definitions/addressId"
                }
            ],
            "description": "Accepted but not used"
        },
        "custom": {
            "$ref": "#/definitions/custom"
        },
        "item": {
            "$ref": "#/definitions/item"
        },
        "orderInstructions": {
            "type": "string"
        },
        "tags": {
            "type": "array",
            "items": {
                "type": "string"
            },
            "description": "Order tag ids; each must exist for the customer"
        }
    },
    "required": [
        "orderId",
        "orderType",
        "customerId",
        "item",
        "facility"
    ],
    "definitions": {
        "address": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "contactName": {
                    "type": "string"
                },
                "companyName": {
                    "type": "string"
                },
                "email": {
                    "type": "string",
                    "format": "email"
                },
                "streetOne": {
                    "type": "string"
                },
                "streetTwo": {
                    "type": "string"
                },
                "city": {
                    "type": "string"
                },
                "state": {
                    "type": "string"
                },
                "postalCode": {
                    "type": "string"
                },
                "country": {
                    "type": "string",
                    "description": "ISO 3166-1 alpha-2 or alpha-3 code"
                },
                "phone": {
                    "type": "string"
                }
            },
            "required": [
                "streetOne",
                "city"
            ],
            "anyOf": [
                {
                    "properties": {
                        "contactName": true
                    },
                    "required": [
                        "contactName"
                    ]
                },
                {
                    "properties": {
                        "companyName": true
                    },
                    "required": [
                        "companyName"
                    ]
                }
            ],
            "if": {
                "properties": {
                    "country": {
                        "enum": [
                            "US",
                            "USA",
                            "us",
                            "usa"
                        ]
                    }
                },
                "required": [
                    "country"
                ]
            },
            "then": {
                "properties": {
                    "state": true,
                    "postalCode": true
                },
                "required": [
                    "state",
                    "postalCode"
                ]
            }
        },
        "addressId": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "addressId": {
                    "type": "string"
                }
            },
            "required": [
                "addressId"
            ]
        },
        "custom": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "customStrings": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "$ref": "#/definitions/customString"
                    }
                },
                "customNumbers": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "$ref": "#/definitions/customNumber"
                    }
                },
                "customDates": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "$ref": "#/definitions/customDate"
                    }
                }
            },
            "anyOf": [
                {
                    "properties": {
                        "customStrings": true
                    },
                    "required": [
                        "customStrings"
                    ]
                },
                {
                    "properties": {
                        "customNumbers": true
                    },
                    "required": [
                        "customNumbers"
                    ]
                },
                {
                    "properties": {
                        "customDates": true
                    },
                    "required": [
                        "customDates"
                    ]
                }
            ]
        },
        "customString": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "name": {
                    "type": "string"
                },
                "value": {
                    "type": "string",
                    "maxLength": 255
                }
            },
            "required": [
                "name",
                "value"
            ]
        },
        "customNumber": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "name": {
                    "type": "string"
                },
                "value": {
                    "type": "number"
                }
            },
            "required": [
                "name",
                "value"
            ]
        },
        "customDate": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "name": {
                    "type": "string"
                },
                "value": {
                    "type": "string",
                    "format": "date"
                }
            },
            "required": [
                "name",
                "value"
            ]
        },
        "item": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "itemId": {
                    "type": "string"
                },
                "itemDescription": {
                    "type": "string"
                },
                "tradingPartnerItemId": {
                    "type": "string",
                    "maxLength": 20
                },
                "upc": {
                    "type": "string",
                    "maxLength": 20
                },
                "orderedQuantity": {
                    "type": "integer",
                    "minimum": 0
                },
                "orderedQuantityUom": {
                    "type": "string",
                    "enum": [
                        "EA",
                        "PR",
                        "INNR",
                        "BAGS",
                        "CS",
                        "CTN",
                        "CRAT",
                        "PLT"
                    ]
                },
                "lotNumber": {
                    "type": "string",
                    "maxLength": 30
                },
                "inventoryClass": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 2
                },
                "custom": {
                    "$ref": "#/definitions/custom"
                },
                "comment": {
                    "type": "string"
                }
            },
            "required": [
                "itemId",
                "orderedQuantity",
                "orderedQuantityUom"
            ]
        }
    }
}

Sample

{
    "customerId": "12345",
    "orderType": "work",
    "orderId": "WORK123",
    "purchaseOrder": "WORK123",
    "facility": "MEM",
    "item": {
      "itemId": "WX9536",
      "orderedQuantity": 5,
      "orderedQuantityUom": "EA"
    }
}

Railroad Diagrams

Note

Items in green represent the properties that Barrett requires. Items in blue represent optional properties that may be additionally sent by the customer.

Work

Item

Custom

Custom String

Custom Number

Custom Date