Adding Items to an Order

To add items to an order, send an HTTP POST or PUT request to the /orders/{ORDER_ID}/items endpoint. The following parameters are accepted by the item creation endpoint:

PARAMETER NAME TYPE REQUIRED DESCRIPTION
id String (Mongo ID) Yes The menu item ID to add to the order.
size String Yes The name of the “size” or “price” of the menu item to add. Refer to the menu item documentation. Basically, did the customer order a Small, Medium, or Large drink?
quantity Integer No How many of this particular item (with exact options) they want. Defaults to 1.
options Array of Options No (unless the menu item has required options) What options the customer wants on this menu item. If not provided, no options will be added.

How Do I Specify the Options?

The options array simply contains a list of objects that map the option group name to an array of options. All values are strings.

I Need an Example!

Here’s an example JSON object that you could POST to add an item to an order. In this case, the menu item ID is “abcd123…” and the customer wants Double Onions, Peppers, Sausage, and Provolone cheese. See how nice and readable the content is?

{
     "id" : "abcd123...",
     "size" : "Small",
     "quantity" : 1
     "options" : {
          "Veggies" : [ "Onions", "Peppers" ],
          "Meats" : [ "Sausage" ],
          "Cheese" : [ "Provolone" ]
     },
     "option_levels" : {
          "Veggies" : { "Onions": "double" }
     }
}

This should be sent via x-www-form-urlencoded content-type encoding, not JSON, we just felt like the JSON was easier to understand while reading. 

Here's an example of the encoded POST body that would be sent:

id=5386206131131cc222f77922&size=Small&quantity=1&notes=&options[Veggies][]=Onions&options[Veggies][]=Peppers&options[Meats][]=Sausage&options[Cheese][]=Provolone&option_levels[Veggies][Onions]=double

Hey, This Is Important!

When you add an item to an order, we generate a  new ID for it. So each item that has been added to an order will have a new Mongo-style ID string that you can reference if you need to remove that item from the order later.