Excel VBA API GET请求

我已经在VBA中做了一个GET请求,并且能够将返回数据的第一次迭代parsing到Excel表格中。 但是它不会开始第二次迭代。

更多信息:我正在使用Shopify API获取所有订单。 在邮差,我可以看到不同的订单(600 +)总共多个logging。 我可以从第一个返回的订单parsing所需的所有信息,但是我无法循环到第二个。

我在这里使用VBA-JSON库: https : //github.com/VBA-tools/VBA-JSON

我已经发布了我的代码在下面…

我可以看到x是订单总数,但增量V并不能帮助我获得二阶信息。

Sub ShopifyOrderAPI_GET() Dim http As Object, str As Variant Set http = CreateObject("MSXML2.XMLHTTP") With http .Open "GET", "https://SHOPNAME.myshopify.com/admin/orders.json?status=any", False .Send str = Split(.responseText, "{""orders"": [ {") End With x = UBound(str) Dim JSON As Object Set JSON = JsonConverter.ParseJson(http.responseText) On Error Resume Next For Each V In x V = 1 Cells(V, 1) = JSON("orders")(1)("id") Cells(V, 2) = JSON("orders")(1)("email") Cells(V, 3) = JSON("orders")(1)("closed_at") Cells(V, 4) = JSON("orders")(1)("created_at") Cells(V, 5) = JSON("orders")(1)("updated_at") Cells(V, 6) = JSON("orders")(1)("number") Cells(V, 7) = JSON("orders")(1)("note") Cells(V, 8) = JSON("orders")(1)("token") Cells(V, 9) = JSON("orders")(1)("gateway") Cells(V, 10) = JSON("orders")(1)("total_price") Cells(V, 11) = JSON("orders")(1)("subtotal_price") Cells(V, 12) = JSON("orders")(1)("total_tax") Cells(V, 13) = JSON("orders")(1)("currency") Cells(V, 14) = JSON("orders")(1)("financial_status") Cells(V, 15) = JSON("orders")(1)("total_discounts") Cells(V, 16) = JSON("orders")(1)("total_line_items_price") Cells(V, 17) = JSON("orders")(1)("buyer_accepts_marketing") Cells(V, 18) = JSON("orders")(1)("name") Cells(V, 19) = JSON("orders")(1)("processed_at") Cells(V, 20) = JSON("orders")(1)("tags") Cells(V, 21) = JSON("orders")(1)("contact_email") Cells(V, 22) = JSON("orders")(1)("order_status_url") Cells(V, 23) = JSON("orders")(1)("discount_codes")(1)("code") Cells(V, 24) = JSON("orders")(1)("discount_codes")(1)("amount") Cells(V, 25) = JSON("orders")(1)("fulfillment_status") Cells(V, 26) = JSON("orders")(1)("tax_lines")(1)("title") Cells(V, 27) = JSON("orders")(1)("tax_lines")(1)("price") Cells(V, 28) = JSON("orders")(1)("tax_lines")(1)("rate") Cells(V, 29) = JSON("orders")(1)("tags") Cells(V, 30) = JSON("orders")(1)("line_items")(1)("title") Cells(V, 31) = JSON("orders")(1)("line_items")(1)("sku") Cells(V, 32) = JSON("orders")(1)("line_items")(1)("quantity") Cells(V, 33) = JSON("orders")(1)("line_items")(1)("price") Cells(V, 34) = JSON("orders")(1)("line_items")(1)("variant_title") Cells(V, 35) = JSON("orders")(1)("line_items")(1)("properties")(1)("name") Cells(V, 36) = JSON("orders")(1)("line_items")(1)("properties")(1)("value") ' Cells(V, 37) = JSON("orders")(1)("billing_address")(1)("name") ' Cells(V, 38) = JSON("orders")(1)("billing_address")(1)("address1") ' Cells(V, 39) = JSON("orders")(1)("billing_address")(1)("address2") ' Cells(V, 40) = JSON("orders")(1)("billing_address")(1)("city") ' Cells(V, 41) = JSON("orders")(1)("billing_address")(1)("zip") ' Cells(V, 42) = JSON("orders")(1)("billing_address")(1)("country") ' Cells(V, 43) = JSON("orders")(1)("billing_address")(1)("country_code") ' Cells(V, 44) = JSON("orders")(1)("billing_address")(1)("latitude") ' Cells(V, 45) = JSON("orders")(1)("billing_address")(1)("longitude") ' Cells(V, 46) = JSON("orders")(1)("shipping_address")(1)("name") ' Cells(V, 47) = JSON("orders")(1)("shipping_address")(1)("address1") ' Cells(V, 48) = JSON("orders")(1)("shipping_address")(1)("address2") ' Cells(V, 49) = JSON("orders")(1)("shipping_address")(1)("city") ' Cells(V, 50) = JSON("orders")(1)("shipping_address")(1)("zip") ' Cells(V, 51) = JSON("orders")(1)("shipping_address")(1)("country") ' Cells(V, 52) = JSON("orders")(1)("shipping_address")(1)("country_code") ' Cells(V, 53) = JSON("orders")(1)("shipping_address")(1)("latitude") ' Cells(V, 54) = JSON("orders")(1)("shipping_address")(1)("longitude") V = V + 1 Next V End Sub 

任何想法,我要去错了? 任何援助/指导,非常感谢。

这是我第一次在VBA中使用API​​。