Order Shipping Address - Hands-on Lab

Lesson 22 of 26 · 30 min

In this lab, you will:

  • Create an order with multiple shipping addresses
  • Update a shipping address
  • GET a Shipping Address
  • GET All Shipping Quotes

Prerequisites

  • BigCommerce store (sandbox or live)
  • Basic knowledge of APIs
  • REST client (Postman)

Create an Order with Multiple Shipping Addresses

  1. Copy and paste the request below into Postman:
https://api.bigcommerce.com/stores/{{store_hash}}/v2/orders
  1. Copy and paste the code below into the Body section of Postman
{
"products": [
{
"product_id": {product_id},
"quantity": 2
}
],
"billing_address": {
"first_name": "API",
"last_name": "Order",
"company": "",
"street_1": "123 Main Street",
"street_2": "",
"city": "Anywhere",
"state": "Some State",
"zip": "12345",
"country": "United States",
"country_iso2": "US",
"phone": "",
"email": "elsie@example.com"
},
"shipping_addresses": [
{
"first_name": "Trisha",
"last_name": "McLaughlin",
"company": "Acme Pty Ltd",
"street_1": "566 Sussex St",
"street_2": "",
"city": "Anywhere",
"state": "Some State",
"zip": "12345",
"country": "United States",
"country_iso2": "US",
"phone": "",
"email": "elsie@example.com"
},
{
"first_name": "Trish",
"last_name": "Test",
"company": "Acme Pty Ltd",
"street_1": "666 Sussex St",
"street_2": "",
"city": "Anywhere",
"state": "Some State",
"zip": "12345",
"country": "United States",
"country_iso2": "US",
"phone": "",
"email": "elsie@example.com"
}
],
"status_id": 11
}
  1. Replace {product_id} with the ID of a product in the store
  2. Select POST next to the request url
  3. Click the Send button
  4. Observe response

GET a Shipping Address

  1. Copy and paste the request below into Postman
https://api.bigcommerce.com/stores/{{store_hash}}/v2/orders/{order_id}/shipping_addresses
  1. Replace {order_id} with the ID of an order
  2. Select GET next to the request url
  3. Click the Send button
  4. Observe response and note shipping address ID

Update an Existing Shipping Address

  1. Copy and paste the request below into Postman
https://api.bigcommerce.com/stores/{{store_hash}}/v2/orders/{order_id}/shipping_addresses/{id}
  1. Replace {order_id} with the ID of the order created in the previous steps
  2. Copy and paste the code below into the Body section of Postman
{
"shipping_addresses": [
{
"id": {order_address_id},
"first_name": "Trishy",
"last_name": "Test",
"company": "Acme Pty Ltd",
"street_1": "666 Sussex St",
"street_2": "",
"city": "Anywhere",
"state": "Some State",
"zip": "12345",
"country": "United States",
"country_iso2": "US",
"phone": "",
"email": "elsie@example.com"
}
]
}
  1. Select PUT next to the request url
  2. Click the Send button
  3. Observe response and address updated

GET All Shipping Quotes

  1. Copy and paste the request below into Postman
https://api.bigcommerce.com/stores/{{store_hash}}/v2/orders/{order_id}/shipping_addresses/​{shipping_address_id}​/shipping_quotes
  1. Replace {order_id} with the ID of an order
  2. Replace {shipping_address_id} with the ID of the orders shipping address
  3. Select GET next to the request url
  4. Click the Send button
  5. Observe response