Skip to content

How to create an order

The Brew Ha Ha API includes an endpoint that allows client applications to submit new orders to the database.

In this guide, you’ll make a POST request to the /orders/ endpoint to order a blueberry muffin.

Before you begin

Before you make a POST request, ensure that you have an access token. For instructions on requesting an access token, see Request a JSON Web Token.

Make a POST request

  1. Open a terminal and run the following command:

    post_order.sh
    {
    "payment_method": "Credit",
    "order_items": [
    {
    "product_id": 2,
    "quantity": 1
    }
    ]
    }

    The API returns a 201 CREATED and returns the details of your order:

    post_order_response.sh
    {
    "id": "13",
    "payment_method": "Credit",
    "order_date": "2025-01-11T03:17:47.746025Z",
    "status": "in progress",
    "order_items": [
    {
    "product_id": 2,
    "quantity": 1,
    "product_name": "blueberry muffin"
    }
    ]
    }

You can use the data from the POST request in your application. For example, you could display the order date and list of products to your users.

What to do next

See POST /orders/ for a full list of request parameters and response schemas.