POST api/sandbox/batches

Submit a batch of orders.

Request Information

URI Parameters

None.

Body Parameters

batch
NameDescriptionTypeAdditional information
allow_partial

When set to false, in case of an order error the whole batch is rejected. When set to true, in case of an order error all orders without error are accepted.

boolean

Required

location

If not empty, the batch will be sent to the specified location (physical warehouse) instead of the pre-defined location ("FR", "LA", "LN", "YK", "EX" or "EU").

string

None.

orders

Array of orders. At least one order needs to be included in the batch. Maximum 1000 orders per batch.

Collection of order

Required

Request Formats

application/json, text/json

Sample:
{
  "allow_partial": true,
  "location": "FR",
  "orders": [
    {
      "order_number": "TESTAPI001",
      "account_number": "10501",
      "ordered_date": "2015-01-07",
      "freight_account": "00500",
      "shipping_carrier": "FEDEX",
      "shipping_service": "GROUND",
      "shipping_address": {
        "company": "DCL Corp",
        "attention": "Walter P.",
        "address1": "48641 Milmont drive",
        "city": "Fremont",
        "state_province": "CA",
        "postal_code": "94538",
        "country_code": "US"
      },
      "lines": [
        {
          "line_number": 1,
          "item_number": "1003-003-DEMO3",
          "description": "Demo Product 3",
          "quantity": 1
        }
      ]
    },
    {
      "order_status": 0,
      "order_number": "TESTAPI002",
      "account_number": "10501",
      "ordered_date": "2015-01-07",
      "po_number": "726362",
      "customer_number": "23",
      "acknowledgement_email": "user@mail.com",
      "freight_account": "00500",
      "shipping_carrier": "UPS",
      "shipping_service": "GROUND",
      "system_id": "P",
      "shipping_address": {
        "company": "DCL Corp",
        "attention": "Walter P.",
        "address1": "48641 Milmont drive",
        "phone": "000-000-0000",
        "city": "Fremont",
        "state_province": "CA",
        "postal_code": "94538",
        "country_code": "US"
      },
      "billing_address": {
        "company": "DCL Corp",
        "attention": "Walter P.",
        "address1": "48641 Milmont drive",
        "phone": "000-000-0000",
        "city": "Fremont",
        "state_province": "CA",
        "postal_code": "94538",
        "country_code": "US"
      },
      "international_code": 0,
      "order_subtotal": 10.00,
      "shipping_handling": 2.50,
      "sales_tax": 0.00,
      "international_handling": 0.00,
      "total_due": 0.00,
      "amount_paid": 0.00,
      "net_due_currency": 0.00,
      "balance_due_us": 0.00,
      "international_declared_value": 0.00,
      "insurance": 0.00,
      "payment_type": "",
      "terms": "",
      "fob": "",
      "packing_list_type": 0,
      "packing_list_comments": "",
      "shipping_instructions": "",
      "custom_field1": "ABC",
      "lines": [
        {
          "line_number": 1,
          "item_number": "1001-001-DEMO",
          "description": "Demo Product",
          "quantity": 4,
          "price": 2.00,
          "do_not_ship_before": "2015-01-08",
          "ship_by": "2015-01-09",
          "comments": "test",
          "custom_field2": "white"
        },
        {
          "line_number": 2,
          "item_number": "1002-002-DEMO2",
          "description": "Demo Product 2",
          "quantity": 6
        }
      ]
    }
  ]
}

Response Information

Resource Description

response_post_batches
NameDescriptionTypeAdditional information
error_code

Zero if no errors. When different from zero, the whole batch is rejected due to an error related to the batch, not to a single order. See 'error_message' for a detailed description of the error.

When 'allow_partial' is false and an order with error is detected, its error is mirrored to this field, since the whole batch has to fails; for performance reason, we also stop analyzing the following orders.

integer

None.

error_message

Returns a detailed description of the error.

string

None.

order_statuses

Array of response_order_status. Each element of the array returns the status of the order received with the batch, keeping the same sequence (element n in order_statuses returns the status of the order at position n in the orders array).

Collection of response_order_status

None.

Response Formats

application/json, text/json

Sample:
{
  "error_code": 0,
  "error_message": "",
  "order_statuses": [
    {
      "error_code": 0,
      "error_message": "",
      "order_number": "TEST001"
    },
    {
      "error_code": 4,
      "error_message": "'quantity' must be bigger than 0 [Order index = 1; order_number = 'TEST002'; Detail index = 0].",
      "order_number": "TEST002"
    }
  ]
}