Sample code for 30+ languages & platforms
Zig Requires Chilkat v11.0.0+

Ecwid - Search Orders

See more Ecwid Examples

Search or filter orders in an Ecwid store. The response provides full details of the found orders.

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main(init: std.process.Init) !void {
    const alloc = init.arena.allocator();

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

    const http = try chilkat.Http.init();
    defer http.deinit();

    // Implements the following CURL command:

    // curl --request GET \
    //      --url 'https://app.ecwid.com/api/v3/storeId/orders?token=token' \
    //      --header 'Accept: application/json'

    // Use the following online tool to generate HTTP code from a CURL command
    // Convert a cURL Command to HTTP Source Code

    // Load the access token previously obtained in Ecwid Get Access Token
    const json_token = try chilkat.JsonObject.init();
    defer json_token.deinit();
    json_token.loadFile("qa_data/tokens/ecwid.json") catch {};

    http.setRequestHeader("Accept", "application/json");

    const params = try chilkat.JsonObject.init();
    defer params.deinit();
    params.updateInt("limit", 100) catch {};
    params.updateString("email", "joe@example.com") catch {};
    params.updateString("token", try json_token.stringOf(alloc, "access_token")) catch {};

    const resp = try chilkat.HttpResponse.init();
    defer resp.deinit();
    http.httpParams("GET", "https://app.ecwid.com/api/v3/storeId/orders", params, resp) catch {
        std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
        return;
    };

    const sb_response_body = try chilkat.StringBuilder.init();
    defer sb_response_body.deinit();
    resp.getBodySb(sb_response_body) catch {};
    const j_resp = try chilkat.JsonObject.init();
    defer j_resp.deinit();
    j_resp.loadSb(sb_response_body) catch {};
    j_resp.setEmitCompact(false);

    std.debug.print("Response Body:\n", .{});
    std.debug.print("{s}\n", .{try j_resp.emit(alloc)});

    const resp_status_code = resp.getStatusCode();

    std.debug.print("Response Status Code = {d}\n", .{resp_status_code});
    if (resp_status_code != 200) {
        std.debug.print("Failed.\n", .{});
        return;
    }

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

    // {
    //   "total": 1,
    //   "count": 1,
    //   "offset": 0,
    //   "limit": 100,
    //   "items": [
    //     {
    //       "id": "XJ12H",
    //       "subtotal": 1076.64,
    //       "total": 2014.97,
    //       "giftCardRedemption": 2.23,
    //       "totalBeforeGiftCardRedemption": 2.23,
    //       "giftCardDoubleSpending": false,
    //       "usdTotal": 2014.97,
    //       "tax": 488.48,
    //       "paymentMethod": "Credit or debit card (Mollie)",
    //       "paymentStatus": "PARTIALLY_REFUNDED",
    //       "fulfillmentStatus": "DELIVERED",
    //       "vendorOrderNumber": "XJ12H",
    //       "orderNumber": 1082727626,
    //       "refererUrl": "https://mdemo.ecwid.com/",
    //       "globalReferer": "https://my.ecwid.com/",
    //       "createDate": "2018-05-31 15:08:36 +0000",
    //       "updateDate": "2018-05-31 15:09:35 +0000",
    //       "createTimestamp": 1527779316,
    //       "updateTimestamp": 1527779375,
    //       "hidden": false,
    //       "orderComments": "Test order comments",
    //       "privateAdminNotes": "Must be delivered till Sunday.",
    //       "email": "mscott@gmail.com",
    //       "ipAddress": "123.431.234.243",
    //       "customerId": 40201284,
    //       "customerGroupId": 12345,
    //       "customerGroup": "Gold",
    //       "customerTaxExempt": false,
    //       "customerTaxId": "",
    //       "customerTaxIdValid": false,
    //       "reversedTaxApplied": false,
    //       "discount": 4,
    //       "couponDiscount": 22,
    //       "volumeDiscount": 4,
    //       "membershipBasedDiscount": 0,
    //       "totalAndMembershipBasedDiscount": 0,
    //       "customDiscount": [
    //       ],
    //       "discountCoupon": {
    //         "id": 29567026,
    //         "name": "API Testing",
    //         "code": "APITESTING",
    //         "discountType": "ABS",
    //         "status": "ACTIVE",
    //         "discount": 22,
    //         "launchDate": "2018-05-24 20:00:00 +0000",
    //         "usesLimit": "UNLIMITED",
    //         "applicationLimit": "UNLIMITED",
    //         "creationDate": "2018-05-31 15:08:33 +0000",
    //         "updateDate": "2018-05-24 13:40:32 +0000",
    //         "orderCount": 0
    //       },
    //       "discountInfo": [
    //         {
    //           "value": 4,
    //           "type": "ABS",
    //           "base": "ON_TOTAL",
    //           "orderTotal": 1
    //         }
    //       ],
    //       "items": [
    //         {
    //           "id": 140273658,
    //           "productId": 66722487,
    //           "categoryId": 19563207,
    //           "price": 1060,
    //           "productPrice": 1000,
    //           "sku": "ABCA-IAC",
    //           "quantity": 1,
    //           "shortDescription": "",
    //           "tax": 331.01,
    //           "shipping": 0,
    //           "quantityInStock": 0,
    //           "name": "iMac",
    //           "isShippingRequired": true,
    //           "weight": 0,
    //           "trackQuantity": false,
    //           "fixedShippingRateOnly": false,
    //           "imageUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/391870914.jpg",
    //           "smallThumbnailUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/650638292.jpg",
    //           "hdThumbnailUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/650638293.jpg",
    //           "fixedShippingRate": 0,
    //           "digital": false,
    //           "couponApplied": true,
    //           "selectedOptions": [
    //             {
    //               "name": "Price-Optimizer",
    //               "value": "6",
    //               "valuesArray": [
    //                 "6"
    //               ],
    //               "selections": [
    //                 {
    //                   "selectionTitle": "6",
    //                   "selectionModifier": 6,
    //                   "selectionModifierType": "PERCENT"
    //                 }
    //               ],
    //               "type": "CHOICE"
    //             }
    //           ],
    //           "taxes": [
    //             {
    //               "name": "State tax",
    //               "value": 12,
    //               "total": 124.13,
    //               "taxOnDiscountedSubtotal": 124.13,
    //               "taxOnShipping": 0,
    //               "includeInPrice": false
    //             },
    //             {
    //               "name": "TVA",
    //               "value": 20,
    //               "total": 206.88,
    //               "taxOnDiscountedSubtotal": 206.88,
    //               "taxOnShipping": 0,
    //               "includeInPrice": true
    //             }
    //           ],
    //           "dimensions": {
    //             "length": 0,
    //             "width": 0,
    //             "height": 0
    //           },
    //           "couponAmount": 21.66,
    //           "discounts": [
    //             {
    //               "discountInfo": {
    //                 "value": 4,
    //                 "type": "ABS",
    //                 "base": "ON_TOTAL",
    //                 "orderTotal": 1
    //               },
    //               "total": 3.94
    //             }
    //           ]
    //         },
    //         {
    //           "id": 140273659,
    //           "productId": 66821181,
    //           "categoryId": 0,
    //           "price": 16.64,
    //           "productPrice": 16,
    //           "sku": "001001",
    //           "quantity": 1,
    //           "shortDescription": "This sturdy white, glossy ceramic mug is an essential to your cupboard. This brawny version of ceramic mugs shows it’s ...",
    //           "tax": 157.47,
    //           "shipping": 471.85,
    //           "quantityInStock": 0,
    //           "name": "Mug",
    //           "isShippingRequired": true,
    //           "weight": 0.4,
    //           "trackQuantity": false,
    //           "fixedShippingRateOnly": false,
    //           "imageUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/389900000.jpg",
    //           "smallThumbnailUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/475772545.jpg",
    //           "hdThumbnailUrl": "https://ecwid-images-ru.gcdn.co/images/5035009/408631478.jpg",
    //           "fixedShippingRate": 0,
    //           "digital": false,
    //           "couponApplied": true,
    //           "selectedOptions": [
    //             {
    //               "name": "Color",
    //               "value": "White",
    //               "valuesArray": [
    //                 "White"
    //               ],
    //               "selections": [
    //                 {
    //                   "selectionTitle": "White",
    //                   "selectionModifier": 0,
    //                   "selectionModifierType": "ABSOLUTE"
    //                 }
    //               ],
    //               "type": "CHOICE"
    //             },
    //             {
    //               "name": "Size",
    //               "value": "11oz",
    //               "valuesArray": [
    //                 "11oz"
    //               ],
    //               "selections": [
    //                 {
    //                   "selectionTitle": "11oz",
    //                   "selectionModifier": 0,
    //                   "selectionModifierType": "ABSOLUTE"
    //                 }
    //               ],
    //               "type": "CHOICE"
    //             },
    //             {
    //               "name": "Price-Optimizer",
    //               "value": "4",
    //               "valuesArray": [
    //                 "4"
    //               ],
    //               "selections": [
    //                 {
    //                   "selectionTitle": "4",
    //                   "selectionModifier": 4,
    //                   "selectionModifierType": "PERCENT"
    //                 }
    //               ],
    //               "type": "CHOICE"
    //             }
    //           ],
    //           "taxes": [
    //             {
    //               "name": "State tax",
    //               "value": 12,
    //               "total": 59.05,
    //               "taxOnDiscountedSubtotal": 1.95,
    //               "taxOnShipping": 57.1,
    //               "includeInPrice": false
    //             },
    //             {
    //               "name": "TVA",
    //               "value": 20,
    //               "total": 98.42,
    //               "taxOnDiscountedSubtotal": 3.25,
    //               "taxOnShipping": 95.17,
    //               "includeInPrice": true
    //             }
    //           ],
    //           "dimensions": {
    //             "length": 0,
    //             "width": 0,
    //             "height": 0
    //           },
    //           "couponAmount": 0.34,
    //           "discounts": [
    //             {
    //               "discountInfo": {
    //                 "value": 4,
    //                 "type": "ABS",
    //                 "base": "ON_TOTAL",
    //                 "orderTotal": 1
    //               },
    //               "total": 0.06
    //             }
    //           ]
    //         },
    //         {
    //           "subscriptionId": 123456,
    //           "recurringChargeSettings": {
    //             "recurringInterval": "month",
    //             "recurringIntervalCount": 1
    //           }
    //         }
    //       ],
    //       "refundedAmount": 3.5,
    //       "refunds": [
    //         {
    //           "date": "2017-09-12 10:12:56 +0000",
    //           "source": "CP",
    //           "reason": "Testing!",
    //           "amount": 3.5
    //         }
    //       ],
    //       "billingPerson": {
    //         "name": "Michael Scott",
    //         "companyName": "",
    //         "street": "555 Lackawanna Ave",
    //         "city": "Scranton",
    //         "countryCode": "US",
    //         "countryName": "United States",
    //         "postalCode": "18508",
    //         "stateOrProvinceCode": "PA",
    //         "stateOrProvinceName": "Pennsylvania",
    //         "phone": ""
    //       },
    //       "shippingPerson": {
    //         "name": "Michael Scott",
    //         "companyName": "",
    //         "street": "555 Lackawanna Ave",
    //         "city": "Scranton",
    //         "countryCode": "US",
    //         "countryName": "United States",
    //         "postalCode": "18508",
    //         "stateOrProvinceCode": "PA",
    //         "stateOrProvinceName": "Pennsylvania",
    //         "phone": ""
    //       },
    //       "shippingOption": {
    //         "shippingCarrierName": "Shipping app the-printful",
    //         "shippingMethodName": "USPS Priority Mail",
    //         "shippingRate": 471.85,
    //         "estimatedTransitTime": "1-3",
    //         "isPickup": false
    //       },
    //       "handlingFee": {
    //         "name": "Handling Fee",
    //         "value": 4,
    //         "description": ""
    //       },
    //       "predictedPackage": [
    //         {
    //           "length": 0,
    //           "width": 0,
    //           "height": 0,
    //           "weight": 0.4,
    //           "declaredValue": 1076.64
    //         }
    //       ],
    //       "shipments": [
    //         {
    //           "id": "5e79bd4f-9ebf-4ab8-b901-24c9b48b19eb",
    //           "created": "2020-04-23 19:13:43 +0000",
    //           "shipTo": {
    //             "name": "Michael Scott",
    //             "companyName": "",
    //             "street": "555 Lackawanna Ave",
    //             "city": "Scranton",
    //             "countryCode": "US",
    //             "countryName": "United States",
    //             "postalCode": "18508",
    //             "stateOrProvinceCode": "PA",
    //             "stateOrProvinceName": "Pennsylvania",
    //             "phone": ""
    //           },
    //           "shipFrom": {
    //             "companyName": "Roga Kopyty Inc",
    //             "street": "444 fff",
    //             "city": "New York",
    //             "countryCode": "US",
    //             "countryName": "United States",
    //             "postalCode": "10001",
    //             "stateOrProvinceCode": "NY",
    //             "stateOrProvinceName": "New York",
    //             "phone": "1011991919"
    //           },
    //           "parcel": {
    //             "weight": 0.5,
    //             "weightUnit": 'KILOGRAM',
    //             "width": 10,
    //             "height": 10,
    //             "length": 10,
    //             "dimensionUnit": 'CM'
    //           },
    //           "shippingService": {
    //             "carrier": 'USPS',
    //             "carrierName": 'Shipping,
    //             "carrierServiceName": "Priority Mail",
    //             "carrierServiceCode": "usps_priority"
    //           },
    //           "tracking": {
    //             "tracking_number": "9499907123456123456781",
    //             "tracking_url": "https://tools.usps.com/go/TrackConfirmAction_input?origTrackNum=9499907123456123456781",
    //             "estimatedDays": 3
    //           },
    //           "shippingLabel": {
    //             "label_url": "https://shippo-delivery.s3.amazonaws.com/70ae8117ee1749e393f249d5b77c45e0.pdf?Signature=vDw1ltcyGveVR1OQoUDdzC43BY8%3D&Expires=1437093830&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA",
    //             "commercial_invoice_url": ""
    //           }
    //         }
    //       ],
    //       "taxesOnShipping": [
    //         {
    //           "name": "State tax",
    //           "value": 12,
    //           "total": 57.1
    //         },
    //         {
    //           "name": "TVA",
    //           "value": 20,
    //           "total": 95.17
    //         }
    //       ],
    //       "paymentModule": "CUSTOM_PAYMENT_APP-mollie-pg",
    //       "additionalInfo": {
    //         "google_customer_id": "2008512504.1526280224"
    //       },
    //       "paymentParams": {},
    //       "orderExtraFields": [
    //         {
    //           "id": "lang",
    //           "value": "en",
    //           "customerInputType": "",
    //           "title": "",
    //           "orderDetailsDisplaySection": "",
    //           "orderBy": "1"
    //         },
    //         {
    //           "id": "askHowYouFoundUsApp",
    //           "value": "From a friend",
    //           "customerInputType": "SELECT",
    //           "title": "How did you hear about us?",
    //           "orderDetailsDisplaySection": "order_comments",
    //           "orderBy": "2"
    //         }
    //       ],
    //       "acceptMarketing": true,
    //       "refererId": "Amazon",
    //       "disableAllCustomerNotifications": false,
    //       "externalFulfillment": false,
    //       "pricesIncludeTax": false
    //     }
    //   ]
    // }

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

    var id: [:0]const u8 = "";
    var subtotal: [:0]const u8 = "";
    var total_str: [:0]const u8 = "";
    var gift_card_redemption: [:0]const u8 = "";
    var total_before_gift_card_redemption: [:0]const u8 = "";
    var gift_card_double_spending: bool = false;
    var usd_total: [:0]const u8 = "";
    var tax: [:0]const u8 = "";
    var payment_method: [:0]const u8 = "";
    var payment_status: [:0]const u8 = "";
    var fulfillment_status: [:0]const u8 = "";
    var vendor_order_number: [:0]const u8 = "";
    var order_number: i32 = 0;
    var referer_url: [:0]const u8 = "";
    var global_referer: [:0]const u8 = "";
    var create_date: [:0]const u8 = "";
    var update_date: [:0]const u8 = "";
    var create_timestamp: i32 = 0;
    var update_timestamp: i32 = 0;
    var hidden: bool = false;
    var order_comments: [:0]const u8 = "";
    var private_admin_notes: [:0]const u8 = "";
    var email: [:0]const u8 = "";
    var ip_address: [:0]const u8 = "";
    var customer_id: i32 = 0;
    var customer_group_id: i32 = 0;
    var customer_group: [:0]const u8 = "";
    var customer_tax_exempt: bool = false;
    var customer_tax_id: [:0]const u8 = "";
    var customer_tax_id_valid: bool = false;
    var reversed_tax_applied: bool = false;
    var discount: i32 = 0;
    var coupon_discount: i32 = 0;
    var volume_discount: i32 = 0;
    var membership_based_discount: i32 = 0;
    var total_and_membership_based_discount: i32 = 0;
    var discount_coupon_id: i32 = 0;
    var discount_coupon_name: [:0]const u8 = "";
    var discount_coupon_code: [:0]const u8 = "";
    var discount_coupon_discount_type: [:0]const u8 = "";
    var discount_coupon_status: [:0]const u8 = "";
    var discount_coupon_discount: i32 = 0;
    var discount_coupon_launch_date: [:0]const u8 = "";
    var discount_coupon_uses_limit: [:0]const u8 = "";
    var discount_coupon_application_limit: [:0]const u8 = "";
    var discount_coupon_creation_date: [:0]const u8 = "";
    var discount_coupon_update_date: [:0]const u8 = "";
    var discount_coupon_order_count: i32 = 0;
    var refunded_amount: [:0]const u8 = "";
    var billing_person_name: [:0]const u8 = "";
    var billing_person_company_name: [:0]const u8 = "";
    var billing_person_street: [:0]const u8 = "";
    var billing_person_city: [:0]const u8 = "";
    var billing_person_country_code: [:0]const u8 = "";
    var billing_person_country_name: [:0]const u8 = "";
    var billing_person_postal_code: [:0]const u8 = "";
    var billing_person_state_or_province_code: [:0]const u8 = "";
    var billing_person_state_or_province_name: [:0]const u8 = "";
    var billing_person_phone: [:0]const u8 = "";
    var shipping_person_name: [:0]const u8 = "";
    var shipping_person_company_name: [:0]const u8 = "";
    var shipping_person_street: [:0]const u8 = "";
    var shipping_person_city: [:0]const u8 = "";
    var shipping_person_country_code: [:0]const u8 = "";
    var shipping_person_country_name: [:0]const u8 = "";
    var shipping_person_postal_code: [:0]const u8 = "";
    var shipping_person_state_or_province_code: [:0]const u8 = "";
    var shipping_person_state_or_province_name: [:0]const u8 = "";
    var shipping_person_phone: [:0]const u8 = "";
    var shipping_option_shipping_carrier_name: [:0]const u8 = "";
    var shipping_option_shipping_method_name: [:0]const u8 = "";
    var shipping_option_shipping_rate: [:0]const u8 = "";
    var shipping_option_estimated_transit_time: [:0]const u8 = "";
    var shipping_option_is_pickup: bool = false;
    var handling_fee_name: [:0]const u8 = "";
    var handling_fee_value: i32 = 0;
    var handling_fee_description: [:0]const u8 = "";
    var payment_module: [:0]const u8 = "";
    var additional_info_google_customer_id: [:0]const u8 = "";
    var accept_marketing: bool = false;
    var referer_id: [:0]const u8 = "";
    var disable_all_customer_notifications: bool = false;
    var external_fulfillment: bool = false;
    var prices_include_tax: bool = false;
    var j: i32 = 0;
    var count_j: i32 = 0;
    var value: i32 = 0;
    var v_type: [:0]const u8 = "";
    var base: [:0]const u8 = "";
    var order_total: i32 = 0;
    var id_int: i32 = 0;
    var product_id: i32 = 0;
    var category_id: i32 = 0;
    var price: i32 = 0;
    var product_price: i32 = 0;
    var sku: [:0]const u8 = "";
    var quantity: i32 = 0;
    var short_description: [:0]const u8 = "";
    var shipping: i32 = 0;
    var quantity_in_stock: i32 = 0;
    var name: [:0]const u8 = "";
    var is_shipping_required: bool = false;
    var weight: i32 = 0;
    var track_quantity: bool = false;
    var fixed_shipping_rate_only: bool = false;
    var image_url: [:0]const u8 = "";
    var small_thumbnail_url: [:0]const u8 = "";
    var hd_thumbnail_url: [:0]const u8 = "";
    var fixed_shipping_rate: i32 = 0;
    var digital: bool = false;
    var coupon_applied: bool = false;
    var dimensions_length: i32 = 0;
    var dimensions_width: i32 = 0;
    var dimensions_height: i32 = 0;
    var coupon_amount: [:0]const u8 = "";
    var subscription_id: i32 = 0;
    var recurring_charge_settings_recurring_interval: [:0]const u8 = "";
    var recurring_charge_settings_recurring_interval_count: i32 = 0;
    var k: i32 = 0;
    var count_k: i32 = 0;
    var value_str: [:0]const u8 = "";
    const json1 = try chilkat.JsonObject.init();
    defer json1.deinit();
    var i1_: i32 = 0;
    var count_i1: i32 = 0;
    var str_val: [:0]const u8 = "";
    var selection_title: [:0]const u8 = "";
    var selection_modifier: i32 = 0;
    var selection_modifier_type: [:0]const u8 = "";
    var tax_on_discounted_subtotal: [:0]const u8 = "";
    var tax_on_shipping: i32 = 0;
    var include_in_price: bool = false;
    var discount_info_value: i32 = 0;
    var discount_info_type: [:0]const u8 = "";
    var discount_info_base: [:0]const u8 = "";
    var discount_info_order_total: i32 = 0;
    var date: [:0]const u8 = "";
    var source: [:0]const u8 = "";
    var reason: [:0]const u8 = "";
    var amount: [:0]const u8 = "";
    var length: i32 = 0;
    var width: i32 = 0;
    var height: i32 = 0;
    var weight_str: [:0]const u8 = "";
    var declared_value: [:0]const u8 = "";
    var created: [:0]const u8 = "";
    var ship_to_name: [:0]const u8 = "";
    var ship_to_company_name: [:0]const u8 = "";
    var ship_to_street: [:0]const u8 = "";
    var ship_to_city: [:0]const u8 = "";
    var ship_to_country_code: [:0]const u8 = "";
    var ship_to_country_name: [:0]const u8 = "";
    var ship_to_postal_code: [:0]const u8 = "";
    var ship_to_state_or_province_code: [:0]const u8 = "";
    var ship_to_state_or_province_name: [:0]const u8 = "";
    var ship_to_phone: [:0]const u8 = "";
    var ship_from_company_name: [:0]const u8 = "";
    var ship_from_street: [:0]const u8 = "";
    var ship_from_city: [:0]const u8 = "";
    var ship_from_country_code: [:0]const u8 = "";
    var ship_from_country_name: [:0]const u8 = "";
    var ship_from_postal_code: [:0]const u8 = "";
    var ship_from_state_or_province_code: [:0]const u8 = "";
    var ship_from_state_or_province_name: [:0]const u8 = "";
    var ship_from_phone: [:0]const u8 = "";
    var parcel_weight: [:0]const u8 = "";
    var parcel_weight_unit: i32 = 0;
    var parcel_width: i32 = 0;
    var parcel_height: i32 = 0;
    var parcel_length: i32 = 0;
    var parcel_dimension_unit: i32 = 0;
    var shipping_service_carrier: i32 = 0;
    var shipping_service_carrier_name: i32 = 0;
    var shipping_service_carrier_service_name: [:0]const u8 = "";
    var shipping_service_carrier_service_code: [:0]const u8 = "";
    var tracking_tracking_number: [:0]const u8 = "";
    var tracking_tracking_url: [:0]const u8 = "";
    var tracking_estimated_days: i32 = 0;
    var shipping_label_label_url: [:0]const u8 = "";
    var shipping_label_commercial_invoice_url: [:0]const u8 = "";
    var customer_input_type: [:0]const u8 = "";
    var title: [:0]const u8 = "";
    var order_details_display_section: [:0]const u8 = "";
    var order_by: [:0]const u8 = "";

    _ = j_resp.intOf("total");
    _ = j_resp.intOf("count");
    _ = j_resp.intOf("offset");
    _ = j_resp.intOf("limit");
    var i: i32 = 0;
    const count_i = j_resp.sizeOfArray("items");
    while (i < count_i) {
        j_resp.setI(i);
        id = try j_resp.stringOf(alloc, "items[i].id");
        subtotal = try j_resp.stringOf(alloc, "items[i].subtotal");
        total_str = try j_resp.stringOf(alloc, "items[i].total");
        gift_card_redemption = try j_resp.stringOf(alloc, "items[i].giftCardRedemption");
        total_before_gift_card_redemption = try j_resp.stringOf(alloc, "items[i].totalBeforeGiftCardRedemption");
        gift_card_double_spending = j_resp.boolOf("items[i].giftCardDoubleSpending");
        usd_total = try j_resp.stringOf(alloc, "items[i].usdTotal");
        tax = try j_resp.stringOf(alloc, "items[i].tax");
        payment_method = try j_resp.stringOf(alloc, "items[i].paymentMethod");
        payment_status = try j_resp.stringOf(alloc, "items[i].paymentStatus");
        fulfillment_status = try j_resp.stringOf(alloc, "items[i].fulfillmentStatus");
        vendor_order_number = try j_resp.stringOf(alloc, "items[i].vendorOrderNumber");
        order_number = j_resp.intOf("items[i].orderNumber");
        referer_url = try j_resp.stringOf(alloc, "items[i].refererUrl");
        global_referer = try j_resp.stringOf(alloc, "items[i].globalReferer");
        create_date = try j_resp.stringOf(alloc, "items[i].createDate");
        update_date = try j_resp.stringOf(alloc, "items[i].updateDate");
        create_timestamp = j_resp.intOf("items[i].createTimestamp");
        update_timestamp = j_resp.intOf("items[i].updateTimestamp");
        hidden = j_resp.boolOf("items[i].hidden");
        order_comments = try j_resp.stringOf(alloc, "items[i].orderComments");
        private_admin_notes = try j_resp.stringOf(alloc, "items[i].privateAdminNotes");
        email = try j_resp.stringOf(alloc, "items[i].email");
        ip_address = try j_resp.stringOf(alloc, "items[i].ipAddress");
        customer_id = j_resp.intOf("items[i].customerId");
        customer_group_id = j_resp.intOf("items[i].customerGroupId");
        customer_group = try j_resp.stringOf(alloc, "items[i].customerGroup");
        customer_tax_exempt = j_resp.boolOf("items[i].customerTaxExempt");
        customer_tax_id = try j_resp.stringOf(alloc, "items[i].customerTaxId");
        customer_tax_id_valid = j_resp.boolOf("items[i].customerTaxIdValid");
        reversed_tax_applied = j_resp.boolOf("items[i].reversedTaxApplied");
        discount = j_resp.intOf("items[i].discount");
        coupon_discount = j_resp.intOf("items[i].couponDiscount");
        volume_discount = j_resp.intOf("items[i].volumeDiscount");
        membership_based_discount = j_resp.intOf("items[i].membershipBasedDiscount");
        total_and_membership_based_discount = j_resp.intOf("items[i].totalAndMembershipBasedDiscount");
        discount_coupon_id = j_resp.intOf("items[i].discountCoupon.id");
        discount_coupon_name = try j_resp.stringOf(alloc, "items[i].discountCoupon.name");
        discount_coupon_code = try j_resp.stringOf(alloc, "items[i].discountCoupon.code");
        discount_coupon_discount_type = try j_resp.stringOf(alloc, "items[i].discountCoupon.discountType");
        discount_coupon_status = try j_resp.stringOf(alloc, "items[i].discountCoupon.status");
        discount_coupon_discount = j_resp.intOf("items[i].discountCoupon.discount");
        discount_coupon_launch_date = try j_resp.stringOf(alloc, "items[i].discountCoupon.launchDate");
        discount_coupon_uses_limit = try j_resp.stringOf(alloc, "items[i].discountCoupon.usesLimit");
        discount_coupon_application_limit = try j_resp.stringOf(alloc, "items[i].discountCoupon.applicationLimit");
        discount_coupon_creation_date = try j_resp.stringOf(alloc, "items[i].discountCoupon.creationDate");
        discount_coupon_update_date = try j_resp.stringOf(alloc, "items[i].discountCoupon.updateDate");
        discount_coupon_order_count = j_resp.intOf("items[i].discountCoupon.orderCount");
        refunded_amount = try j_resp.stringOf(alloc, "items[i].refundedAmount");
        billing_person_name = try j_resp.stringOf(alloc, "items[i].billingPerson.name");
        billing_person_company_name = try j_resp.stringOf(alloc, "items[i].billingPerson.companyName");
        billing_person_street = try j_resp.stringOf(alloc, "items[i].billingPerson.street");
        billing_person_city = try j_resp.stringOf(alloc, "items[i].billingPerson.city");
        billing_person_country_code = try j_resp.stringOf(alloc, "items[i].billingPerson.countryCode");
        billing_person_country_name = try j_resp.stringOf(alloc, "items[i].billingPerson.countryName");
        billing_person_postal_code = try j_resp.stringOf(alloc, "items[i].billingPerson.postalCode");
        billing_person_state_or_province_code = try j_resp.stringOf(alloc, "items[i].billingPerson.stateOrProvinceCode");
        billing_person_state_or_province_name = try j_resp.stringOf(alloc, "items[i].billingPerson.stateOrProvinceName");
        billing_person_phone = try j_resp.stringOf(alloc, "items[i].billingPerson.phone");
        shipping_person_name = try j_resp.stringOf(alloc, "items[i].shippingPerson.name");
        shipping_person_company_name = try j_resp.stringOf(alloc, "items[i].shippingPerson.companyName");
        shipping_person_street = try j_resp.stringOf(alloc, "items[i].shippingPerson.street");
        shipping_person_city = try j_resp.stringOf(alloc, "items[i].shippingPerson.city");
        shipping_person_country_code = try j_resp.stringOf(alloc, "items[i].shippingPerson.countryCode");
        shipping_person_country_name = try j_resp.stringOf(alloc, "items[i].shippingPerson.countryName");
        shipping_person_postal_code = try j_resp.stringOf(alloc, "items[i].shippingPerson.postalCode");
        shipping_person_state_or_province_code = try j_resp.stringOf(alloc, "items[i].shippingPerson.stateOrProvinceCode");
        shipping_person_state_or_province_name = try j_resp.stringOf(alloc, "items[i].shippingPerson.stateOrProvinceName");
        shipping_person_phone = try j_resp.stringOf(alloc, "items[i].shippingPerson.phone");
        shipping_option_shipping_carrier_name = try j_resp.stringOf(alloc, "items[i].shippingOption.shippingCarrierName");
        shipping_option_shipping_method_name = try j_resp.stringOf(alloc, "items[i].shippingOption.shippingMethodName");
        shipping_option_shipping_rate = try j_resp.stringOf(alloc, "items[i].shippingOption.shippingRate");
        shipping_option_estimated_transit_time = try j_resp.stringOf(alloc, "items[i].shippingOption.estimatedTransitTime");
        shipping_option_is_pickup = j_resp.boolOf("items[i].shippingOption.isPickup");
        handling_fee_name = try j_resp.stringOf(alloc, "items[i].handlingFee.name");
        handling_fee_value = j_resp.intOf("items[i].handlingFee.value");
        handling_fee_description = try j_resp.stringOf(alloc, "items[i].handlingFee.description");
        payment_module = try j_resp.stringOf(alloc, "items[i].paymentModule");
        additional_info_google_customer_id = try j_resp.stringOf(alloc, "items[i].additionalInfo.google_customer_id");
        accept_marketing = j_resp.boolOf("items[i].acceptMarketing");
        referer_id = try j_resp.stringOf(alloc, "items[i].refererId");
        disable_all_customer_notifications = j_resp.boolOf("items[i].disableAllCustomerNotifications");
        external_fulfillment = j_resp.boolOf("items[i].externalFulfillment");
        prices_include_tax = j_resp.boolOf("items[i].pricesIncludeTax");
        j = 0;
        count_j = j_resp.sizeOfArray("items[i].customDiscount");
        while (j < count_j) {
            j_resp.setJ(j);
            j = j + 1;
        }

        j = 0;
        count_j = j_resp.sizeOfArray("items[i].discountInfo");
        while (j < count_j) {
            j_resp.setJ(j);
            value = j_resp.intOf("items[i].discountInfo[j].value");
            v_type = try j_resp.stringOf(alloc, "items[i].discountInfo[j].type");
            base = try j_resp.stringOf(alloc, "items[i].discountInfo[j].base");
            order_total = j_resp.intOf("items[i].discountInfo[j].orderTotal");
            j = j + 1;
        }

        j = 0;
        count_j = j_resp.sizeOfArray("items[i].items");
        while (j < count_j) {
            j_resp.setJ(j);
            id_int = j_resp.intOf("items[i].items[j].id");
            product_id = j_resp.intOf("items[i].items[j].productId");
            category_id = j_resp.intOf("items[i].items[j].categoryId");
            price = j_resp.intOf("items[i].items[j].price");
            product_price = j_resp.intOf("items[i].items[j].productPrice");
            sku = try j_resp.stringOf(alloc, "items[i].items[j].sku");
            quantity = j_resp.intOf("items[i].items[j].quantity");
            short_description = try j_resp.stringOf(alloc, "items[i].items[j].shortDescription");
            tax = try j_resp.stringOf(alloc, "items[i].items[j].tax");
            shipping = j_resp.intOf("items[i].items[j].shipping");
            quantity_in_stock = j_resp.intOf("items[i].items[j].quantityInStock");
            name = try j_resp.stringOf(alloc, "items[i].items[j].name");
            is_shipping_required = j_resp.boolOf("items[i].items[j].isShippingRequired");
            weight = j_resp.intOf("items[i].items[j].weight");
            track_quantity = j_resp.boolOf("items[i].items[j].trackQuantity");
            fixed_shipping_rate_only = j_resp.boolOf("items[i].items[j].fixedShippingRateOnly");
            image_url = try j_resp.stringOf(alloc, "items[i].items[j].imageUrl");
            small_thumbnail_url = try j_resp.stringOf(alloc, "items[i].items[j].smallThumbnailUrl");
            hd_thumbnail_url = try j_resp.stringOf(alloc, "items[i].items[j].hdThumbnailUrl");
            fixed_shipping_rate = j_resp.intOf("items[i].items[j].fixedShippingRate");
            digital = j_resp.boolOf("items[i].items[j].digital");
            coupon_applied = j_resp.boolOf("items[i].items[j].couponApplied");
            dimensions_length = j_resp.intOf("items[i].items[j].dimensions.length");
            dimensions_width = j_resp.intOf("items[i].items[j].dimensions.width");
            dimensions_height = j_resp.intOf("items[i].items[j].dimensions.height");
            coupon_amount = try j_resp.stringOf(alloc, "items[i].items[j].couponAmount");
            subscription_id = j_resp.intOf("items[i].items[j].subscriptionId");
            recurring_charge_settings_recurring_interval = try j_resp.stringOf(alloc, "items[i].items[j].recurringChargeSettings.recurringInterval");
            recurring_charge_settings_recurring_interval_count = j_resp.intOf("items[i].items[j].recurringChargeSettings.recurringIntervalCount");
            k = 0;
            count_k = j_resp.sizeOfArray("items[i].items[j].selectedOptions");
            while (k < count_k) {
                j_resp.setK(k);
                name = try j_resp.stringOf(alloc, "items[i].items[j].selectedOptions[k].name");
                value_str = try j_resp.stringOf(alloc, "items[i].items[j].selectedOptions[k].value");
                v_type = try j_resp.stringOf(alloc, "items[i].items[j].selectedOptions[k].type");
                j_resp.objectOf2("items[i].items[j].selectedOptions[k]", json1) catch {};

                i1_ = 0;
                count_i1 = json1.sizeOfArray("valuesArray");
                while (i1_ < count_i1) {
                    json1.setI(i1_);
                    str_val = try json1.stringOf(alloc, "valuesArray[i]");
                    i1_ = i1_ + 1;
                }

                j_resp.objectOf2("items[i].items[j].selectedOptions[k]", json1) catch {};
                i1_ = 0;
                count_i1 = json1.sizeOfArray("selections");
                while (i1_ < count_i1) {
                    json1.setI(i1_);
                    selection_title = try json1.stringOf(alloc, "selections[i].selectionTitle");
                    selection_modifier = json1.intOf("selections[i].selectionModifier");
                    selection_modifier_type = try json1.stringOf(alloc, "selections[i].selectionModifierType");
                    i1_ = i1_ + 1;
                }

                k = k + 1;
            }

            k = 0;
            count_k = j_resp.sizeOfArray("items[i].items[j].taxes");
            while (k < count_k) {
                j_resp.setK(k);
                name = try j_resp.stringOf(alloc, "items[i].items[j].taxes[k].name");
                value = j_resp.intOf("items[i].items[j].taxes[k].value");
                total_str = try j_resp.stringOf(alloc, "items[i].items[j].taxes[k].total");
                tax_on_discounted_subtotal = try j_resp.stringOf(alloc, "items[i].items[j].taxes[k].taxOnDiscountedSubtotal");
                tax_on_shipping = j_resp.intOf("items[i].items[j].taxes[k].taxOnShipping");
                include_in_price = j_resp.boolOf("items[i].items[j].taxes[k].includeInPrice");
                k = k + 1;
            }

            k = 0;
            count_k = j_resp.sizeOfArray("items[i].items[j].discounts");
            while (k < count_k) {
                j_resp.setK(k);
                discount_info_value = j_resp.intOf("items[i].items[j].discounts[k].discountInfo.value");
                discount_info_type = try j_resp.stringOf(alloc, "items[i].items[j].discounts[k].discountInfo.type");
                discount_info_base = try j_resp.stringOf(alloc, "items[i].items[j].discounts[k].discountInfo.base");
                discount_info_order_total = j_resp.intOf("items[i].items[j].discounts[k].discountInfo.orderTotal");
                total_str = try j_resp.stringOf(alloc, "items[i].items[j].discounts[k].total");
                k = k + 1;
            }

            j = j + 1;
        }

        j = 0;
        count_j = j_resp.sizeOfArray("items[i].refunds");
        while (j < count_j) {
            j_resp.setJ(j);
            date = try j_resp.stringOf(alloc, "items[i].refunds[j].date");
            source = try j_resp.stringOf(alloc, "items[i].refunds[j].source");
            reason = try j_resp.stringOf(alloc, "items[i].refunds[j].reason");
            amount = try j_resp.stringOf(alloc, "items[i].refunds[j].amount");
            j = j + 1;
        }

        j = 0;
        count_j = j_resp.sizeOfArray("items[i].predictedPackage");
        while (j < count_j) {
            j_resp.setJ(j);
            length = j_resp.intOf("items[i].predictedPackage[j].length");
            width = j_resp.intOf("items[i].predictedPackage[j].width");
            height = j_resp.intOf("items[i].predictedPackage[j].height");
            weight_str = try j_resp.stringOf(alloc, "items[i].predictedPackage[j].weight");
            declared_value = try j_resp.stringOf(alloc, "items[i].predictedPackage[j].declaredValue");
            j = j + 1;
        }

        j = 0;
        count_j = j_resp.sizeOfArray("items[i].shipments");
        while (j < count_j) {
            j_resp.setJ(j);
            id = try j_resp.stringOf(alloc, "items[i].shipments[j].id");
            created = try j_resp.stringOf(alloc, "items[i].shipments[j].created");
            ship_to_name = try j_resp.stringOf(alloc, "items[i].shipments[j].shipTo.name");
            ship_to_company_name = try j_resp.stringOf(alloc, "items[i].shipments[j].shipTo.companyName");
            ship_to_street = try j_resp.stringOf(alloc, "items[i].shipments[j].shipTo.street");
            ship_to_city = try j_resp.stringOf(alloc, "items[i].shipments[j].shipTo.city");
            ship_to_country_code = try j_resp.stringOf(alloc, "items[i].shipments[j].shipTo.countryCode");
            ship_to_country_name = try j_resp.stringOf(alloc, "items[i].shipments[j].shipTo.countryName");
            ship_to_postal_code = try j_resp.stringOf(alloc, "items[i].shipments[j].shipTo.postalCode");
            ship_to_state_or_province_code = try j_resp.stringOf(alloc, "items[i].shipments[j].shipTo.stateOrProvinceCode");
            ship_to_state_or_province_name = try j_resp.stringOf(alloc, "items[i].shipments[j].shipTo.stateOrProvinceName");
            ship_to_phone = try j_resp.stringOf(alloc, "items[i].shipments[j].shipTo.phone");
            ship_from_company_name = try j_resp.stringOf(alloc, "items[i].shipments[j].shipFrom.companyName");
            ship_from_street = try j_resp.stringOf(alloc, "items[i].shipments[j].shipFrom.street");
            ship_from_city = try j_resp.stringOf(alloc, "items[i].shipments[j].shipFrom.city");
            ship_from_country_code = try j_resp.stringOf(alloc, "items[i].shipments[j].shipFrom.countryCode");
            ship_from_country_name = try j_resp.stringOf(alloc, "items[i].shipments[j].shipFrom.countryName");
            ship_from_postal_code = try j_resp.stringOf(alloc, "items[i].shipments[j].shipFrom.postalCode");
            ship_from_state_or_province_code = try j_resp.stringOf(alloc, "items[i].shipments[j].shipFrom.stateOrProvinceCode");
            ship_from_state_or_province_name = try j_resp.stringOf(alloc, "items[i].shipments[j].shipFrom.stateOrProvinceName");
            ship_from_phone = try j_resp.stringOf(alloc, "items[i].shipments[j].shipFrom.phone");
            parcel_weight = try j_resp.stringOf(alloc, "items[i].shipments[j].parcel.weight");
            parcel_weight_unit = j_resp.intOf("items[i].shipments[j].parcel.weightUnit");
            parcel_width = j_resp.intOf("items[i].shipments[j].parcel.width");
            parcel_height = j_resp.intOf("items[i].shipments[j].parcel.height");
            parcel_length = j_resp.intOf("items[i].shipments[j].parcel.length");
            parcel_dimension_unit = j_resp.intOf("items[i].shipments[j].parcel.dimensionUnit");
            shipping_service_carrier = j_resp.intOf("items[i].shipments[j].shippingService.carrier");
            shipping_service_carrier_name = j_resp.intOf("items[i].shipments[j].shippingService.carrierName");
            shipping_service_carrier_service_name = try j_resp.stringOf(alloc, "items[i].shipments[j].shippingService.carrierServiceName");
            shipping_service_carrier_service_code = try j_resp.stringOf(alloc, "items[i].shipments[j].shippingService.carrierServiceCode");
            tracking_tracking_number = try j_resp.stringOf(alloc, "items[i].shipments[j].tracking.tracking_number");
            tracking_tracking_url = try j_resp.stringOf(alloc, "items[i].shipments[j].tracking.tracking_url");
            tracking_estimated_days = j_resp.intOf("items[i].shipments[j].tracking.estimatedDays");
            shipping_label_label_url = try j_resp.stringOf(alloc, "items[i].shipments[j].shippingLabel.label_url");
            shipping_label_commercial_invoice_url = try j_resp.stringOf(alloc, "items[i].shipments[j].shippingLabel.commercial_invoice_url");
            j = j + 1;
        }

        j = 0;
        count_j = j_resp.sizeOfArray("items[i].taxesOnShipping");
        while (j < count_j) {
            j_resp.setJ(j);
            name = try j_resp.stringOf(alloc, "items[i].taxesOnShipping[j].name");
            value = j_resp.intOf("items[i].taxesOnShipping[j].value");
            total_str = try j_resp.stringOf(alloc, "items[i].taxesOnShipping[j].total");
            j = j + 1;
        }

        j = 0;
        count_j = j_resp.sizeOfArray("items[i].orderExtraFields");
        while (j < count_j) {
            j_resp.setJ(j);
            id = try j_resp.stringOf(alloc, "items[i].orderExtraFields[j].id");
            value_str = try j_resp.stringOf(alloc, "items[i].orderExtraFields[j].value");
            customer_input_type = try j_resp.stringOf(alloc, "items[i].orderExtraFields[j].customerInputType");
            title = try j_resp.stringOf(alloc, "items[i].orderExtraFields[j].title");
            order_details_display_section = try j_resp.stringOf(alloc, "items[i].orderExtraFields[j].orderDetailsDisplaySection");
            order_by = try j_resp.stringOf(alloc, "items[i].orderExtraFields[j].orderBy");
            j = j + 1;
        }

        i = i + 1;
    }
}