Sample code for 30+ languages & platforms
Xojo Plugin

Shippo List All Orders

See more Shippo Examples

Demonstrates how to list all orders created by sending a GET request to the orders endpoint.

Chilkat Xojo Plugin Downloads

Xojo Plugin
Dim success As Boolean
success = False

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Dim http As New Chilkat.Http

// Implements the following CURL command:

// curl https://api.goshippo.com/orders/ \
//     -H "Authorization: ShippoToken <API_Token>"

http.SetRequestHeader "Authorization","ShippoToken <API_Token>"

Dim sbResponseBody As New Chilkat.StringBuilder
success = http.QuickGetSb("https://api.goshippo.com/orders/",sbResponseBody)
If (success = False) Then
    System.DebugLog(http.LastErrorText)
    Return
End If

Dim jResp As New Chilkat.JsonObject
success = jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = False

System.DebugLog("Response Body:")
System.DebugLog(jResp.Emit())

Dim respStatusCode As Int32
respStatusCode = http.LastStatus
System.DebugLog("Response Status Code = " + Str(respStatusCode))
If (respStatusCode >= 400) Then
    System.DebugLog("Response Header:")
    System.DebugLog(http.LastHeader)
    System.DebugLog("Failed.")
    Return
End If

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "count": 1382,
//   "next": "https://api.goshippo.com/orders/?page=2",
//   "previous": null,
//   "results": [
//     {
//       "object_id": "4f2bc588e4e5446cb3f9fdb7cd5e190b",
//       "object_owner": "shippotle@goshippo.com",
//       "order_number": "#1068",
//       "order_status": "PAID",
//       "placed_at": "2016-09-23T01:28:12Z",
//       "to_address": {
//         "object_created": "2016-09-23T01:38:56Z",
//         "object_updated": "2016-09-23T01:38:56Z",
//         "object_id": "d799c2679e644279b59fe661ac8fa488",
//         "object_owner": "shippotle@goshippo.com",
//         "is_complete": true,
//         "validation_results": {},
//         "name": "Mr Hippo",
//         "company": "Shippo",
//         "street1": "215 Clayton St.",
//         "street2": "",
//         "city": "San Francisco",
//         "state": "CA",
//         "zip": "94117",
//         "country": "US",
//         "phone": "15553419393",
//         "email": "shippotle@goshippo.com",
//         "is_residential": null,
//         "metadata": ""
//       },
//       "from_address": null,
//       "line_items": [
//         {
//           "object_id": "abf7d5675d744b6ea9fdb6f796b28f28",
//           "title": "Hippo Magazines",
//           "variant_title": "",
//           "sku": "HM-123",
//           "quantity": 1,
//           "total_price": "12.10",
//           "currency": "USD",
//           "weight": "0.40",
//           "weight_unit": "lb",
//           "manufacture_country": null,
//           "max_ship_time": null,
//           "max_delivery_time": null,
//           "description": null
//         }
//       ],
//       "shipping_cost": "12.83",
//       "shipping_cost_currency": "USD",
//       "shipping_method": "USPS First Class Package",
//       "shop_app": "Shippo",
//       "subtotal_price": "12.10",
//       "total_price": "24.93",
//       "total_tax": "0.00",
//       "currency": "USD",
//       "transactions": [
//       ],
//       "weight": "0.40",
//       "weight_unit": "lb",
//       "notes": null
//     },
//     ...
//   ]
// }

// Sample code for parsing the JSON response...
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON

Dim intVal As Int32
Dim j As Int32
Dim count_j As Int32
Dim object_id As String
Dim title As String
Dim variant_title As String
Dim sku As String
Dim quantity As Int32
Dim total_price As String
Dim currency As String
Dim weight As String
Dim weight_unit As String
Dim manufacture_country As String
Dim max_ship_time As String
Dim max_delivery_time As String
Dim description As String

Dim count As Int32
count = jResp.IntOf("count")
Dim next As String
next = jResp.StringOf("next")
Dim previous As String
previous = jResp.StringOf("previous")
Dim i As Int32
i = 0
Dim count_i As Int32
count_i = jResp.SizeOfArray("results")
While i < count_i
    jResp.I = i
    intVal = jResp.IntOf("results[i]")
    j = 0
    count_j = jResp.SizeOfArray("results[i].line_items")
    While j < count_j
        jResp.J = j
        object_id = jResp.StringOf("results[i].line_items[j].object_id")
        title = jResp.StringOf("results[i].line_items[j].title")
        variant_title = jResp.StringOf("results[i].line_items[j].variant_title")
        sku = jResp.StringOf("results[i].line_items[j].sku")
        quantity = jResp.IntOf("results[i].line_items[j].quantity")
        total_price = jResp.StringOf("results[i].line_items[j].total_price")
        currency = jResp.StringOf("results[i].line_items[j].currency")
        weight = jResp.StringOf("results[i].line_items[j].weight")
        weight_unit = jResp.StringOf("results[i].line_items[j].weight_unit")
        manufacture_country = jResp.StringOf("results[i].line_items[j].manufacture_country")
        max_ship_time = jResp.StringOf("results[i].line_items[j].max_ship_time")
        max_delivery_time = jResp.StringOf("results[i].line_items[j].max_delivery_time")
        description = jResp.StringOf("results[i].line_items[j].description")
        j = j + 1
    Wend
    j = 0
    count_j = jResp.SizeOfArray("results[i].transactions")
    While j < count_j
        jResp.J = j
        j = j + 1
    Wend
    i = i + 1
Wend