update_order

PUT https://api.bootic.net/v1/shops/{shop_id}/orders/{code}

Use this relation to update an existing order for a given shop. Only orders in the checkout state can be updated.

This relation is available only for shops owned by your current scope and credentials (required scope: admin).

This endpoint is in early development and might change in the future.
Consider this a BETA feature.
$ curl -XPUT -H'Accept:application/json' -H'Content-Type:application/json' -H "Authorization: Bearer xxxx" -i https://api.bootic.net/v1/shops/:shop_id/orders/:code -d[REQUEST_BODY]

Request body

{
  "line_items": [
    {
      "variant_id": 1234,
      "units": 3
    },
    {
      "variant_id": 3222,
      "units": 1
    }
  ],
  "contact": {
    "email": "joe@bloggs.com",
    "name": "Joe Bloggs",
    "phone_number": "12322222222"
  },
  "address": {
    "id": 35666
  }
}
line_items
Array of objects with variant_id and units. Variant must exist in shop. Optional.
contact
Full contact data, or just email if contact already exists in shop. Optional.
address
Object with address id. It will copy address attributes by passed id. Optional.
Status: 200 OK
Content-Type: application/json; charset=utf-8
Connection: keep-alive
ETag: "0728e2965bd03e20a7f1c33add2f8775"
Last-Modified: Fri, 20 Jun 2014 22:34:14 GMT
Cache-Control: must-revalidate, private, max-age=0
Date: Wed, 31 Jul 2013 21:11:52 GMT
X-OAuth-Scopes: admin
{
  "_links": {
    "self": {
      "href": "https://api.bootic.net/v1/shops/10/orders/R1C3964"
    },
    "btc:update_order": {
      "href": "https://api.bootic.net/v1/shops/10/orders/R1C3964",
      "method": "put"
    },
    "btc:web_cart": {
      "href": "http://www.acme.com/cart/R1C3964",
      "type": "text/html"
    },
    "btc:web_checkout": {
      "href": "https://checkout.bootic.net/orders/R1C3964",
      "type": "text/html"
    }
  },
  "id": 583085,
  "shop_id": 29,
  "code": "R1C3964",
  "status": "checkout",
  "net_total": 29990,
  "total": 33704,
  "created_on": "2013-10-19T11:06:18.000Z",
  "updated_on": "2013-10-19T11:20:14.000Z",
  "pending_on": null,
  "closed_on": null,
  "shipped_on": null,
  "shipping_total": 3714,
  "shipping_description": "",
  "discount_total": 100,
  "tracking_code": null,
  "courier_name": null,
  "shipped_email_sent": false,
  "closed_email_sent": false,
  "fulfillment": {
    "fulfillment_method": "shipping"
  },
  "payment_info": {
    "name": "Webpay",
    "type": "webpay",
    "data": {
      "tbk_numero_cuotas": 1,
      "tbk_codigo_autorizacion": "abc",
      "tbk_id_transaccion": 3222,
      "tbk_tipo_pago": "VD"
    }
  },
  "_embedded": {
    "address": {
      "street": "Av. Brasil 20",
      "street_2": "4to piso",
      "locality_name": "Valparaiso",
      "region_name": "Valparaiso",
      "country_name": "Chile",
      "postal_code": null,
      "country_code": "CL"
    },
    "contact": {
      "name": "Joe Bloggs",
      "email": "joe@bloggs.com",
      "phone_number": "12322222222"
    },
    "promotion": {
      "name": "Summer discount",
      "discount": 100,
      "discount_type": "$",
      "free_shipping": false
    },
    "discounts": [

    ],
    "line_items": [
      {
        "_links": {
          "product": {
            "href": "https://api.bootic.net/v1/shops/29/products/130924-tinto"
          }
        },
        "product_id": 31166,
        "product_title": "130924 Tinto",
        "unit_price": 29990,
        "units": 3,
        "discount_total": 100,
        "net_total": 89970,
        "total": 89870,
        "product_weight_in_grams": 1400,
        "variant_id": 1234,
        "variant_title": "39",
        "variant_sku": "SXDD3",
        "requested_units": 3,
        "_embedded": {
          "discounts": [
            {
              "class": [
                "discount"
              ],
              "amount": 100,
              "description": "Super offer!"
            }
          ],
          "image": {
            "class": [
              "image",
              "asset"
            ],
            "links": {
              "thumbnail": {
                "href": "http://cdn.bootic.net/29/thumbnail/73763-_MG_4360.JPG"
              },
              "small": {
                "href": "http://cdn.bootic.net/29/small/73763-_MG_4360.JPG"
              },
              "medium": {
                "href": "http://cdn.bootic.net/29/medium/73763-_MG_4360.JPG"
              },
              "large": {
                "href": "http://cdn.bootic.net/29/large/73763-_MG_4360.JPG"
              },
              "original": {
                "href": "http://cdn.bootic.net/29/original/73763-_MG_4360.JPG"
              }
            },
            "file_name": "_MG_4360.JPG",
            "title": ""
          }
        }
      }
    ]
  }
}

The returned order entity includes a btc:web_checkout link relation that points to Bootic’s checkout web checkout pages, where a human user can complete and pay for the order.

There’s also a btc:web_cart link that will direct the user to the web shopping cart where the user can continue to modify the cart by adding or removing products, as well as proceed to the checkout phase and finalize the order.

Invalid response

Status: 422 Unprocessable Entity
Content-Type: application/json; charset=utf-8
Connection: keep-alive
ETag: "0728e2965bd03e20a7f1c33add2f8775"
Last-Modified: Fri, 20 Jun 2014 22:34:14 GMT
Cache-Control: must-revalidate, private, max-age=0
Date: Wed, 31 Jul 2013 21:11:52 GMT
X-OAuth-Scopes: admin
{
  "_class": [
    "errors"
  ],
  "_embedded": {
    "errors": [
      {
        "_class": [
          "error"
        ],
        "field": "variant.id",
        "messages": [
          "Variant 32222 does not exist in this shop"
        ]
      }
    ]
  }
}

Examples

Contact information will be looked up by email, so you can pass that field alone and your new order will re-use the existing contact.

{
  "contact": {
    "email": "joe@bloggs.com"
  },
  "line_items": [
    {
      "variant_id": 1233,
      "units": 1
    }
  ]
}

Passing more contact attributes for an existing email will update contact information for that contact, including other orders that share it.

{
  "contact": {
    "email": "joe@bloggs.com",
    "name": "New Name"
  },
  "line_items": [
    {
      "variant_id": 1233,
      "units": 1
    }
  ]
}

If the email is not found, a new contact will be created. New contacts require email, phone_number and name attributes.

{
  "contact": {
    "email": "joe@bloggs.com",
    "name": "New Name",
    "phone_number": "1244333333"
  },
  "line_items": [
    {
      "variant_id": 1233,
      "units": 1
    }
  ]
}

Adding or updating line items, by variant id.

{
  "line_items": [
    {
      "variant_id": 1233,
      "units": 1
    }
  ]
}

Remove existing line items by passing -1 units.

{
  "line_items": [
    {
      "variant_id": 1233,
      "units": -1
    }
  ]
}

See create_order

Guides